]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Restore from BR_QT4_dev
authornds <nds@opencascade.com>
Tue, 2 Oct 2007 11:33:58 +0000 (11:33 +0000)
committernds <nds@opencascade.com>
Tue, 2 Oct 2007 11:33:58 +0000 (11:33 +0000)
150 files changed:
src/CAF/CAF.h [new file with mode: 0755]
src/CAF/CAF.pro [new file with mode: 0644]
src/CAF/CAF_Application.cxx [new file with mode: 0755]
src/CAF/CAF_Application.h [new file with mode: 0755]
src/CAF/CAF_Operation.cxx [new file with mode: 0755]
src/CAF/CAF_Operation.h [new file with mode: 0755]
src/CAF/CAF_Study.cxx [new file with mode: 0755]
src/CAF/CAF_Study.h [new file with mode: 0755]
src/CAF/CAF_Tools.cxx [new file with mode: 0755]
src/CAF/CAF_Tools.h [new file with mode: 0755]
src/CAF/resources/CAF_images.po [new file with mode: 0755]
src/CAF/resources/CAF_images.ts [new file with mode: 0644]
src/CAF/resources/CAF_msg_en.po [new file with mode: 0755]
src/CAF/resources/CAF_msg_en.ts [new file with mode: 0644]
src/LogWindow/resources/LogWindow_msg_en.ts [new file with mode: 0644]
src/OBJECT/Handle_SALOME_AISObject.hxx [new file with mode: 0755]
src/OBJECT/Handle_SALOME_AISShape.hxx [new file with mode: 0755]
src/OBJECT/Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx [new file with mode: 0644]
src/OBJECT/Handle_SALOME_Filter.hxx [new file with mode: 0644]
src/OBJECT/Handle_SALOME_InteractiveObject.hxx [new file with mode: 0755]
src/OBJECT/Handle_SALOME_ListNodeOfListIO.hxx [new file with mode: 0644]
src/OBJECT/Handle_SALOME_TypeFilter.hxx [new file with mode: 0644]
src/OBJECT/OBJECT.pro [new file with mode: 0644]
src/OBJECT/SALOME_AISObject.cxx [new file with mode: 0755]
src/OBJECT/SALOME_AISObject.hxx [new file with mode: 0755]
src/OBJECT/SALOME_AISObject.ixx [new file with mode: 0755]
src/OBJECT/SALOME_AISObject.jxx [new file with mode: 0755]
src/OBJECT/SALOME_AISShape.cxx [new file with mode: 0755]
src/OBJECT/SALOME_AISShape.hxx [new file with mode: 0755]
src/OBJECT/SALOME_AISShape.ixx [new file with mode: 0755]
src/OBJECT/SALOME_AISShape.jxx [new file with mode: 0755]
src/OBJECT/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx [new file with mode: 0644]
src/OBJECT/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_0.cxx [new file with mode: 0644]
src/OBJECT/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx [new file with mode: 0644]
src/OBJECT/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_0.cxx [new file with mode: 0644]
src/OBJECT/SALOME_DataMapOfIOMapOfInteger.hxx [new file with mode: 0644]
src/OBJECT/SALOME_DataMapOfIOMapOfInteger_0.cxx [new file with mode: 0644]
src/OBJECT/SALOME_Filter.cxx [new file with mode: 0644]
src/OBJECT/SALOME_Filter.hxx [new file with mode: 0644]
src/OBJECT/SALOME_Filter.ixx [new file with mode: 0644]
src/OBJECT/SALOME_Filter.jxx [new file with mode: 0644]
src/OBJECT/SALOME_InteractiveObject.cxx [new file with mode: 0755]
src/OBJECT/SALOME_InteractiveObject.hxx [new file with mode: 0755]
src/OBJECT/SALOME_InteractiveObject.ixx [new file with mode: 0755]
src/OBJECT/SALOME_InteractiveObject.jxx [new file with mode: 0755]
src/OBJECT/SALOME_ListIO.hxx [new file with mode: 0644]
src/OBJECT/SALOME_ListIO_0.cxx [new file with mode: 0644]
src/OBJECT/SALOME_ListIteratorOfListIO.hxx [new file with mode: 0644]
src/OBJECT/SALOME_ListIteratorOfListIO_0.cxx [new file with mode: 0644]
src/OBJECT/SALOME_ListNodeOfListIO.hxx [new file with mode: 0644]
src/OBJECT/SALOME_ListNodeOfListIO_0.cxx [new file with mode: 0644]
src/OBJECT/SALOME_Selection.h [new file with mode: 0644]
src/OBJECT/SALOME_TypeFilter.cxx [new file with mode: 0644]
src/OBJECT/SALOME_TypeFilter.hxx [new file with mode: 0644]
src/OBJECT/SALOME_TypeFilter.ixx [new file with mode: 0644]
src/OBJECT/SALOME_TypeFilter.jxx [new file with mode: 0644]
src/Plot2d/resources/Plot2d_images.po [new file with mode: 0755]
src/Plot2d/resources/Plot2d_images.ts [new file with mode: 0644]
src/Plot2d/resources/Plot2d_msg_en.po [new file with mode: 0755]
src/Plot2d/resources/Plot2d_msg_en.ts [new file with mode: 0644]
src/Plot2d/resources/plot2d_camera_dump.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_clone.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_fitall.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_fitarea.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_glpan.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_legend.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_linear.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_linear_y.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_lines.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_log.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_log_y.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_pan.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_points.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_settings.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_splines.png [new file with mode: 0755]
src/Plot2d/resources/plot2d_zoom.png [new file with mode: 0755]
src/Prs/Prs.pro [new file with mode: 0644]
src/Prs/SALOME_Prs.cxx [new file with mode: 0755]
src/Prs/SALOME_Prs.h [new file with mode: 0755]
src/SVTK/SALOME_Actor.cxx [new file with mode: 0644]
src/SVTK/SALOME_Actor.h [new file with mode: 0644]
src/SVTK/SVTK.cxx [new file with mode: 0644]
src/SVTK/SVTK.h [new file with mode: 0755]
src/SVTK/SVTK.pro [new file with mode: 0644]
src/SVTK/SVTK_Actor.cxx [new file with mode: 0644]
src/SVTK/SVTK_Actor.h [new file with mode: 0644]
src/SVTK/SVTK_CubeAxesActor2D.cxx [new file with mode: 0644]
src/SVTK/SVTK_CubeAxesActor2D.h [new file with mode: 0644]
src/SVTK/SVTK_CubeAxesDlg.cxx [new file with mode: 0644]
src/SVTK/SVTK_CubeAxesDlg.h [new file with mode: 0644]
src/SVTK/SVTK_DeviceActor.cxx [new file with mode: 0644]
src/SVTK/SVTK_DeviceActor.h [new file with mode: 0644]
src/SVTK/SVTK_DialogBase.cxx [new file with mode: 0644]
src/SVTK/SVTK_DialogBase.h [new file with mode: 0644]
src/SVTK/SVTK_Event.h [new file with mode: 0644]
src/SVTK/SVTK_Extension.cxx [new file with mode: 0755]
src/SVTK/SVTK_Extension.h [new file with mode: 0755]
src/SVTK/SVTK_FontWidget.cxx [new file with mode: 0644]
src/SVTK/SVTK_FontWidget.h [new file with mode: 0644]
src/SVTK/SVTK_Functor.h [new file with mode: 0644]
src/SVTK/SVTK_GenericRenderWindowInteractor.cxx [new file with mode: 0644]
src/SVTK/SVTK_GenericRenderWindowInteractor.h [new file with mode: 0644]
src/SVTK/SVTK_InteractorStyle.cxx [new file with mode: 0644]
src/SVTK/SVTK_InteractorStyle.h [new file with mode: 0644]
src/SVTK/SVTK_MainWindow.cxx [new file with mode: 0644]
src/SVTK/SVTK_MainWindow.h [new file with mode: 0644]
src/SVTK/SVTK_NonIsometricDlg.cxx [new file with mode: 0644]
src/SVTK/SVTK_NonIsometricDlg.h [new file with mode: 0644]
src/SVTK/SVTK_Prs.cxx [new file with mode: 0644]
src/SVTK/SVTK_Prs.h [new file with mode: 0644]
src/SVTK/SVTK_RectPicker.cxx [new file with mode: 0644]
src/SVTK/SVTK_RectPicker.h [new file with mode: 0644]
src/SVTK/SVTK_RenderWindowInteractor.cxx [new file with mode: 0644]
src/SVTK/SVTK_RenderWindowInteractor.h [new file with mode: 0644]
src/SVTK/SVTK_Renderer.cxx [new file with mode: 0644]
src/SVTK/SVTK_Renderer.h [new file with mode: 0644]
src/SVTK/SVTK_Selection.h [new file with mode: 0644]
src/SVTK/SVTK_SelectionEvent.h [new file with mode: 0644]
src/SVTK/SVTK_Selector.cxx [new file with mode: 0644]
src/SVTK/SVTK_Selector.h [new file with mode: 0644]
src/SVTK/SVTK_SelectorDef.h [new file with mode: 0644]
src/SVTK/SVTK_SetRotationPointDlg.cxx [new file with mode: 0755]
src/SVTK/SVTK_SetRotationPointDlg.h [new file with mode: 0755]
src/SVTK/SVTK_SpaceMouse.cxx [new file with mode: 0644]
src/SVTK/SVTK_SpaceMouse.h [new file with mode: 0644]
src/SVTK/SVTK_Trihedron.cxx [new file with mode: 0644]
src/SVTK/SVTK_Trihedron.h [new file with mode: 0644]
src/SVTK/SVTK_UpdateRateDlg.cxx [new file with mode: 0644]
src/SVTK/SVTK_UpdateRateDlg.h [new file with mode: 0644]
src/SVTK/SVTK_View.cxx [new file with mode: 0644]
src/SVTK/SVTK_View.h [new file with mode: 0644]
src/SVTK/SVTK_ViewManager.cxx [new file with mode: 0644]
src/SVTK/SVTK_ViewManager.h [new file with mode: 0644]
src/SVTK/SVTK_ViewModel.cxx [new file with mode: 0644]
src/SVTK/SVTK_ViewModel.h [new file with mode: 0644]
src/SVTK/SVTK_ViewModelBase.h [new file with mode: 0644]
src/SVTK/SVTK_ViewWindow.cxx [new file with mode: 0755]
src/SVTK/SVTK_ViewWindow.h [new file with mode: 0755]
src/SVTK/resources/SVTK_images.po [new file with mode: 0644]
src/SVTK/resources/SVTK_images.ts [new file with mode: 0644]
src/SVTK/resources/SVTK_msg_en.po [new file with mode: 0755]
src/SVTK/resources/SVTK_msg_en.ts [new file with mode: 0644]
src/Style/Style.h [new file with mode: 0644]
src/Style/Style.pro [new file with mode: 0644]
src/Style/Style_Model.cxx [new file with mode: 0644]
src/Style/Style_Model.h [new file with mode: 0644]
src/Style/Style_Salome.cxx [new file with mode: 0644]
src/Style/Style_Salome.h [new file with mode: 0644]
src/Style/Style_Tools.cxx [new file with mode: 0644]
src/Style/Style_Tools.h [new file with mode: 0644]

diff --git a/src/CAF/CAF.h b/src/CAF/CAF.h
new file mode 100755 (executable)
index 0000000..ed6a8ea
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 CAF_H
+#define CAF_H
+
+#if defined WIN32
+#  if defined CAF_EXPORTS
+#    define CAF_EXPORT __declspec( dllexport )
+#  else
+#    define CAF_EXPORT __declspec( dllimport )
+#  endif
+#else
+#  define CAF_EXPORT
+#endif
+
+#if defined SOLARIS
+#define bool  int
+#define false 0
+#define true  1
+#endif
+
+#if defined WIN32
+#pragma warning ( disable: 4251 )
+#endif
+
+#if defined ( _DEBUG ) || defined ( DEBUG )
+#include <assert.h>
+#define CAF_VERIFY(x) assert(x);
+#define CAF_ASSERT(x) assert(x);
+#else
+#define CAF_VERIFY(x) x
+#define CAF_ASSERT(x)
+#endif
+
+#endif
diff --git a/src/CAF/CAF.pro b/src/CAF/CAF.pro
new file mode 100644 (file)
index 0000000..17bdb9f
--- /dev/null
@@ -0,0 +1,52 @@
+TEMPLATE = lib
+
+DESTDIR = ../../$(CONFIG_ID)/lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../$(CONFIG_ID)/obj/$$TARGET
+
+CASROOT = $$(CASROOT)
+CAS_CPPFLAGS = $${CASROOT}/inc
+
+CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
+
+CAS_VIEWER = -L$${CASROOT}/Linux/lib -lTKV3d -lTKService
+
+INCLUDEPATH += ../../include $${CAS_CPPFLAGS}
+LIBS += -L../../$(CONFIG_ID)/lib $${CAS_KERNEL} $${CAS_VIEWER} -lQtx -lSUIT -lSTD
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += CAF_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
+
+HEADERS  = *.h
+
+SOURCES  = *.cxx
+
+TRANSLATIONS = resources/CAF_images.ts \
+               resources/CAF_msg_en.ts
+
+unix:GUIResources = ../../resources
+win32:GUIResources = ..\\..\\resources
+
+lrelease.name = LRELASE ${QMAKE_FILE_IN}
+unix:lrelease.commands = $(QTDIR)/$(CONFIG_ID)/bin/lrelease ${QMAKE_FILE_NAME} -qm $${GUIResources}/${QMAKE_FILE_BASE}.qm
+win32:lrelease.commands = $(QTDIR)\\$(CONFIG_ID)\\bin\\lrelease ${QMAKE_FILE_NAME} -qm $${GUIResources}\\${QMAKE_FILE_BASE}.qm
+unix:lrelease.output = $${GUIResources}/${QMAKE_FILE_BASE}.qm
+win32:lrelease.output = $${GUIResources}\\${QMAKE_FILE_BASE}.qm
+lrelease.input = TRANSLATIONS
+unix:lrelease.clean = $${GUIResources}/${QMAKE_FILE_BASE}.qm
+win32:lrelease.clean = $${GUIResources}\\${QMAKE_FILE_BASE}.qm
+lrelease.CONFIG += no_link target_predeps
+QMAKE_EXTRA_COMPILERS += lrelease
+
+ICONS   = resources/*.png
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+resources.files = $$ICONS resources/*.xml resources/*.ini
+resources.path = ../../resources
+
+INSTALLS += includes resources
diff --git a/src/CAF/CAF_Application.cxx b/src/CAF/CAF_Application.cxx
new file mode 100755 (executable)
index 0000000..ac268da
--- /dev/null
@@ -0,0 +1,334 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 "CAF_Application.h"
+
+#include "CAF_Tools.h"
+#include "CAF_Study.h"
+
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <QtxAction.h>
+#include <QtxListAction.h>
+
+#include <QMap>
+#include <QStringList>
+
+#include <Resource_Manager.hxx>
+#include <TColStd_SequenceOfExtendedString.hxx>
+
+/*!
+  \brief Create new instance of CAF_Application.
+  \return new instance of CAF_Application class
+*/
+extern "C" CAF_EXPORT SUIT_Application* createApplication()
+{
+  return new CAF_Application();
+}
+
+/*!
+  \class CAF_Application
+  \brief OCC OCAF-based application.
+
+  Defines application configuration and behaviour for application using 
+  standard OCC OCAF data model. Allows using OCC OCAF serives
+  (for example, undo/redo mechanizm).
+*/
+
+/*!
+  \brief Default constructor.
+*/
+CAF_Application::CAF_Application()
+: STD_Application()
+{
+}
+
+/*!
+  \brief Constructor.
+  \param app OCAF application
+*/
+CAF_Application::CAF_Application( const Handle( TDocStd_Application )& app )
+: STD_Application(),
+  myStdApp( app )
+{
+}
+
+/*!
+  \brief Destructor.
+*/
+CAF_Application::~CAF_Application()
+{
+}
+
+/*!
+  \brief Get application name.
+  \return application name
+*/
+QString CAF_Application::applicationName() const
+{
+  return QString( "CAFApplication" );
+}
+
+/*!
+  \brief Get OCAF application.
+  \return handle to OCAF application object
+*/
+Handle( TDocStd_Application ) CAF_Application::stdApp() const
+{
+  return myStdApp;
+}
+
+/*!
+  \brief Get file extension filter.
+
+  The file extension filter is used in Open/Save dialog boxes.
+
+  \return file filters for open/save document dialog box
+*/
+QString CAF_Application::getFileFilter() const
+{
+  if ( stdApp().IsNull() )
+    return QString();
+
+  TColStd_SequenceOfExtendedString formats;
+  stdApp()->Formats( formats );
+
+  QStringList allWC;
+  QMap<QString, QStringList> wildCards;
+  Handle(Resource_Manager) resMgr = new Resource_Manager( stdApp()->ResourcesName() );
+  for ( int i = 1; i <= formats.Length(); i++ )
+  {
+    QString extension;
+    QString extResStr = CAF_Tools::toQString( formats.Value( i ) ) + QString( ".FileExtension" );
+    if ( resMgr->Find( extResStr.toLatin1().data() ) )
+      extension = QString( resMgr->Value( extResStr.toLatin1().data() ) );
+
+    QString descr;
+    QString descrResStr = CAF_Tools::toQString( formats.Value( i ) ) + QString( ".Description" );
+    if ( resMgr->Find( (char*)descrResStr.toLatin1().data() ) )
+      descr = QString( resMgr->Value( (char*)descrResStr.toLatin1().data() ) );
+
+    if ( !descr.isEmpty() && !extension.isEmpty() )
+    {
+      if ( !wildCards.contains( descr ) )
+        wildCards.insert( descr, QStringList() );
+      wildCards[descr].append( QString( "*.%1" ).arg( extension ) );
+      allWC.append( QString( "*.%1" ).arg( extension ) );
+    }
+  }
+
+  if ( wildCards.isEmpty() )
+    return QString();
+
+  QStringList filters;
+  for ( QMap<QString, QStringList>::ConstIterator it = wildCards.begin(); it != wildCards.end(); ++it )
+    filters.append( QString( "%1 (%2)" ).arg( it.key() ).arg( it.value().join( "; " ) ) );
+
+  if ( wildCards.count() > 1 )
+    filters.prepend( QString( "%1 (%2)" ).arg( tr( "INF_ALL_DOCUMENTS_FILTER" ) ).arg( allWC.join( "; " ) ) );
+
+  if ( !filters.isEmpty() )
+    filters.append( tr( "INF_ALL_FILTER" ) );
+
+  return filters.join( ";;" );
+}
+
+/*!
+  \brief Create menu and toolbars actions.
+*/
+void CAF_Application::createActions()
+{
+  STD_Application::createActions();
+
+  SUIT_Desktop* desk = desktop();
+  SUIT_ResourceMgr* resMgr = resourceMgr();
+
+  QtxListAction* editUndo = 
+    new QtxListAction( tr( "TOT_APP_EDIT_UNDO" ), 
+                      resMgr->loadPixmap( "STD", tr( "ICON_EDIT_UNDO" ) ),
+                      tr( "MEN_APP_EDIT_UNDO" ), Qt::CTRL+Qt::Key_Z, desk );
+  editUndo->setStatusTip( tr( "PRP_APP_EDIT_UNDO" ) );
+  registerAction( EditUndoId, editUndo );
+
+  QtxListAction* editRedo =
+    new QtxListAction( tr( "TOT_APP_EDIT_REDO" ), 
+                      resMgr->loadPixmap( "STD", tr( "ICON_EDIT_REDO" ) ),
+                      tr( "MEN_APP_EDIT_REDO" ), Qt::CTRL+Qt::Key_Y, desk );
+  editRedo->setStatusTip( tr( "PRP_APP_EDIT_REDO" ) );
+  registerAction( EditRedoId, editRedo );
+
+  editUndo->setComment( tr( "INF_APP_UNDOACTIONS" ) );
+  editRedo->setComment( tr( "INF_APP_REDOACTIONS" ) );
+
+  connect( editUndo, SIGNAL( activated( int ) ), this, SLOT( onUndo( int ) ) );
+  connect( editRedo, SIGNAL( activated( int ) ), this, SLOT( onRedo( int ) ) );
+
+  int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1, 10 );
+
+  createMenu( EditUndoId, editMenu, 0 );
+  createMenu( EditRedoId, editMenu, 0 );
+  createMenu( separator(), editMenu, -1, 0 );
+
+  int stdTBar = createTool( tr( "INF_DESK_TOOLBAR_STANDARD" ) );
+
+  createTool( separator(), stdTBar );
+  createTool( EditUndoId, stdTBar );
+  createTool( EditRedoId, stdTBar );
+  createTool( separator(), stdTBar );
+}
+
+/*!
+  \brief Undo latest command operation for specified document.
+  \param doc OCAF document
+  \return \c true on success
+*/
+bool CAF_Application::undo( CAF_Study* doc )
+{
+  bool success = false;
+  if ( doc )
+  {
+    if ( success = doc->undo() )
+      doc->update();
+  }
+  return success;
+}
+
+/*!
+  \brief Redo latest command operation undo for specified document.
+  \param doc OCAF document
+  \return \c true on success
+*/
+bool CAF_Application::redo(CAF_Study* doc)
+{
+  bool success = false;
+  if ( doc )
+  {
+    if ( success = doc->redo() )
+      doc->update();
+  }
+  return success;
+}
+
+/*!
+  \brief Called when user activates "Undo" menu action.
+  
+  Undo operation on the active document.
+
+  \param numActions undo depth (number of commands)
+  \return \c true on success
+*/
+bool CAF_Application::onUndo( int numActions )
+{
+  bool ok = true;
+  while ( numActions > 0 )
+  {
+    CAF_Study* cafStudy = dynamic_cast<CAF_Study*>( activeStudy() );
+    if ( cafStudy )
+    {
+      if ( !undo( cafStudy ) )
+      {
+       ok = false;
+       break;
+      }
+      numActions--;
+    }
+  }
+  updateCommandsStatus();     /* enable/disable undo/redo */
+  return ok;
+}
+
+/*!
+  \brief Called when user activates "Redo" menu action.
+  
+  Redo latest undo commands on the active document.
+
+  \param numActions redo depth (number of commands)
+  \return \c true on success
+*/
+bool CAF_Application::onRedo( int numActions )
+{
+  bool ok = true;
+  while ( numActions > 0 )
+  {
+    CAF_Study* cafStudy = dynamic_cast<CAF_Study*>( activeStudy() );
+    if ( cafStudy )
+    {
+      if ( !redo( cafStudy ) )
+      {
+       ok = false;
+       break;
+      }
+      numActions--;
+    }
+  }
+  updateCommandsStatus();     /* enable/disable undo/redo */
+  return ok;
+}
+
+/*!
+  \brief Update actions state (Undo/Redo).
+*/
+void CAF_Application::updateCommandsStatus()
+{
+  STD_Application::updateCommandsStatus();
+
+  CAF_Study* cafStudy = 0;
+  if ( activeStudy() && activeStudy()->inherits( "CAF_Study" ) )
+    cafStudy = (CAF_Study*)activeStudy();
+
+  QtxListAction* undo = qobject_cast<QtxListAction*>( action( EditUndoId ) );
+  if ( cafStudy && undo )
+    undo->addNames( cafStudy->undoNames() );
+
+  QtxListAction* redo = qobject_cast<QtxListAction*>( action( EditRedoId ) );
+  if ( cafStudy && redo )
+    redo->addNames( cafStudy->redoNames() );
+
+  if ( undo )
+    undo->setEnabled( cafStudy && cafStudy->canUndo() );
+  if ( redo )
+    redo->setEnabled( cafStudy && cafStudy->canRedo() );
+}
+
+/*!
+  \brief Called when user activatees Help->About main menu command.
+*/
+void CAF_Application::onHelpAbout()
+{
+  SUIT_MessageBox::information( desktop(), tr( "About" ), tr( "ABOUT_INFO" ) );
+}
+
+/*!
+  \brief Create new empty study.
+  \return new study
+*/
+SUIT_Study* CAF_Application::createNewStudy()
+{
+  return new CAF_Study( this );
+}
+
+/*!
+  \brief Set OCAF application.
+  \param app new OCAF application
+*/
+void CAF_Application::setStdApp( const Handle(TDocStd_Application)& app )
+{
+  myStdApp = app;
+}
diff --git a/src/CAF/CAF_Application.h b/src/CAF/CAF_Application.h
new file mode 100755 (executable)
index 0000000..1762939
--- /dev/null
@@ -0,0 +1,78 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 CAF_APPLICATION_H
+#define CAF_APPLICATION_H
+
+#include "CAF.h"
+
+#include "STD_Application.h"
+
+#include <TDocStd_Application.hxx>
+
+class CAF_Study;
+
+#if defined WIN32
+#pragma warning ( disable: 4251 )
+#endif
+
+class CAF_EXPORT CAF_Application : public STD_Application
+{
+  Q_OBJECT
+
+public:
+  CAF_Application();
+  CAF_Application( const Handle(TDocStd_Application)& );
+  virtual ~CAF_Application();
+
+  virtual QString             applicationName() const;
+
+  Handle(TDocStd_Application) stdApp() const;
+
+  virtual QString             getFileFilter() const;
+
+public slots:  
+  virtual void                onHelpAbout();
+
+protected slots:
+  virtual bool                onUndo( int );
+  virtual bool                onRedo( int );
+  
+protected:
+  enum {  EditUndoId = STD_Application::UserID, EditRedoId, UserID };
+
+protected:
+  virtual void                createActions();
+  virtual void                updateCommandsStatus();
+
+  virtual SUIT_Study*         createNewStudy();
+
+  bool                        undo( CAF_Study* doc );
+  bool                        redo( CAF_Study* doc );
+
+  virtual void                setStdApp( const Handle(TDocStd_Application)& );
+
+private:
+  Handle(TDocStd_Application) myStdApp;
+};
+
+#if defined WIN32
+#pragma warning ( default: 4251 )
+#endif
+
+#endif
diff --git a/src/CAF/CAF_Operation.cxx b/src/CAF/CAF_Operation.cxx
new file mode 100755 (executable)
index 0000000..0b9e3c7
--- /dev/null
@@ -0,0 +1,60 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 "CAF_Operation.h"
+
+#include "CAF_Study.h"
+#include "CAF_Application.h"
+
+#include <TDocStd_Document.hxx>
+
+/*!
+  \class CAF_Operation
+  \brief Base operation class for all operations used in CAF package.
+  
+  Operation interacts with OCC OCAF std document.
+*/
+
+/*!
+  \brief Constructor.
+  \param theApp application
+*/
+CAF_Operation::CAF_Operation(SUIT_Application* theApp)
+: SUIT_Operation(theApp)
+{
+}
+
+/*!
+  \brief Destructor.
+*/
+CAF_Operation::~CAF_Operation()
+{
+}
+
+/*!
+  \brief Get OCAF document.
+  \return handle to the OCAF document object
+*/
+Handle(TDocStd_Document) CAF_Operation::stdDoc() const
+{
+  Handle(TDocStd_Document) doc;
+  CAF_Study* s = qobject_cast<CAF_Study*>( study() );
+  if ( s )
+    doc = s->stdDoc();
+  return doc;
+}
diff --git a/src/CAF/CAF_Operation.h b/src/CAF/CAF_Operation.h
new file mode 100755 (executable)
index 0000000..15bd540
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 CAF_OPERATION_H
+#define CAF_OPERATION_H
+
+#include "CAF.h"
+
+#include "SUIT_Operation.h"
+
+#include <Standard.hxx>
+
+class CAF_Study;
+class Handle(TDocStd_Document);
+
+class CAF_EXPORT CAF_Operation : public SUIT_Operation
+{
+  Q_OBJECT
+
+public:
+  CAF_Operation( SUIT_Application* );
+  virtual ~CAF_Operation();
+
+protected:
+  Handle(TDocStd_Document) stdDoc() const;
+};
+
+#endif
diff --git a/src/CAF/CAF_Study.cxx b/src/CAF/CAF_Study.cxx
new file mode 100755 (executable)
index 0000000..95ac4cb
--- /dev/null
@@ -0,0 +1,483 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 "CAF_Study.h"
+
+#include "CAF_Tools.h"
+#include "CAF_Application.h"
+
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Application.h>
+
+#include <QDir>
+
+#include <TDF_Delta.hxx>
+#include <TDF_ListIteratorOfDeltaList.hxx>
+#include <TDocStd_Application.hxx>
+
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+/*!
+  \class CAF_Study
+  \brief Represents study for using in CAF module.
+
+  A study contains reference to OCAF std document and allows using OCAF services.
+  Provides necessary functionality for OCC transactions management.
+*/
+
+/*!
+  \brief Constructor.
+  \param theApp application
+*/
+CAF_Study::CAF_Study(SUIT_Application* theApp)
+: SUIT_Study( theApp ),
+  myModifiedCnt( 0 )
+{
+}
+
+/*!
+  \brief Constructor.
+  \param theApp application
+  \param aStdDoc OCAF document
+*/
+CAF_Study::CAF_Study(SUIT_Application* theApp, Handle (TDocStd_Document)& aStdDoc)
+: SUIT_Study( theApp ),
+  myStdDoc( aStdDoc ),
+  myModifiedCnt( 0 )
+{
+}
+
+/*!
+  \brief Destructor.
+*/
+CAF_Study::~CAF_Study()
+{
+}
+
+/*!
+  \brief Get OCAF document.
+  \return handle to the OCAF document object
+*/
+Handle(TDocStd_Document) CAF_Study::stdDoc() const
+{
+  return myStdDoc;
+}
+
+/*!
+  \brief Set OCAF document.
+  \param aStdDoc new OCAF document
+*/
+void CAF_Study::setStdDoc( Handle(TDocStd_Document)& aStdDoc )
+{
+  myStdDoc = aStdDoc;
+}
+
+/*!
+  \brief Customize document initialization.
+  \param doc study name
+  \return \c true on success and \c false on error
+*/
+bool CAF_Study::createDocument( const QString& doc )
+{
+  bool res = SUIT_Study::createDocument( doc );
+
+  CAF_Application* app = cafApplication();
+  if ( res && app && !app->stdApp().IsNull() )
+  {
+    try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+      OCC_CATCH_SIGNALS;
+#endif
+      TColStd_SequenceOfExtendedString formats;
+      app->stdApp()->Formats( formats );
+      if ( !formats.IsEmpty() )
+        app->stdApp()->NewDocument( formats.First(), myStdDoc );
+    }
+    catch ( Standard_Failure ) {
+      res = false;
+    }
+  }
+  return res;
+}
+
+/*!
+  \brief Close document.
+  \param permanently if \c true, a document is closed permanently
+*/
+void CAF_Study::closeDocument( bool permanently )
+{
+  Handle(TDocStd_Application) app = stdApp();
+  if ( !app.IsNull() && !stdDoc().IsNull() )
+    app->Close( stdDoc() );
+
+  SUIT_Study::closeDocument( permanently );
+}
+
+/*!
+  \brief Open document.
+  \param fname study file name
+  \return \c true on success and \c false if document cannot be opened
+*/
+bool CAF_Study::openDocument( const QString& fname )
+{
+  Handle(TDocStd_Application) app = stdApp();
+  if ( app.IsNull() )
+    return false;
+
+  bool status = false;
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    status = app->Open( CAF_Tools::toExtString( fname ), myStdDoc ) == CDF_RS_OK;
+  }
+  catch ( Standard_Failure ) {
+    status = false;
+  }
+
+  return status && SUIT_Study::openDocument( fname );
+}
+
+/*!
+  \brief Save document with other name.
+  \param fname study file name
+*/
+bool CAF_Study::saveDocumentAs( const QString& fname )
+{
+  Handle(TDocStd_Application) app = stdApp();
+  if ( app.IsNull() )
+    return false;
+
+  bool save = false;
+  if ( !stdDoc().IsNull() && stdDoc()->IsSaved() )
+  {
+    QString path = QDir::convertSeparators( CAF_Tools::toQString( stdDoc()->GetPath() ) );
+    save = path == QDir::convertSeparators( fname );
+  }
+
+  bool status = false;
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    if ( save )
+      status = app->Save( stdDoc() ) == CDF_SS_OK;
+    else
+    {
+      TCollection_ExtendedString format, path( CAF_Tools::toExtString( fname ) );
+      app->Format( path, format );
+
+      if ( format.Length() )
+        stdDoc()->ChangeStorageFormat( format );
+
+      status = app->SaveAs( stdDoc(), path ) == CDF_SS_OK;
+    }
+  }
+  catch ( Standard_Failure ) {
+    status = false;
+  }
+
+  if ( status )
+    status = SUIT_Study::saveDocumentAs( fname );
+
+  if ( status )
+    myModifiedCnt = 0;
+
+  return status;
+}
+
+/*!
+  \brief Open OCAF transaction.
+  \return \c true if transaction is opened successfully
+*/
+bool CAF_Study::openTransaction()
+{
+  if ( myStdDoc.IsNull() )
+    return false;
+
+  bool res = true;
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    if ( myStdDoc->HasOpenCommand() )
+      myStdDoc->AbortCommand();
+
+    myStdDoc->OpenCommand();
+  }
+  catch ( Standard_Failure ) {
+    res = false;
+  }
+
+  return res;
+}
+
+/*!
+  \brief Abort OCAF transaction.
+  \return \c true if transaction is aborted successfully
+*/
+bool CAF_Study::abortTransaction()
+{
+  if ( myStdDoc.IsNull() )
+    return false;
+
+  bool res = true;
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    myStdDoc->AbortCommand();
+    update();
+  }
+  catch ( Standard_Failure ) {
+    res = false;
+  }
+  return res;
+}
+
+/*!
+  \brief Commit OCAF transaction
+  \return \c true if transaction is committed successfully
+*/
+bool CAF_Study::commitTransaction( const QString& name )
+{
+  if ( myStdDoc.IsNull() )
+    return false;
+
+  bool res = true;
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    myStdDoc->CommitCommand();
+
+    if ( canUndo() )
+    {
+      Handle(TDF_Delta) d = myStdDoc->GetUndos().Last();
+      if ( !d.IsNull() )
+        d->SetName( CAF_Tools::toExtString( name ) );
+    }
+  }
+  catch ( Standard_Failure ) {
+    res = false;
+  }
+  return res;
+}
+
+/*!
+  \brief Check if there is any transaction opened.
+  \return \c true if there is opened OCAF transaction
+*/
+bool CAF_Study::hasTransaction() const
+{
+  if ( myStdDoc.IsNull() )
+    return false;
+
+  return myStdDoc->HasOpenCommand();
+}
+
+/*!
+  \brief Check if the study is saved.
+  \return \c true if the document has been saved to file
+*/
+bool CAF_Study::isSaved() const
+{
+  if ( myStdDoc.IsNull() )
+    return false;
+
+  return myStdDoc->IsSaved();
+}
+
+/*!
+  \brief Check if the study is modified.
+  \return \c true if the document has been modified
+*/
+bool CAF_Study::isModified() const
+{
+  if ( myStdDoc.IsNull() )
+    return false;
+
+//  return myStdDoc->IsModified();
+  return myModifiedCnt;
+}
+
+/*!
+  \brief Increment modifications count.
+
+  If \a undoable is \c true, this modification can be rolled back by
+  undoModified(), otherwise the document will be marked as \c modified
+  until it is saved.
+
+  \param undoable if \c true the operation is undoable
+  \sa undoModified(), clearModified()
+*/
+void CAF_Study::doModified( bool undoable )
+{
+  if ( myStdDoc.IsNull() )
+    return;
+
+  myModifiedCnt++;
+
+  /*  Assumed that number of available undos / redos is NOT changed dynamically */
+  if ( !undoable )
+    myModifiedCnt += myStdDoc->GetAvailableUndos();
+}
+
+/*!
+  \brief Decrement modifications count.
+  \sa doModified(), clearModified()
+*/
+void CAF_Study::undoModified()
+{
+  myModifiedCnt--;
+}
+
+/*!
+  \brief Clear modifications count.
+  \sa doModified(), undoModified()
+*/
+void CAF_Study::clearModified()
+{
+  myModifiedCnt = 0;
+}
+
+/*!
+  \brief Undo the last command.
+  \return \c true on success and \c false on error
+*/
+bool CAF_Study::undo()
+{
+  if ( myStdDoc.IsNull() )
+    return false;
+
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    myStdDoc->Undo();
+    undoModified();     /* decrement modification counter */
+  }
+  catch ( Standard_Failure ) {
+    SUIT_MessageBox::critical(application()->desktop(), tr( "ERR_ERROR" ),
+                             tr( "ERR_DOC_UNDO" ));
+    return false;
+  }
+  return true;
+}
+
+/*!
+  \brief Redo the last undo.
+  \return \c true on success and \c false on error
+*/
+bool CAF_Study::redo()
+{
+  if ( myStdDoc.IsNull() )
+    return false;
+
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    myStdDoc->Redo();
+    doModified();      /* increment modification counter */
+  }
+  catch ( Standard_Failure ) {
+    SUIT_MessageBox::critical( application()->desktop(), tr( "ERR_ERROR" ),
+                              tr( "ERR_DOC_REDO" ) );
+    return false;
+  }
+  return true;
+}
+
+/*!
+  \brief Check if it is possible to undo last command.
+  \return \c true if undo is avaiable
+*/
+bool CAF_Study::canUndo() const
+{
+  if ( myStdDoc.IsNull() )
+    return false;
+
+  return myStdDoc->GetAvailableUndos() > 0;
+}
+
+/*!
+  \brief Check if it is possible to redo last undo.
+  \return \c true if redo is avaiable
+*/
+bool CAF_Study::canRedo() const
+{
+  if ( myStdDoc.IsNull() )
+    return false;
+
+  return myStdDoc->GetAvailableRedos() > 0;
+}
+
+/*!
+  \brief Get names of available undo commands.
+  \return list of commands names
+*/
+QStringList CAF_Study::undoNames() const
+{
+  QStringList names;
+  if ( !myStdDoc.IsNull() )
+  {
+    for ( TDF_ListIteratorOfDeltaList it( myStdDoc->GetUndos() ); it.More(); it.Next() )
+      names.prepend( CAF_Tools::toQString( it.Value()->Name() ) );
+  }
+  return names;
+}
+
+/*!
+  \brief Get names of available redo commands.
+  \return list of commands names
+*/
+QStringList CAF_Study::redoNames() const
+{
+  QStringList names;
+  if ( !myStdDoc.IsNull() )
+  {
+    for ( TDF_ListIteratorOfDeltaList it( myStdDoc->GetRedos() ); it.More(); it.Next() )
+      names.append( CAF_Tools::toQString( it.Value()->Name() ) );
+  }
+  return names;
+}
+
+/*!
+  \brief Get OCAF application.
+  \return handle to the OCAF application object
+*/
+Handle(TDocStd_Application) CAF_Study::stdApp() const
+{
+  Handle(TDocStd_Application) stdApp;
+  CAF_Application* app = cafApplication();
+  if ( app )
+    stdApp = app->stdApp();
+  return stdApp;
+}
+
+/*!
+  \brief Get application.
+  \return application object (CAF_Application)
+*/
+CAF_Application* CAF_Study::cafApplication() const
+{
+  return qobject_cast<CAF_Application*>( application() );
+}
diff --git a/src/CAF/CAF_Study.h b/src/CAF/CAF_Study.h
new file mode 100755 (executable)
index 0000000..f56d7bd
--- /dev/null
@@ -0,0 +1,87 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 CAF_STUDY_H
+#define CAF_STUDY_H
+
+#include "CAF.h"
+
+#include "SUIT_Study.h"
+
+#include <TDocStd_Document.hxx>
+
+class CAF_Application;
+class Handle(TDocStd_Application);
+
+#if defined WIN32
+#pragma warning ( disable: 4251 )
+#endif
+
+class CAF_EXPORT CAF_Study : public SUIT_Study
+{
+  Q_OBJECT
+
+public:
+  CAF_Study( SUIT_Application* theApp );
+  CAF_Study( SUIT_Application* theApp, Handle(TDocStd_Document)& aStdDoc );
+  virtual ~CAF_Study();
+
+  virtual bool                createDocument( const QString& );
+  virtual void                closeDocument( bool = true );
+  virtual bool                openDocument( const QString& );
+
+  virtual bool                saveDocumentAs( const QString& );
+
+  bool                        isSaved() const;
+  bool                        isModified() const;
+  void                        doModified( bool = true );
+  void                        undoModified();
+  void                        clearModified();
+  
+  bool                        undo();
+  bool                        redo();
+  bool                        canUndo() const;
+  bool                        canRedo() const;
+  QStringList                 undoNames() const;
+  QStringList                 redoNames() const;
+  
+  Handle(TDocStd_Document)    stdDoc() const;
+
+protected:
+  Handle(TDocStd_Application) stdApp() const;
+  CAF_Application*            cafApplication() const;
+
+  virtual bool                openTransaction();
+  virtual bool                abortTransaction();
+  virtual bool                hasTransaction() const;
+  virtual bool                commitTransaction( const QString& = QString() );
+
+  virtual void                setStdDoc( Handle(TDocStd_Document)& );
+
+private:
+  Handle(TDocStd_Document)    myStdDoc;
+  int                         myModifiedCnt;
+
+  friend class CAF_Operation;
+};
+
+#if defined WIN32
+#pragma warning ( default: 4251 )
+#endif
+
+#endif
diff --git a/src/CAF/CAF_Tools.cxx b/src/CAF/CAF_Tools.cxx
new file mode 100755 (executable)
index 0000000..138fd37
--- /dev/null
@@ -0,0 +1,99 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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
+//
+//  File   : CAF_Tools.cxx
+//  Author : UI team
+
+#include "CAF_Tools.h"
+
+/*!
+  \class CAF_Tools
+  \brief Prodives a set of helpful static methods.
+*/
+
+/*!
+  \brief Convert TCollection_ExtendedString \a src to QString.
+  \param src string to be converted
+  \return resulting QString object
+*/
+QString CAF_Tools::toQString ( const TCollection_ExtendedString& src )
+{
+  return QString( (const QChar*)src.ToExtString(), src.Length() );
+}
+
+/*!
+  \brief Convert TCollection_AsciiString \a src to QString.
+  \param src string to be converted
+  \return resulting QString object
+*/
+QString CAF_Tools::toQString( const TCollection_AsciiString& src )
+{
+  return QString( src.ToCString() );
+}
+
+/*!
+  \brief Convert QString \a src to TCollection_AsciiString.
+  \param src string to be converted
+  \return resulting TCollection_AsciiString object
+*/
+TCollection_AsciiString CAF_Tools::toAsciiString( const QString& src )
+{
+  TCollection_AsciiString res;
+  if ( !src.isEmpty() )
+    res = TCollection_AsciiString( src.toLatin1().data() );
+  return res;
+}
+
+/*!
+  \brief Convert QString \a src to TCollection_ExtendedString.
+  \param src string to be converted
+  \return resulting TCollection_ExtendedString object
+*/
+TCollection_ExtendedString CAF_Tools::toExtString ( const QString& src )
+{
+  TCollection_ExtendedString result;
+  for ( int i = 0; i < (int)src.length(); i++ )
+    result.Insert( i + 1, src[ i ].unicode() );
+  return result;
+}
+
+/*!
+  \brief Convert QColor object to Quantity_Color object.
+  \param c color object in Qt format
+  \return color object in OCC format
+*/
+Quantity_Color CAF_Tools::color( const QColor& c )
+{
+  Quantity_Color aColor;
+  if ( c.isValid() )
+    aColor = Quantity_Color( c.red()   / 255., c.green() / 255.,
+                             c.blue()  / 255., Quantity_TOC_RGB );
+  return aColor;
+}
+
+/*!
+  \brief Convert Quantity_Color object to QColor object.
+  \param c color object in OCC format
+  \return color object in Qt format
+*/
+QColor CAF_Tools::color( const Quantity_Color& c )
+{
+  return QColor ( int( c.Red()   * 255 ),
+                  int( c.Green() * 255 ),
+                  int( c.Blue()  * 255 ) );
+}
diff --git a/src/CAF/CAF_Tools.h b/src/CAF/CAF_Tools.h
new file mode 100755 (executable)
index 0000000..4c0188b
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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
+//
+//  File   : CAF_Tools.h
+//  Author : UI team
+
+#ifndef CAF_TOOLS_H
+#define CAF_TOOLS_H
+
+#include <CAF.h>
+
+#include <SUIT_Tools.h>
+
+#include <QColor>
+
+#include <Quantity_Color.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+class CAF_EXPORT CAF_Tools : public SUIT_Tools
+{
+public:
+  static QString                    toQString( const TCollection_AsciiString& );
+  static QString                    toQString( const TCollection_ExtendedString& );
+
+  static TCollection_ExtendedString toExtString( const QString& );
+  static TCollection_AsciiString    toAsciiString( const QString& );
+
+  static Quantity_Color             color( const QColor& );
+  static QColor                     color( const Quantity_Color& );
+};
+
+#endif
diff --git a/src/CAF/resources/CAF_images.po b/src/CAF/resources/CAF_images.po
new file mode 100755 (executable)
index 0000000..083e775
--- /dev/null
@@ -0,0 +1,34 @@
+#  Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+#  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
+#
+# This is a Qt message file in .po format.  Each msgid starts with
+# a scope.  This scope should *NOT* be translated - eg. "Foo::Bar"
+# would be translated to "Pub", not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: example-Qt-message-extraction\n"
+"POT-Creation-Date: 1999-02-23 15:38+0200\n"
+"PO-Revision-Date: 1999-02-23 15:38+0200\n"
+"Last-Translator: \n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+msgid "ICON_APP_EDIT_UNDO"
+msgstr "undo.png"
+
+msgid "ICON_APP_EDIT_REDO"
+msgstr "redo.png"
diff --git a/src/CAF/resources/CAF_images.ts b/src/CAF/resources/CAF_images.ts
new file mode 100644 (file)
index 0000000..a24e1fc
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>@default</name>
+    <message>
+        <source>ICON_EDIT_REDO</source>
+        <translation>redo.png</translation>
+    </message>
+    <message>
+        <source>ICON_EDIT_UNDO</source>
+        <translation>undo.png</translation>
+    </message>
+</context>
+</TS>
diff --git a/src/CAF/resources/CAF_msg_en.po b/src/CAF/resources/CAF_msg_en.po
new file mode 100755 (executable)
index 0000000..de9372f
--- /dev/null
@@ -0,0 +1,67 @@
+#  Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+#  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
+#
+# This is a Qt message file in .po format.  Each msgid starts with
+# a scope.  This scope should *NOT* be translated - eg. "Foo::Bar"
+# would be translated to "Pub", not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: example-Qt-message-extraction\n"
+"POT-Creation-Date: 1999-02-23 15:38+0200\n"
+"PO-Revision-Date: 1999-02-23 15:38+0200\n"
+"Last-Translator: \n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+msgid "CAF_Application::ABOUT_INFO"
+msgstr "SUIT Caf application"
+
+msgid "CAF_Application::MEN_APP_EDIT"
+msgstr "&Edit"
+
+msgid "CAF_Application::MEN_DESK_EDIT"
+msgstr "&Edit"
+
+msgid "CAF_Application::MEN_APP_EDIT_REDO"
+msgstr "&Redo"
+
+msgid "CAF_Application::MEN_APP_EDIT_UNDO"
+msgstr "&Undo"
+
+msgid "CAF_Application::PRP_APP_EDIT_REDO"
+msgstr "Redoes the last operation"
+
+msgid "CAF_Application::PRP_APP_EDIT_UNDO"
+msgstr "Undoes the last operation"
+
+msgid "CAF_Application::TOT_APP_EDIT_REDO"
+msgstr "Redo"
+
+msgid "CAF_Application::TOT_APP_EDIT_UNDO"
+msgstr "Undo"
+
+msgid "CAF_Application::INF_APP_UNDOACTIONS"
+msgstr " Undoes %1 action(s) "
+
+msgid "CAF_Application::INF_APP_REDOACTIONS"
+msgstr " Redoes %1 action(s) "
+
+msgid "CAF_Application::INF_ALL_DOCUMENTS_FILTER"
+msgstr "All Readable Documents"
+
+msgid "CAF_Application::INF_ALL_FILTER"
+msgstr "All Files (*.*)"
diff --git a/src/CAF/resources/CAF_msg_en.ts b/src/CAF/resources/CAF_msg_en.ts
new file mode 100644 (file)
index 0000000..78fed09
--- /dev/null
@@ -0,0 +1,57 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>CAF_Application</name>
+    <message>
+        <source>MEN_APP_EDIT</source>
+        <translation>&amp;Edit</translation>
+    </message>
+    <message>
+        <source>INF_ALL_FILTER</source>
+        <translation>All Files (*.*)</translation>
+    </message>
+    <message>
+        <source>INF_ALL_DOCUMENTS_FILTER</source>
+        <translation>All Readable Documents</translation>
+    </message>
+    <message>
+        <source>MEN_DESK_EDIT</source>
+        <translation>&amp;Edit</translation>
+    </message>
+    <message>
+        <source>MEN_APP_EDIT_UNDO</source>
+        <translation>&amp;Undo</translation>
+    </message>
+    <message>
+        <source>MEN_APP_EDIT_REDO</source>
+        <translation>&amp;Redo</translation>
+    </message>
+    <message>
+        <source>PRP_APP_EDIT_REDO</source>
+        <translation>Redoes the last operation</translation>
+    </message>
+    <message>
+        <source>PRP_APP_EDIT_UNDO</source>
+        <translation>Undoes the last operation</translation>
+    </message>
+    <message>
+        <source>TOT_APP_EDIT_REDO</source>
+        <translation>Redo</translation>
+    </message>
+    <message>
+        <source>TOT_APP_EDIT_UNDO</source>
+        <translation>Undo</translation>
+    </message>
+    <message>
+        <source>INF_APP_REDOACTIONS</source>
+        <translation> Redoes %1 action(s) </translation>
+    </message>
+    <message>
+        <source>INF_APP_UNDOACTIONS</source>
+        <translation> Undoes %1 action(s) </translation>
+    </message>
+    <message>
+        <source>ABOUT_INFO</source>
+        <translation>SUIT Caf application</translation>
+    </message>
+</context>
+</TS>
diff --git a/src/LogWindow/resources/LogWindow_msg_en.ts b/src/LogWindow/resources/LogWindow_msg_en.ts
new file mode 100644 (file)
index 0000000..2e2aef5
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="1.1">
+<context>
+    <name>LogWindow</name>
+    <message>
+        <location filename="../LogWindow.cxx" line="293"/>
+        <source>EDIT_COPY_CMD</source>
+        <translation>&amp;Copy</translation>
+    </message>
+    <message>
+        <location filename="../LogWindow.cxx" line="298"/>
+        <source>EDIT_CLEAR_CMD</source>
+        <translation>Clea&amp;r</translation>
+    </message>
+    <message>
+        <location filename="../LogWindow.cxx" line="303"/>
+        <source>EDIT_SELECTALL_CMD</source>
+        <translation>Select &amp;All</translation>
+    </message>
+    <message>
+        <location filename="../LogWindow.cxx" line="308"/>
+        <source>EDIT_SAVETOFILE_CMD</source>
+        <translation>&amp;Save log to file...</translation>
+    </message>
+    <message>
+        <location filename="../LogWindow.cxx" line="368"/>
+        <source>ERR_ERROR</source>
+        <translation>Error</translation>
+    </message>
+    <message>
+        <location filename="../LogWindow.cxx" line="368"/>
+        <source>ERR_CANT_SAVE_FILE</source>
+        <translation>Can&apos;t save file</translation>
+    </message>
+    <message>
+        <location filename="../LogWindow.cxx" line="368"/>
+        <source>BUT_OK</source>
+        <translation>&amp;OK</translation>
+    </message>
+</context>
+</TS>
diff --git a/src/OBJECT/Handle_SALOME_AISObject.hxx b/src/OBJECT/Handle_SALOME_AISObject.hxx
new file mode 100755 (executable)
index 0000000..342cf62
--- /dev/null
@@ -0,0 +1,108 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : Handle_SALOME_AISObject.hxx
+//  Module : SALOME
+
+#ifndef _Handle_SALOME_AISObject_HeaderFile
+#define _Handle_SALOME_AISObject_HeaderFile
+
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+
+#ifndef _Handle_AIS_InteractiveObject_HeaderFile
+#include <Handle_AIS_InteractiveObject.hxx>
+#endif
+
+class Standard_Transient;
+class Handle_Standard_Type;
+/*!
+  \class Handle(AIS_InteractiveObject)
+  Smart pointer (handle) to AIS_InteractiveObject
+*/
+class Handle(AIS_InteractiveObject);
+class SALOME_AISObject;
+Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_AISObject);
+
+/*!
+  \class Handle(SALOME_AISObject)
+  Smart pointer (handle) to SALOME_AISObject
+*/
+class Handle(SALOME_AISObject) : public Handle(AIS_InteractiveObject) {
+  public:
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+    Handle(SALOME_AISObject)():Handle(AIS_InteractiveObject)() {} 
+    Handle(SALOME_AISObject)(const Handle(SALOME_AISObject)& aHandle) : Handle(AIS_InteractiveObject)(aHandle) 
+     {
+     }
+
+    Handle(SALOME_AISObject)(const SALOME_AISObject* anItem) : Handle(AIS_InteractiveObject)((AIS_InteractiveObject *)anItem) 
+     {
+     }
+
+    Handle(SALOME_AISObject)& operator=(const Handle(SALOME_AISObject)& aHandle)
+     {
+      Assign(aHandle.Access());
+      return *this;
+     }
+
+    Handle(SALOME_AISObject)& operator=(const SALOME_AISObject* anItem)
+     {
+      Assign((Standard_Transient *)anItem);
+      return *this;
+     }
+
+    SALOME_AISObject* operator->() 
+     {
+      return (SALOME_AISObject *)ControlAccess();
+     }
+
+    SALOME_AISObject* operator->() const 
+     {
+      return (SALOME_AISObject *)ControlAccess();
+     }
+
+   Standard_EXPORT ~Handle(SALOME_AISObject)();
+   Standard_EXPORT static const Handle(SALOME_AISObject) DownCast(const Handle(Standard_Transient)& AnObject);
+};
+#endif
diff --git a/src/OBJECT/Handle_SALOME_AISShape.hxx b/src/OBJECT/Handle_SALOME_AISShape.hxx
new file mode 100755 (executable)
index 0000000..b987b92
--- /dev/null
@@ -0,0 +1,108 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : Handle_SALOME_AISShape.hxx
+//  Module : SALOME
+
+#ifndef _Handle_SALOME_AISShape_HeaderFile
+#define _Handle_SALOME_AISShape_HeaderFile
+
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+
+#ifndef _Handle_AIS_Shape_HeaderFile
+#include <Handle_AIS_Shape.hxx>
+#endif
+
+class Standard_Transient;
+class Handle_Standard_Type;
+/*!
+  \class Handle(AIS_Shape)
+  Smart pointer (handle) to AIS_Shape
+*/
+class Handle(AIS_Shape);
+class SALOME_AISShape;
+Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_AISShape);
+
+/*!
+  \class Handle(SALOME_AISShape)
+  Smart pointer (handle) to SALOME_AISShape
+*/
+class Handle(SALOME_AISShape) : public Handle(AIS_Shape) {
+  public:
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+    Handle(SALOME_AISShape)():Handle(AIS_Shape)() {} 
+    Handle(SALOME_AISShape)(const Handle(SALOME_AISShape)& aHandle) : Handle(AIS_Shape)(aHandle) 
+     {
+     }
+
+    Handle(SALOME_AISShape)(const SALOME_AISShape* anItem) : Handle(AIS_Shape)((AIS_Shape *)anItem) 
+     {
+     }
+
+    Handle(SALOME_AISShape)& operator=(const Handle(SALOME_AISShape)& aHandle)
+     {
+      Assign(aHandle.Access());
+      return *this;
+     }
+
+    Handle(SALOME_AISShape)& operator=(const SALOME_AISShape* anItem)
+     {
+      Assign((Standard_Transient *)anItem);
+      return *this;
+     }
+
+    SALOME_AISShape* operator->() 
+     {
+      return (SALOME_AISShape *)ControlAccess();
+     }
+
+    SALOME_AISShape* operator->() const 
+     {
+      return (SALOME_AISShape *)ControlAccess();
+     }
+
+   Standard_EXPORT ~Handle(SALOME_AISShape)();
+   Standard_EXPORT static const Handle(SALOME_AISShape) DownCast(const Handle(Standard_Transient)& AnObject);
+};
+#endif
diff --git a/src/OBJECT/Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx b/src/OBJECT/Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx
new file mode 100644 (file)
index 0000000..b94e60d
--- /dev/null
@@ -0,0 +1,100 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx
+//  Module : SALOME
+
+#ifndef _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
+#define _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
+
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+
+#ifndef _Handle_TCollection_MapNode_HeaderFile
+#include <Handle_TCollection_MapNode.hxx>
+#endif
+
+class Standard_Transient;
+class Handle_Standard_Type;
+class Handle(TCollection_MapNode);
+class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger;
+Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger);
+
+class Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) : public Handle(TCollection_MapNode) {
+  public:
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+    Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)():Handle(TCollection_MapNode)() {} 
+    Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)(const Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)& aHandle) : Handle(TCollection_MapNode)(aHandle) 
+     {
+     }
+
+    Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)(const SALOME_DataMapNodeOfDataMapOfIOMapOfInteger* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) 
+     {
+     }
+
+    Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)& operator=(const Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)& aHandle)
+     {
+      Assign(aHandle.Access());
+      return *this;
+     }
+
+    Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)& operator=(const SALOME_DataMapNodeOfDataMapOfIOMapOfInteger* anItem)
+     {
+      Assign((Standard_Transient *)anItem);
+      return *this;
+     }
+
+    SALOME_DataMapNodeOfDataMapOfIOMapOfInteger* operator->() 
+     {
+      return (SALOME_DataMapNodeOfDataMapOfIOMapOfInteger *)ControlAccess();
+     }
+
+    SALOME_DataMapNodeOfDataMapOfIOMapOfInteger* operator->() const 
+     {
+      return (SALOME_DataMapNodeOfDataMapOfIOMapOfInteger *)ControlAccess();
+     }
+
+   Standard_EXPORT ~Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)();
+   Standard_EXPORT static const Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) DownCast(const Handle(Standard_Transient)& AnObject);
+};
+#endif
diff --git a/src/OBJECT/Handle_SALOME_Filter.hxx b/src/OBJECT/Handle_SALOME_Filter.hxx
new file mode 100644 (file)
index 0000000..8c22940
--- /dev/null
@@ -0,0 +1,108 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : Handle_SALOME_Filter.hxx
+//  Module : SALOME
+
+#ifndef _Handle_SALOME_Filter_HeaderFile
+#define _Handle_SALOME_Filter_HeaderFile
+
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+
+#ifndef _Handle_MMgt_TShared_HeaderFile
+#include <Handle_MMgt_TShared.hxx>
+#endif
+
+class Standard_Transient;
+class Handle_Standard_Type;
+/*!
+  \class Handle(MMgt_TShared)
+  Smart pointer (handle) to MMgt_TShared
+*/
+class Handle(MMgt_TShared);
+class SALOME_Filter;
+Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_Filter);
+
+/*!
+  \class Handle(SALOME_Filter)
+  Smart pointer (handle) to SALOME_Filter
+*/
+class Handle(SALOME_Filter) : public Handle(MMgt_TShared) {
+  public:
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+    Handle(SALOME_Filter)():Handle(MMgt_TShared)() {} 
+    Handle(SALOME_Filter)(const Handle(SALOME_Filter)& aHandle) : Handle(MMgt_TShared)(aHandle) 
+     {
+     }
+
+    Handle(SALOME_Filter)(const SALOME_Filter* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) 
+     {
+     }
+
+    Handle(SALOME_Filter)& operator=(const Handle(SALOME_Filter)& aHandle)
+     {
+      Assign(aHandle.Access());
+      return *this;
+     }
+
+    Handle(SALOME_Filter)& operator=(const SALOME_Filter* anItem)
+     {
+      Assign((Standard_Transient *)anItem);
+      return *this;
+     }
+
+    SALOME_Filter* operator->() 
+     {
+      return (SALOME_Filter *)ControlAccess();
+     }
+
+    SALOME_Filter* operator->() const 
+     {
+      return (SALOME_Filter *)ControlAccess();
+     }
+
+   Standard_EXPORT ~Handle(SALOME_Filter)();
+   Standard_EXPORT static const Handle(SALOME_Filter) DownCast(const Handle(Standard_Transient)& AnObject);
+};
+#endif
diff --git a/src/OBJECT/Handle_SALOME_InteractiveObject.hxx b/src/OBJECT/Handle_SALOME_InteractiveObject.hxx
new file mode 100755 (executable)
index 0000000..9bc3776
--- /dev/null
@@ -0,0 +1,104 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : Handle_SALOME_InteractiveObject.hxx
+//  Module : SALOME
+
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#define _Handle_SALOME_InteractiveObject_HeaderFile
+
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+
+#ifndef _Handle_MMgt_TShared_HeaderFile
+#include <Handle_MMgt_TShared.hxx>
+#endif
+
+class Standard_Transient;
+class Handle_Standard_Type;
+/*!
+  \class Handle(MMgt_TShared)
+  Smart pointer (handle) to MMgt_TShared
+*/
+class Handle(MMgt_TShared);
+class SALOME_InteractiveObject;
+Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_InteractiveObject);
+
+/*!
+  \class Handle(SALOME_InteractiveObject)
+  Smart pointer (handle) to SALOME_InteractiveObject
+*/
+class Handle(SALOME_InteractiveObject) : public Handle(MMgt_TShared) {
+  public:
+    void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+    Handle(SALOME_InteractiveObject)():Handle(MMgt_TShared)() {} 
+    Handle(SALOME_InteractiveObject)(const Handle(SALOME_InteractiveObject)& aHandle) : Handle(MMgt_TShared)(aHandle) 
+     {
+     }
+
+    Handle(SALOME_InteractiveObject)(const SALOME_InteractiveObject* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) 
+     {
+     }
+
+    Handle(SALOME_InteractiveObject)& operator=(const Handle(SALOME_InteractiveObject)& aHandle)
+     {
+      Assign(aHandle.Access());
+      return *this;
+     }
+
+    Handle(SALOME_InteractiveObject)& operator=(const SALOME_InteractiveObject* anItem)
+     {
+      Assign((Standard_Transient *)anItem);
+      return *this;
+     }
+
+    SALOME_InteractiveObject* operator->() 
+     {
+      return (SALOME_InteractiveObject *)ControlAccess();
+     }
+
+    SALOME_InteractiveObject* operator->() const 
+     {
+      return (SALOME_InteractiveObject *)ControlAccess();
+     }
+
+   Standard_EXPORT ~Handle(SALOME_InteractiveObject)();
+   Standard_EXPORT static const Handle(SALOME_InteractiveObject) DownCast(const Handle(Standard_Transient)& AnObject);
+};
+#endif
diff --git a/src/OBJECT/Handle_SALOME_ListNodeOfListIO.hxx b/src/OBJECT/Handle_SALOME_ListNodeOfListIO.hxx
new file mode 100644 (file)
index 0000000..e789954
--- /dev/null
@@ -0,0 +1,104 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : Handle_SALOME_ListNodeOfListIO.hxx
+//  Module : SALOME
+
+#ifndef _Handle_SALOME_ListNodeOfListIO_HeaderFile
+#define _Handle_SALOME_ListNodeOfListIO_HeaderFile
+
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+
+#ifndef _Handle_TCollection_MapNode_HeaderFile
+#include <Handle_TCollection_MapNode.hxx>
+#endif
+
+class Standard_Transient;
+class Handle_Standard_Type;
+/*!
+  \class Handle(TCollection_MapNode)
+  Smart pointer (handle) to TCollection_MapNode
+*/
+class Handle(TCollection_MapNode);
+class SALOME_ListNodeOfListIO;
+Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_ListNodeOfListIO);
+
+/*!
+  \class Handle(SALOME_ListNodeOfListIO)
+  Smart pointer (handle) to SALOME_ListNodeOfListIO
+*/
+class Handle(SALOME_ListNodeOfListIO) : public Handle(TCollection_MapNode) {
+  public:
+    void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+    Handle(SALOME_ListNodeOfListIO)():Handle(TCollection_MapNode)() {} 
+    Handle(SALOME_ListNodeOfListIO)(const Handle(SALOME_ListNodeOfListIO)& aHandle) : Handle(TCollection_MapNode)(aHandle) 
+     {
+     }
+
+    Handle(SALOME_ListNodeOfListIO)(const SALOME_ListNodeOfListIO* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) 
+     {
+     }
+
+    Handle(SALOME_ListNodeOfListIO)& operator=(const Handle(SALOME_ListNodeOfListIO)& aHandle)
+     {
+      Assign(aHandle.Access());
+      return *this;
+     }
+
+    Handle(SALOME_ListNodeOfListIO)& operator=(const SALOME_ListNodeOfListIO* anItem)
+     {
+      Assign((Standard_Transient *)anItem);
+      return *this;
+     }
+
+    SALOME_ListNodeOfListIO* operator->() 
+     {
+      return (SALOME_ListNodeOfListIO *)ControlAccess();
+     }
+
+    SALOME_ListNodeOfListIO* operator->() const 
+     {
+      return (SALOME_ListNodeOfListIO *)ControlAccess();
+     }
+
+   Standard_EXPORT ~Handle(SALOME_ListNodeOfListIO)();
+   Standard_EXPORT static const Handle(SALOME_ListNodeOfListIO) DownCast(const Handle(Standard_Transient)& AnObject);
+};
+#endif
diff --git a/src/OBJECT/Handle_SALOME_TypeFilter.hxx b/src/OBJECT/Handle_SALOME_TypeFilter.hxx
new file mode 100644 (file)
index 0000000..4ca800e
--- /dev/null
@@ -0,0 +1,108 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : Handle_SALOME_TypeFilter.hxx
+//  Module : SALOME
+
+#ifndef _Handle_SALOME_TypeFilter_HeaderFile
+#define _Handle_SALOME_TypeFilter_HeaderFile
+
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+
+#ifndef _Handle_SALOME_Filter_HeaderFile
+#include <Handle_SALOME_Filter.hxx>
+#endif
+
+class Standard_Transient;
+class Handle_Standard_Type;
+/*!
+  \class Handle(SALOME_Filter)
+  Smart pointer (handle) to SALOME_Filter
+*/
+class Handle(SALOME_Filter);
+class SALOME_TypeFilter;
+Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_TypeFilter);
+
+/*!
+  \class Handle(SALOME_TypeFilter)
+  Smart pointer (handle) to SALOME_TypeFilter
+*/
+class Handle(SALOME_TypeFilter) : public Handle(SALOME_Filter) {
+  public:
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+    Handle(SALOME_TypeFilter)():Handle(SALOME_Filter)() {} 
+    Handle(SALOME_TypeFilter)(const Handle(SALOME_TypeFilter)& aHandle) : Handle(SALOME_Filter)(aHandle) 
+     {
+     }
+
+    Handle(SALOME_TypeFilter)(const SALOME_TypeFilter* anItem) : Handle(SALOME_Filter)((SALOME_Filter *)anItem) 
+     {
+     }
+
+    Handle(SALOME_TypeFilter)& operator=(const Handle(SALOME_TypeFilter)& aHandle)
+     {
+      Assign(aHandle.Access());
+      return *this;
+     }
+
+    Handle(SALOME_TypeFilter)& operator=(const SALOME_TypeFilter* anItem)
+     {
+      Assign((Standard_Transient *)anItem);
+      return *this;
+     }
+
+    SALOME_TypeFilter* operator->() 
+     {
+      return (SALOME_TypeFilter *)ControlAccess();
+     }
+
+    SALOME_TypeFilter* operator->() const 
+     {
+      return (SALOME_TypeFilter *)ControlAccess();
+     }
+
+   Standard_EXPORT ~Handle(SALOME_TypeFilter)();
+   Standard_EXPORT static const Handle(SALOME_TypeFilter) DownCast(const Handle(Standard_Transient)& AnObject);
+};
+#endif
diff --git a/src/OBJECT/OBJECT.pro b/src/OBJECT/OBJECT.pro
new file mode 100644 (file)
index 0000000..308f148
--- /dev/null
@@ -0,0 +1,31 @@
+TEMPLATE = lib
+
+DESTDIR = ../../$(CONFIG_ID)/lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../$(CONFIG_ID)/obj/$$TARGET
+
+CASROOT = $$(CASROOT)
+CAS_CPPFLAGS = $${CASROOT}/inc
+
+CAS_LDPATH = -L$${CASROOT}/Linux/lib -lTKV3d
+
+INCLUDEPATH += ../../include $${CAS_CPPFLAGS}
+LIBS += $${CAS_LDPATH}
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32 
+DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
+
+HEADERS  = *.hxx
+HEADERS += *.h
+HEADERS += *.ixx
+HEADERS += *.jxx
+
+SOURCES  = *.cxx
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+INSTALLS += includes
diff --git a/src/OBJECT/SALOME_AISObject.cxx b/src/OBJECT/SALOME_AISObject.cxx
new file mode 100755 (executable)
index 0000000..c501849
--- /dev/null
@@ -0,0 +1,30 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_AISObject.hxx
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+//using namespace std;
+#include "SALOME_AISObject.ixx"
diff --git a/src/OBJECT/SALOME_AISObject.hxx b/src/OBJECT/SALOME_AISObject.hxx
new file mode 100755 (executable)
index 0000000..b89716f
--- /dev/null
@@ -0,0 +1,119 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_AISObject.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_AISObject_HeaderFile
+#define _SALOME_AISObject_HeaderFile
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Handle_SALOME_AISObject_HeaderFile
+#include <Handle_SALOME_AISObject.hxx>
+#endif
+
+#ifndef _AIS_InteractiveObject_HeaderFile
+#include <AIS_InteractiveObject.hxx>
+#endif
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include <Standard_Boolean.hxx>
+#endif
+#ifndef _Standard_CString_HeaderFile
+#include <Standard_CString.hxx>
+#endif
+class SALOME_InteractiveObject;
+
+
+class SALOME_AISObject : public AIS_InteractiveObject {
+
+public:
+
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+ // Methods PUBLIC
+ // 
+Standard_EXPORT virtual  Handle_SALOME_InteractiveObject getIO()  = 0;
+Standard_EXPORT virtual  Standard_Boolean hasIO()  = 0;
+Standard_EXPORT virtual  Standard_CString getName()  = 0;
+Standard_EXPORT virtual  void setName(const Standard_CString aName)  = 0;
+Standard_EXPORT ~SALOME_AISObject();
+
+
+
+
+ // Type management
+ //
+ Standard_EXPORT friend Handle_Standard_Type& SALOME_AISObject_Type_();
+ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+ Standard_EXPORT Standard_Boolean             IsKind(const Handle(Standard_Type)&) const;
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+
+
+private: 
+
+ // Methods PRIVATE
+ // 
+
+
+ // Fields PRIVATE
+ //
+
+
+};
+
+
+
+
+
+// other inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/OBJECT/SALOME_AISObject.ixx b/src/OBJECT/SALOME_AISObject.ixx
new file mode 100755 (executable)
index 0000000..11980b9
--- /dev/null
@@ -0,0 +1,87 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_AISObject.ixx
+//  Module : SALOME
+
+#include "SALOME_AISObject.jxx"
+
+#ifndef _Standard_TypeMismatch_HeaderFile
+#include <Standard_TypeMismatch.hxx>
+#endif
+
+SALOME_AISObject::~SALOME_AISObject() {}
+
+
+Standard_EXPORT Handle_Standard_Type& SALOME_AISObject_Type_()
+{
+
+    static Handle_Standard_Type aType1 = STANDARD_TYPE(AIS_InteractiveObject);
+  if ( aType1.IsNull()) aType1 = STANDARD_TYPE(AIS_InteractiveObject);
+  static Handle_Standard_Type aType2 = STANDARD_TYPE(SelectMgr_SelectableObject);
+  if ( aType2.IsNull()) aType2 = STANDARD_TYPE(SelectMgr_SelectableObject);
+  static Handle_Standard_Type aType3 = STANDARD_TYPE(PrsMgr_PresentableObject);
+  if ( aType3.IsNull()) aType3 = STANDARD_TYPE(PrsMgr_PresentableObject);
+  static Handle_Standard_Type aType4 = STANDARD_TYPE(MMgt_TShared);
+  if ( aType4.IsNull()) aType4 = STANDARD_TYPE(MMgt_TShared);
+  static Handle_Standard_Type aType5 = STANDARD_TYPE(Standard_Transient);
+  if ( aType5.IsNull()) aType5 = STANDARD_TYPE(Standard_Transient);
+
+  static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,NULL};
+  static Handle_Standard_Type _aType = new Standard_Type("SALOME_AISObject",
+                                                        sizeof(SALOME_AISObject),
+                                                        1,
+                                                        (Standard_Address)_Ancestors,
+                                                        (Standard_Address)NULL);
+
+  return _aType;
+}
+
+
+// DownCast method
+//   allow safe downcasting
+//
+const Handle(SALOME_AISObject) Handle(SALOME_AISObject)::DownCast(const Handle(Standard_Transient)& AnObject) 
+{
+  Handle(SALOME_AISObject) _anOtherObject;
+
+  if (!AnObject.IsNull()) {
+     if (AnObject->IsKind(STANDARD_TYPE(SALOME_AISObject))) {
+       _anOtherObject = Handle(SALOME_AISObject)((Handle(SALOME_AISObject)&)AnObject);
+     }
+  }
+
+  return _anOtherObject ;
+}
+const Handle(Standard_Type)& SALOME_AISObject::DynamicType() const 
+{ 
+  return STANDARD_TYPE(SALOME_AISObject) ; 
+}
+Standard_Boolean SALOME_AISObject::IsKind(const Handle(Standard_Type)& AType) const 
+{ 
+  return (STANDARD_TYPE(SALOME_AISObject) == AType || AIS_InteractiveObject::IsKind(AType)); 
+}
+Handle_SALOME_AISObject::~Handle_SALOME_AISObject() {}
+
diff --git a/src/OBJECT/SALOME_AISObject.jxx b/src/OBJECT/SALOME_AISObject.jxx
new file mode 100755 (executable)
index 0000000..95635ee
--- /dev/null
@@ -0,0 +1,32 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_AISObject.jxx
+//  Module : SALOME
+
+#ifndef _SALOME_InteractiveObject_HeaderFile
+#include "SALOME_InteractiveObject.hxx"
+#endif
+#ifndef _SALOME_AISObject_HeaderFile
+#include "SALOME_AISObject.hxx"
+#endif
diff --git a/src/OBJECT/SALOME_AISShape.cxx b/src/OBJECT/SALOME_AISShape.cxx
new file mode 100755 (executable)
index 0000000..52afc40
--- /dev/null
@@ -0,0 +1,40 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_AISShape.hxx
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+//using namespace std;
+#include "SALOME_AISShape.ixx"
+
+/*!
+  Constructor
+  \param shape - TopoDS shape 
+*/
+SALOME_AISShape::SALOME_AISShape(const TopoDS_Shape& shape)
+: AIS_Shape(shape)
+{
+}
+
diff --git a/src/OBJECT/SALOME_AISShape.hxx b/src/OBJECT/SALOME_AISShape.hxx
new file mode 100755 (executable)
index 0000000..4a8b87d
--- /dev/null
@@ -0,0 +1,122 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_AISShape.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_AISShape_HeaderFile
+#define _SALOME_AISShape_HeaderFile
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Handle_SALOME_AISShape_HeaderFile
+#include <Handle_SALOME_AISShape.hxx>
+#endif
+
+#ifndef _Standard_CString_HeaderFile
+#include <Standard_CString.hxx>
+#endif
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+#ifndef _AIS_Shape_HeaderFile
+#include <AIS_Shape.hxx>
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include <Standard_Boolean.hxx>
+#endif
+class SALOME_InteractiveObject;
+class TopoDS_Shape;
+class TColStd_IndexedMapOfInteger;
+
+
+class SALOME_AISShape : public AIS_Shape {
+
+public:
+
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+ // Methods PUBLIC
+ // 
+Standard_EXPORT SALOME_AISShape(const TopoDS_Shape& shape);
+Standard_EXPORT virtual  Handle_SALOME_InteractiveObject getIO() = 0;
+Standard_EXPORT virtual  Standard_Boolean hasIO() = 0;
+Standard_EXPORT virtual  Standard_CString getName() = 0;
+Standard_EXPORT virtual  void setName(const Standard_CString aName) = 0;
+Standard_EXPORT virtual  void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight ) = 0;
+Standard_EXPORT ~SALOME_AISShape();
+
+
+
+
+ // Type management
+ //
+ Standard_EXPORT friend Handle_Standard_Type& SALOME_AISShape_Type_();
+ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+ Standard_EXPORT Standard_Boolean             IsKind(const Handle(Standard_Type)&) const;
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+
+private: 
+
+ // Methods PRIVATE
+ // 
+
+
+ // Fields PRIVATE
+ //
+
+
+};
+
+
+
+
+
+// other inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/OBJECT/SALOME_AISShape.ixx b/src/OBJECT/SALOME_AISShape.ixx
new file mode 100755 (executable)
index 0000000..1190933
--- /dev/null
@@ -0,0 +1,89 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_AISShape.ixx
+//  Module : SALOME
+
+#include "SALOME_AISShape.jxx"
+
+#ifndef _Standard_TypeMismatch_HeaderFile
+#include <Standard_TypeMismatch.hxx>
+#endif
+
+SALOME_AISShape::~SALOME_AISShape() {}
+
+
+Standard_EXPORT Handle_Standard_Type& SALOME_AISShape_Type_()
+{
+
+    static Handle_Standard_Type aType1 = STANDARD_TYPE(AIS_Shape);
+  if ( aType1.IsNull()) aType1 = STANDARD_TYPE(AIS_Shape);
+  static Handle_Standard_Type aType2 = STANDARD_TYPE(AIS_InteractiveObject);
+  if ( aType2.IsNull()) aType2 = STANDARD_TYPE(AIS_InteractiveObject);
+  static Handle_Standard_Type aType3 = STANDARD_TYPE(SelectMgr_SelectableObject);
+  if ( aType3.IsNull()) aType3 = STANDARD_TYPE(SelectMgr_SelectableObject);
+  static Handle_Standard_Type aType4 = STANDARD_TYPE(PrsMgr_PresentableObject);
+  if ( aType4.IsNull()) aType4 = STANDARD_TYPE(PrsMgr_PresentableObject);
+  static Handle_Standard_Type aType5 = STANDARD_TYPE(MMgt_TShared);
+  if ( aType5.IsNull()) aType5 = STANDARD_TYPE(MMgt_TShared);
+  static Handle_Standard_Type aType6 = STANDARD_TYPE(Standard_Transient);
+  if ( aType6.IsNull()) aType6 = STANDARD_TYPE(Standard_Transient);
+
+  static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,aType6,NULL};
+  static Handle_Standard_Type _aType = new Standard_Type("SALOME_AISShape",
+                                                        sizeof(SALOME_AISShape),
+                                                        1,
+                                                        (Standard_Address)_Ancestors,
+                                                        (Standard_Address)NULL);
+
+  return _aType;
+}
+
+
+// DownCast method
+//   allow safe downcasting
+//
+const Handle(SALOME_AISShape) Handle(SALOME_AISShape)::DownCast(const Handle(Standard_Transient)& AnObject) 
+{
+  Handle(SALOME_AISShape) _anOtherObject;
+
+  if (!AnObject.IsNull()) {
+     if (AnObject->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
+       _anOtherObject = Handle(SALOME_AISShape)((Handle(SALOME_AISShape)&)AnObject);
+     }
+  }
+
+  return _anOtherObject ;
+}
+const Handle(Standard_Type)& SALOME_AISShape::DynamicType() const 
+{ 
+  return STANDARD_TYPE(SALOME_AISShape) ; 
+}
+Standard_Boolean SALOME_AISShape::IsKind(const Handle(Standard_Type)& AType) const 
+{ 
+  return (STANDARD_TYPE(SALOME_AISShape) == AType || AIS_Shape::IsKind(AType)); 
+}
+Handle_SALOME_AISShape::~Handle_SALOME_AISShape() {}
+
diff --git a/src/OBJECT/SALOME_AISShape.jxx b/src/OBJECT/SALOME_AISShape.jxx
new file mode 100755 (executable)
index 0000000..cae6c5f
--- /dev/null
@@ -0,0 +1,35 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_AISShape.jxx
+//  Module : SALOME
+
+#ifndef _SALOME_InteractiveObject_HeaderFile
+#include "SALOME_InteractiveObject.hxx"
+#endif
+#ifndef _TopoDS_Shape_HeaderFile
+#include <TopoDS_Shape.hxx>
+#endif
+#ifndef _SALOME_AISShape_HeaderFile
+#include "SALOME_AISShape.hxx"
+#endif
diff --git a/src/OBJECT/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx b/src/OBJECT/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx
new file mode 100644 (file)
index 0000000..34ebe62
--- /dev/null
@@ -0,0 +1,116 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_HeaderFile
+#define _SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_HeaderFile
+
+#ifndef _TCollection_BasicMapIterator_HeaderFile
+#include <TCollection_BasicMapIterator.hxx>
+#endif
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+#ifndef _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
+#include <Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx>
+#endif
+class Standard_NoSuchObject;
+class SALOME_InteractiveObject;
+class TColStd_IndexedMapOfInteger;
+class TColStd_MapTransientHasher;
+class SALOME_DataMapOfIOMapOfInteger;
+class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger;
+
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+
+class SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger  : public TCollection_BasicMapIterator {
+
+public:
+
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+ // Methods PUBLIC
+ // 
+Standard_EXPORT SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger();
+Standard_EXPORT SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger(const SALOME_DataMapOfIOMapOfInteger& aMap);
+Standard_EXPORT   void Initialize(const SALOME_DataMapOfIOMapOfInteger& aMap) ;
+Standard_EXPORT  const Handle_SALOME_InteractiveObject& Key() const;
+Standard_EXPORT  const TColStd_IndexedMapOfInteger& Value() const;
+
+
+
+
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+
+
+private: 
+
+ // Methods PRIVATE
+ // 
+
+
+ // Fields PRIVATE
+ //
+
+
+};
+
+
+
+
+
+// other inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/OBJECT/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_0.cxx b/src/OBJECT/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_0.cxx
new file mode 100644 (file)
index 0000000..f24caa3
--- /dev/null
@@ -0,0 +1,65 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_0.cxx
+//  Module : SALOME
+
+#include "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
+
+#ifndef _Standard_NoSuchObject_HeaderFile
+#include <Standard_NoSuchObject.hxx>
+#endif
+#ifndef _SALOME_InteractiveObject_HeaderFile
+#include "SALOME_InteractiveObject.hxx"
+#endif
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
+#endif
+#ifndef _TColStd_MapTransientHasher_HeaderFile
+#include <TColStd_MapTransientHasher.hxx>
+#endif
+#ifndef _SALOME_DataMapOfIOMapOfInteger_HeaderFile
+#include "SALOME_DataMapOfIOMapOfInteger.hxx"
+#endif
+#ifndef _SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
+#include "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
+#endif
+using namespace std;
+
+
+#define TheKey Handle_SALOME_InteractiveObject
+#define TheKey_hxx "SALOME_InteractiveObject.hxx"
+#define TheItem TColStd_IndexedMapOfInteger
+#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
+#define Hasher TColStd_MapTransientHasher
+#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
+#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapNode_hxx "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
+#define TCollection_DataMapIterator SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapIterator_hxx "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
+#define Handle_TCollection_DataMapNode Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapNode_Type_() SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
+#define TCollection_DataMap SALOME_DataMapOfIOMapOfInteger
+#define TCollection_DataMap_hxx "SALOME_DataMapOfIOMapOfInteger.hxx"
+#include <TCollection_DataMapIterator.gxx>
+
diff --git a/src/OBJECT/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx b/src/OBJECT/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx
new file mode 100644 (file)
index 0000000..3c100b0
--- /dev/null
@@ -0,0 +1,153 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
+#define _SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
+#include <Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx>
+#endif
+
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
+#endif
+#ifndef _TCollection_MapNode_HeaderFile
+#include <TCollection_MapNode.hxx>
+#endif
+#ifndef _TCollection_MapNodePtr_HeaderFile
+#include <TCollection_MapNodePtr.hxx>
+#endif
+class SALOME_InteractiveObject;
+class TColStd_IndexedMapOfInteger;
+class TColStd_MapTransientHasher;
+class SALOME_DataMapOfIOMapOfInteger;
+class SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger;
+
+
+class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger : public TCollection_MapNode {
+
+public:
+
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+ // Methods PUBLIC
+ // 
+Standard_EXPORT inline SALOME_DataMapNodeOfDataMapOfIOMapOfInteger(const Handle(SALOME_InteractiveObject)& K,const TColStd_IndexedMapOfInteger& I,const TCollection_MapNodePtr& n);
+Standard_EXPORT inline   Handle_SALOME_InteractiveObject& Key() const;
+Standard_EXPORT inline   TColStd_IndexedMapOfInteger& Value() const;
+Standard_EXPORT ~SALOME_DataMapNodeOfDataMapOfIOMapOfInteger();
+
+
+
+
+ // Type management
+ //
+ Standard_EXPORT friend Handle_Standard_Type& SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_();
+ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+ Standard_EXPORT Standard_Boolean             IsKind(const Handle(Standard_Type)&) const;
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+
+
+private: 
+
+ // Methods PRIVATE
+ // 
+
+
+ // Fields PRIVATE
+ //
+Handle_SALOME_InteractiveObject myKey;
+TColStd_IndexedMapOfInteger myValue;
+
+
+};
+
+#define TheKey Handle_SALOME_InteractiveObject
+#define TheKey_hxx "SALOME_InteractiveObject.hxx"
+#define TheItem TColStd_IndexedMapOfInteger
+#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
+#define Hasher TColStd_MapTransientHasher
+#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
+#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapNode_hxx "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
+#define TCollection_DataMapIterator SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapIterator_hxx "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
+#define Handle_TCollection_DataMapNode Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapNode_Type_() SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
+#define TCollection_DataMap SALOME_DataMapOfIOMapOfInteger
+#define TCollection_DataMap_hxx "SALOME_DataMapOfIOMapOfInteger.hxx"
+
+#include <TCollection_DataMapNode.lxx>
+
+#undef TheKey
+#undef TheKey_hxx
+#undef TheItem
+#undef TheItem_hxx
+#undef Hasher
+#undef Hasher_hxx
+#undef TCollection_DataMapNode
+#undef TCollection_DataMapNode_hxx
+#undef TCollection_DataMapIterator
+#undef TCollection_DataMapIterator_hxx
+#undef Handle_TCollection_DataMapNode
+#undef TCollection_DataMapNode_Type_
+#undef TCollection_DataMap
+#undef TCollection_DataMap_hxx
+
+
+// other inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/OBJECT/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_0.cxx b/src/OBJECT/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_0.cxx
new file mode 100644 (file)
index 0000000..b1a4c95
--- /dev/null
@@ -0,0 +1,133 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_0.cxx
+//  Module : SALOME
+
+#include "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
+
+#ifndef _Standard_TypeMismatch_HeaderFile
+#include <Standard_TypeMismatch.hxx>
+#endif
+
+#ifndef _SALOME_InteractiveObject_HeaderFile
+#include "SALOME_InteractiveObject.hxx"
+#endif
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
+#endif
+#ifndef _TColStd_MapTransientHasher_HeaderFile
+#include <TColStd_MapTransientHasher.hxx>
+#endif
+#ifndef _SALOME_DataMapOfIOMapOfInteger_HeaderFile
+#include "SALOME_DataMapOfIOMapOfInteger.hxx"
+#endif
+#ifndef _SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_HeaderFile
+#include "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
+#endif
+using namespace std;
+
+/*!
+  Destructor
+*/
+SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::~SALOME_DataMapNodeOfDataMapOfIOMapOfInteger() {}
+
+
+/*!
+  \return OCC Handle Type
+*/
+Standard_EXPORT Handle_Standard_Type& SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
+{
+
+    static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode);
+  if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode);
+  static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
+  if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
+  static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
+  if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
+
+  static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
+  static Handle_Standard_Type _aType = new Standard_Type("SALOME_DataMapNodeOfDataMapOfIOMapOfInteger",
+                                                        sizeof(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger),
+                                                        1,
+                                                        (Standard_Address)_Ancestors,
+                                                        (Standard_Address)NULL);
+
+  return _aType;
+}
+
+
+/*!
+  DownCast method: allows safe downcasting
+*/
+const Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)::DownCast(const Handle(Standard_Transient)& AnObject) 
+{
+  Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) _anOtherObject;
+
+  if (!AnObject.IsNull()) {
+     if (AnObject->IsKind(STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger))) {
+       _anOtherObject = Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)((Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)&)AnObject);
+     }
+  }
+
+  return _anOtherObject ;
+}
+
+/*!
+  \return OCC Handle dynamic Type
+*/
+const Handle(Standard_Type)& SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::DynamicType() const 
+{ 
+  return STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) ; 
+}
+
+/*!
+  \return true if other type is the same
+  \param AType - type to be checked
+*/
+Standard_Boolean SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::IsKind(const Handle(Standard_Type)& AType) const 
+{ 
+  return (STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) == AType || TCollection_MapNode::IsKind(AType)); 
+}
+/*!
+  Destructor
+*/
+Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::~Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger() {}
+#define TheKey Handle_SALOME_InteractiveObject
+#define TheKey_hxx "SALOME_InteractiveObject.hxx"
+#define TheItem TColStd_IndexedMapOfInteger
+#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
+#define Hasher TColStd_MapTransientHasher
+#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
+#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapNode_hxx "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
+#define TCollection_DataMapIterator SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapIterator_hxx "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
+#define Handle_TCollection_DataMapNode Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapNode_Type_() SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
+#define TCollection_DataMap SALOME_DataMapOfIOMapOfInteger
+#define TCollection_DataMap_hxx "SALOME_DataMapOfIOMapOfInteger.hxx"
+#include <TCollection_DataMapNode.gxx>
+
diff --git a/src/OBJECT/SALOME_DataMapOfIOMapOfInteger.hxx b/src/OBJECT/SALOME_DataMapOfIOMapOfInteger.hxx
new file mode 100644 (file)
index 0000000..f3aa034
--- /dev/null
@@ -0,0 +1,148 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_DataMapOfIOMapOfInteger.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_DataMapOfIOMapOfInteger_HeaderFile
+#define _SALOME_DataMapOfIOMapOfInteger_HeaderFile
+
+#ifndef _TCollection_BasicMap_HeaderFile
+#include <TCollection_BasicMap.hxx>
+#endif
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+#ifndef _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
+#include <Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx>
+#endif
+#ifndef _Standard_Integer_HeaderFile
+#include <Standard_Integer.hxx>
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include <Standard_Boolean.hxx>
+#endif
+class Standard_DomainError;
+class Standard_NoSuchObject;
+class SALOME_InteractiveObject;
+class TColStd_IndexedMapOfInteger;
+class TColStd_MapTransientHasher;
+class SALOME_DataMapNodeOfDataMapOfIOMapOfInteger;
+class SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger;
+
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+
+class SALOME_DataMapOfIOMapOfInteger  : public TCollection_BasicMap {
+
+public:
+
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+ // Methods PUBLIC
+ // 
+Standard_EXPORT SALOME_DataMapOfIOMapOfInteger(const Standard_Integer NbBuckets = 1);
+Standard_EXPORT   SALOME_DataMapOfIOMapOfInteger& Assign(const SALOME_DataMapOfIOMapOfInteger& Other) ;
+  SALOME_DataMapOfIOMapOfInteger& operator =(const SALOME_DataMapOfIOMapOfInteger& Other) 
+{
+  return Assign(Other);
+}
+
+Standard_EXPORT   void ReSize(const Standard_Integer NbBuckets) ;
+Standard_EXPORT   void Clear() ;
+~SALOME_DataMapOfIOMapOfInteger()
+{
+  Clear();
+}
+
+Standard_EXPORT   Standard_Boolean Bind(const Handle(SALOME_InteractiveObject)& K,const TColStd_IndexedMapOfInteger& I) ;
+Standard_EXPORT   Standard_Boolean IsBound(const Handle(SALOME_InteractiveObject)& K) const;
+Standard_EXPORT   Standard_Boolean UnBind(const Handle(SALOME_InteractiveObject)& K) ;
+Standard_EXPORT  const TColStd_IndexedMapOfInteger& Find(const Handle(SALOME_InteractiveObject)& K) const;
+ const TColStd_IndexedMapOfInteger& operator()(const Handle(SALOME_InteractiveObject)& K) const
+{
+  return Find(K);
+}
+
+Standard_EXPORT   TColStd_IndexedMapOfInteger& ChangeFind(const Handle(SALOME_InteractiveObject)& K) ;
+  TColStd_IndexedMapOfInteger& operator()(const Handle(SALOME_InteractiveObject)& K) 
+{
+  return ChangeFind(K);
+}
+
+
+
+
+
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+
+
+private: 
+
+ // Methods PRIVATE
+ // 
+Standard_EXPORT SALOME_DataMapOfIOMapOfInteger(const SALOME_DataMapOfIOMapOfInteger& Other);
+
+
+ // Fields PRIVATE
+ //
+
+
+};
+
+
+
+
+
+// other inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/OBJECT/SALOME_DataMapOfIOMapOfInteger_0.cxx b/src/OBJECT/SALOME_DataMapOfIOMapOfInteger_0.cxx
new file mode 100644 (file)
index 0000000..bf8f767
--- /dev/null
@@ -0,0 +1,68 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_DataMapOfIOMapOfInteger_0.cxx
+//  Module : SALOME
+
+#include "SALOME_DataMapOfIOMapOfInteger.hxx"
+
+#ifndef _Standard_DomainError_HeaderFile
+#include <Standard_DomainError.hxx>
+#endif
+#ifndef _Standard_NoSuchObject_HeaderFile
+#include <Standard_NoSuchObject.hxx>
+#endif
+#ifndef _SALOME_InteractiveObject_HeaderFile
+#include "SALOME_InteractiveObject.hxx"
+#endif
+#ifndef _TColStd_IndexedMapOfInteger_HeaderFile
+#include <TColStd_IndexedMapOfInteger.hxx>
+#endif
+#ifndef _TColStd_MapTransientHasher_HeaderFile
+#include <TColStd_MapTransientHasher.hxx>
+#endif
+#ifndef _SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile
+#include "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
+#endif
+#ifndef _SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger_HeaderFile
+#include "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
+#endif
+using namespace std;
+
+
+#define TheKey Handle_SALOME_InteractiveObject
+#define TheKey_hxx "SALOME_InteractiveObject.hxx"
+#define TheItem TColStd_IndexedMapOfInteger
+#define TheItem_hxx <TColStd_IndexedMapOfInteger.hxx>
+#define Hasher TColStd_MapTransientHasher
+#define Hasher_hxx <TColStd_MapTransientHasher.hxx>
+#define TCollection_DataMapNode SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapNode_hxx "SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx"
+#define TCollection_DataMapIterator SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapIterator_hxx "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
+#define Handle_TCollection_DataMapNode Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger
+#define TCollection_DataMapNode_Type_() SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
+#define TCollection_DataMap SALOME_DataMapOfIOMapOfInteger
+#define TCollection_DataMap_hxx "SALOME_DataMapOfIOMapOfInteger.hxx"
+#include <TCollection_DataMap.gxx>
+
diff --git a/src/OBJECT/SALOME_Filter.cxx b/src/OBJECT/SALOME_Filter.cxx
new file mode 100644 (file)
index 0000000..79ba216
--- /dev/null
@@ -0,0 +1,31 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_Filter.cxx
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+#include "SALOME_Filter.ixx"
+using namespace std;
+
diff --git a/src/OBJECT/SALOME_Filter.hxx b/src/OBJECT/SALOME_Filter.hxx
new file mode 100644 (file)
index 0000000..4386503
--- /dev/null
@@ -0,0 +1,111 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_Filter.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_Filter_HeaderFile
+#define _SALOME_Filter_HeaderFile
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Handle_SALOME_Filter_HeaderFile
+#include <Handle_SALOME_Filter.hxx>
+#endif
+
+#ifndef _MMgt_TShared_HeaderFile
+#include <MMgt_TShared.hxx>
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include <Standard_Boolean.hxx>
+#endif
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+
+class SALOME_Filter : public MMgt_TShared {
+
+public:
+
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+ // Methods PUBLIC
+ // 
+Standard_EXPORT virtual  Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anObj) const = 0;
+Standard_EXPORT ~SALOME_Filter();
+
+
+
+
+ // Type management
+ //
+ Standard_EXPORT friend Handle_Standard_Type& SALOME_Filter_Type_();
+ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+ Standard_EXPORT Standard_Boolean            IsKind(const Handle(Standard_Type)&) const;
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+
+
+private: 
+
+ // Methods PRIVATE
+ // 
+
+
+ // Fields PRIVATE
+ //
+
+
+};
+
+
+
+
+
+// other inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/OBJECT/SALOME_Filter.ixx b/src/OBJECT/SALOME_Filter.ixx
new file mode 100644 (file)
index 0000000..c872cef
--- /dev/null
@@ -0,0 +1,81 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_Filter.ixx
+//  Module : SALOME
+
+#include "SALOME_Filter.jxx"
+
+#ifndef _Standard_TypeMismatch_HeaderFile
+#include <Standard_TypeMismatch.hxx>
+#endif
+
+SALOME_Filter::~SALOME_Filter() {}
+
+
+Standard_EXPORT Handle_Standard_Type& SALOME_Filter_Type_()
+{
+
+    static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
+  if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
+  static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
+  if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
+
+  static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
+  static Handle_Standard_Type _aType = new Standard_Type("SALOME_Filter",
+                                                        sizeof(SALOME_Filter),
+                                                        1,
+                                                        (Standard_Address)_Ancestors,
+                                                        (Standard_Address)NULL);
+
+  return _aType;
+}
+
+
+// DownCast method
+//   allow safe downcasting
+//
+const Handle(SALOME_Filter) Handle(SALOME_Filter)::DownCast(const Handle(Standard_Transient)& AnObject) 
+{
+  Handle(SALOME_Filter) _anOtherObject;
+
+  if (!AnObject.IsNull()) {
+     if (AnObject->IsKind(STANDARD_TYPE(SALOME_Filter))) {
+       _anOtherObject = Handle(SALOME_Filter)((Handle(SALOME_Filter)&)AnObject);
+     }
+  }
+
+  return _anOtherObject ;
+}
+const Handle(Standard_Type)& SALOME_Filter::DynamicType() const 
+{ 
+  return STANDARD_TYPE(SALOME_Filter) ; 
+}
+Standard_Boolean SALOME_Filter::IsKind(const Handle(Standard_Type)& AType) const 
+{ 
+  return (STANDARD_TYPE(SALOME_Filter) == AType || MMgt_TShared::IsKind(AType)); 
+}
+Handle_SALOME_Filter::~Handle_SALOME_Filter() {}
+
diff --git a/src/OBJECT/SALOME_Filter.jxx b/src/OBJECT/SALOME_Filter.jxx
new file mode 100644 (file)
index 0000000..db8562e
--- /dev/null
@@ -0,0 +1,29 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_Filter.jxx
+//  Module : SALOME
+
+#ifndef _SALOME_Filter_HeaderFile
+#include "SALOME_Filter.hxx"
+#endif
diff --git a/src/OBJECT/SALOME_InteractiveObject.cxx b/src/OBJECT/SALOME_InteractiveObject.cxx
new file mode 100755 (executable)
index 0000000..53d93c0
--- /dev/null
@@ -0,0 +1,162 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_InteractiveObject.cxx
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+//using namespace std;
+/*!
+  \class SALOME_InteractiveObject SALOME_InteractiveObject.hxx
+  \brief ...
+*/
+
+#include "SALOME_InteractiveObject.ixx"
+
+/*!
+  Default constructor
+*/
+SALOME_InteractiveObject::SALOME_InteractiveObject()
+{
+  myEntry = "";
+  myName  = "";
+  myComponentDataType = "";
+  myReference = "";
+}
+
+/*!
+  Constructor
+  \param anEntry - entry of object
+  \param aComponentDataType - component data type name
+  \param aName - name of object
+*/
+SALOME_InteractiveObject::SALOME_InteractiveObject(const char* anEntry, 
+                                                  const char* aComponentDataType,
+                                                  const char* aName):
+  myEntry(anEntry), 
+  myName(aName), 
+  myComponentDataType(aComponentDataType), 
+  myReference("")
+{}
+
+/*!
+  Sets entry
+  \param anEntry - new entry of object
+*/
+void SALOME_InteractiveObject::setEntry(const char* anEntry){
+  myEntry = anEntry;
+}
+
+/*!
+  \return entry
+*/
+const char* SALOME_InteractiveObject::getEntry(){
+  return myEntry.c_str();
+}
+
+/*!
+  Sets component data type
+  \param aComponentDataType - component data type name
+*/
+void SALOME_InteractiveObject::setComponentDataType(const char* aComponentDataType){
+  myComponentDataType = aComponentDataType; 
+}
+
+/*!
+  \return component data type
+*/
+const char* SALOME_InteractiveObject::getComponentDataType(){
+  return myComponentDataType.c_str();
+}
+
+/*!
+  Sets name
+  \param aName - new name of object
+*/
+void SALOME_InteractiveObject::setName(const char* aName){
+  myName = aName;
+}
+
+/*!
+  \return name
+*/
+const char* SALOME_InteractiveObject::getName(){
+  return myName.c_str();
+}
+
+/*!
+  \return true if entry isn't empty
+*/
+Standard_Boolean SALOME_InteractiveObject::hasEntry(){
+  return myEntry != "";
+}
+
+/*!
+  \return true if objects have same entries
+  \param anIO - other object
+*/
+Standard_Boolean SALOME_InteractiveObject::isSame(const Handle(SALOME_InteractiveObject)& anIO ){
+  if ( anIO->hasEntry() && this->hasEntry() ) {
+    if ( myEntry == anIO->getEntry() )
+      return Standard_True;
+  }
+  
+  return Standard_False;
+}
+
+/*!
+  \return true if component data types are same
+  \param ComponentDataType - component data type to be checked
+*/
+Standard_Boolean SALOME_InteractiveObject::isComponentType(const char* ComponentDataType){
+  if ( myComponentDataType == ComponentDataType )
+    return Standard_True;
+  else
+    return Standard_False;
+}
+
+/*!
+  \return true if object has reference
+*/
+Standard_Boolean SALOME_InteractiveObject::hasReference()
+{
+  return myReference != "";
+}
+
+/*!
+  \return reference
+*/
+const char* SALOME_InteractiveObject::getReference()
+{
+  return myReference.c_str();
+}
+
+/*!
+  Sets reference
+  \param aReference - new reference
+*/
+void SALOME_InteractiveObject::setReference(const char* aReference)
+{
+  myReference = aReference;
+}
diff --git a/src/OBJECT/SALOME_InteractiveObject.hxx b/src/OBJECT/SALOME_InteractiveObject.hxx
new file mode 100755 (executable)
index 0000000..712d96d
--- /dev/null
@@ -0,0 +1,136 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_InteractiveObject.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_InteractiveObject_HeaderFile
+#define _SALOME_InteractiveObject_HeaderFile
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+
+#ifndef _Standard_CString_HeaderFile
+#include <Standard_CString.hxx>
+#endif
+#ifndef _MMgt_TShared_HeaderFile
+#include <MMgt_TShared.hxx>
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include <Standard_Boolean.hxx>
+#endif
+
+#include <string>
+
+class SALOME_InteractiveObject : public MMgt_TShared {
+
+public:
+
+    void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+ // Methods PUBLIC
+ // 
+Standard_EXPORT   SALOME_InteractiveObject();
+Standard_EXPORT   SALOME_InteractiveObject(const char* anEntry, 
+                                          const char* aComponentDataType,
+                                          const char* aName = "");
+Standard_EXPORT   void setEntry(const char* anEntry) ;
+Standard_EXPORT   const char* getEntry() ;
+Standard_EXPORT   void setName(const char* aName) ;
+Standard_EXPORT   const char* getName() ;
+Standard_EXPORT   Standard_Boolean hasEntry() ;
+Standard_EXPORT   virtual  Standard_Boolean isSame(const Handle(SALOME_InteractiveObject)& anIO) ;
+
+Standard_EXPORT   Standard_Boolean hasReference() ;
+Standard_EXPORT   const char* getReference() ;
+Standard_EXPORT   void setReference(const char* aReference) ;
+
+Standard_EXPORT   void setComponentDataType(const char* ComponentDataType) ;
+Standard_EXPORT   const char* getComponentDataType() ;
+Standard_EXPORT   Standard_Boolean isComponentType(const char* ComponentDataType) ; 
+  //Standard_EXPORT   Standard_Boolean isComponentType(std::string  ComponentDataType) ; 
+Standard_EXPORT   virtual ~SALOME_InteractiveObject();
+
+// Must be defined for using by NCollection for ceratin of data map
+friend Standard_Boolean IsEqual(const Handle(SALOME_InteractiveObject)& anIO1,
+                                const Handle(SALOME_InteractiveObject)& anIO2)
+{ return anIO1->isSame( anIO2 ); }
+
+
+
+
+
+ // Type management
+ //
+ Standard_EXPORT friend Handle_Standard_Type& SALOME_InteractiveObject_Type_();
+ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+ Standard_EXPORT Standard_Boolean             IsKind(const Handle(Standard_Type)&) const;
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+  std::string myReference;
+  std::string myEntry;
+  std::string myName;
+  std::string myComponentDataType;
+
+private: 
+
+ // Methods PRIVATE
+ // 
+
+
+ // Fields PRIVATE
+ //
+
+
+};
+
+
+
+
+
+// other Inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/OBJECT/SALOME_InteractiveObject.ixx b/src/OBJECT/SALOME_InteractiveObject.ixx
new file mode 100755 (executable)
index 0000000..ef92c07
--- /dev/null
@@ -0,0 +1,81 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_InteractiveObject.ixx
+//  Module : SALOME
+
+#include "SALOME_InteractiveObject.jxx"
+
+#ifndef _Standard_TypeMismatch_HeaderFile
+#include <Standard_TypeMismatch.hxx>
+#endif
+
+SALOME_InteractiveObject::~SALOME_InteractiveObject() {}
+
+
+Standard_EXPORT Handle_Standard_Type& SALOME_InteractiveObject_Type_()
+{
+
+    static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
+  if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
+  static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
+  if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
+
+  static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
+  static Handle_Standard_Type _aType = new Standard_Type("SALOME_InteractiveObject",
+                                                        sizeof(SALOME_InteractiveObject),
+                                                        1,
+                                                        (Standard_Address)_Ancestors,
+                                                        (Standard_Address)NULL);
+
+  return _aType;
+}
+
+
+// DownCast method
+//   allow safe downcasting
+//
+const Handle(SALOME_InteractiveObject) Handle(SALOME_InteractiveObject)::DownCast(const Handle(Standard_Transient)& AnObject) 
+{
+  Handle(SALOME_InteractiveObject) _anOtherObject;
+
+  if (!AnObject.IsNull()) {
+     if (AnObject->IsKind(STANDARD_TYPE(SALOME_InteractiveObject))) {
+       _anOtherObject = Handle(SALOME_InteractiveObject)((Handle(SALOME_InteractiveObject)&)AnObject);
+     }
+  }
+
+  return _anOtherObject ;
+}
+const Handle(Standard_Type)& SALOME_InteractiveObject::DynamicType() const 
+{ 
+  return STANDARD_TYPE(SALOME_InteractiveObject) ; 
+}
+Standard_Boolean SALOME_InteractiveObject::IsKind(const Handle(Standard_Type)& AType) const 
+{ 
+  return (STANDARD_TYPE(SALOME_InteractiveObject) == AType || MMgt_TShared::IsKind(AType)); 
+}
+Handle_SALOME_InteractiveObject::~Handle_SALOME_InteractiveObject() {}
+
diff --git a/src/OBJECT/SALOME_InteractiveObject.jxx b/src/OBJECT/SALOME_InteractiveObject.jxx
new file mode 100755 (executable)
index 0000000..0c3fc7d
--- /dev/null
@@ -0,0 +1,29 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_InteractiveObject.jxx
+//  Module : SALOME
+
+#ifndef _SALOME_InteractiveObject_HeaderFile
+#include "SALOME_InteractiveObject.hxx"
+#endif
diff --git a/src/OBJECT/SALOME_ListIO.hxx b/src/OBJECT/SALOME_ListIO.hxx
new file mode 100644 (file)
index 0000000..7f52828
--- /dev/null
@@ -0,0 +1,169 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_ListIO.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_ListIO_HeaderFile
+#define _SALOME_ListIO_HeaderFile
+
+#ifndef _Standard_Address_HeaderFile
+#include <Standard_Address.hxx>
+#endif
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+#ifndef _Handle_SALOME_ListNodeOfListIO_HeaderFile
+#include <Handle_SALOME_ListNodeOfListIO.hxx>
+#endif
+#ifndef _Standard_Integer_HeaderFile
+#include <Standard_Integer.hxx>
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include <Standard_Boolean.hxx>
+#endif
+class Standard_NoSuchObject;
+class SALOME_ListIteratorOfListIO;
+class SALOME_InteractiveObject;
+class SALOME_ListNodeOfListIO;
+
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+
+/*!
+  \class SALOME_ListIO
+  List of SALOME interactive objects
+*/
+class SALOME_ListIO  {
+
+public:
+
+    void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+ // Methods PUBLIC
+ // 
+Standard_EXPORT SALOME_ListIO();
+Standard_EXPORT   void Assign(const SALOME_ListIO& Other) ;
+  void operator=(const SALOME_ListIO& Other) 
+{
+  Assign(Other);
+}
+
+Standard_EXPORT   Standard_Integer Extent() const;
+Standard_EXPORT   void Clear() ;
+~SALOME_ListIO()
+{
+  Clear();
+}
+
+Standard_EXPORT   Standard_Boolean IsEmpty() const;
+Standard_EXPORT   void Prepend(const Handle(SALOME_InteractiveObject)& I) ;
+Standard_EXPORT   void Prepend(SALOME_ListIO& Other) ;
+Standard_EXPORT   void Prepend(const Handle(SALOME_InteractiveObject)& I, SALOME_ListIteratorOfListIO& It) ;
+Standard_EXPORT   void Append(const Handle(SALOME_InteractiveObject)& I) ;
+Standard_EXPORT   void Append(SALOME_ListIO& Other) ;
+Standard_EXPORT   void Append(const Handle(SALOME_InteractiveObject)& I, SALOME_ListIteratorOfListIO& It) ;
+Standard_EXPORT   Handle_SALOME_InteractiveObject& First() const;
+Standard_EXPORT   Handle_SALOME_InteractiveObject& Last() const;
+Standard_EXPORT   void RemoveFirst() ;
+Standard_EXPORT   void Remove(SALOME_ListIteratorOfListIO& It) ;
+Standard_EXPORT   void InsertBefore(const Handle(SALOME_InteractiveObject)& I,SALOME_ListIteratorOfListIO& It) ;
+Standard_EXPORT   void InsertBefore(SALOME_ListIO& Other,SALOME_ListIteratorOfListIO& It) ;
+Standard_EXPORT   void InsertAfter(const Handle(SALOME_InteractiveObject)& I,SALOME_ListIteratorOfListIO& It) ;
+Standard_EXPORT   void InsertAfter(SALOME_ListIO& Other,SALOME_ListIteratorOfListIO& It) ;
+
+
+friend class SALOME_ListIteratorOfListIO;
+
+
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+
+
+private: 
+
+ // Methods PRIVATE
+ // 
+Standard_EXPORT SALOME_ListIO(const SALOME_ListIO& Other);
+
+
+ // Fields PRIVATE
+ //
+Standard_Address myFirst;
+Standard_Address myLast;
+
+
+};
+
+#define Item Handle_SALOME_InteractiveObject
+#define Item_hxx "SALOME_InteractiveObject.hxx"
+#define TCollection_ListNode SALOME_ListNodeOfListIO
+#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
+#define TCollection_ListIterator SALOME_ListIteratorOfListIO
+#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
+#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
+#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
+#define TCollection_List SALOME_ListIO
+#define TCollection_List_hxx "SALOME_ListIO.hxx"
+
+#include <TCollection_List.lxx>
+
+#undef Item
+#undef Item_hxx
+#undef TCollection_ListNode
+#undef TCollection_ListNode_hxx
+#undef TCollection_ListIterator
+#undef TCollection_ListIterator_hxx
+#undef Handle_TCollection_ListNode
+#undef TCollection_ListNode_Type_
+#undef TCollection_List
+#undef TCollection_List_hxx
+
+
+// other Inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/OBJECT/SALOME_ListIO_0.cxx b/src/OBJECT/SALOME_ListIO_0.cxx
new file mode 100644 (file)
index 0000000..7538c47
--- /dev/null
@@ -0,0 +1,55 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_ListIO_0.cxx
+//  Module : SALOME
+
+#include "SALOME_ListIO.hxx"
+
+#ifndef _Standard_NoSuchObject_HeaderFile
+#include <Standard_NoSuchObject.hxx>
+#endif
+#ifndef _SALOME_ListIteratorOfListIO_HeaderFile
+#include "SALOME_ListIteratorOfListIO.hxx"
+#endif
+#ifndef _SALOME_InteractiveObject_HeaderFile
+#include "SALOME_InteractiveObject.hxx"
+#endif
+#ifndef _SALOME_ListNodeOfListIO_HeaderFile
+#include "SALOME_ListNodeOfListIO.hxx"
+#endif
+using namespace std;
+
+
+#define Item Handle_SALOME_InteractiveObject
+#define Item_hxx "SALOME_InteractiveObject.hxx"
+#define TCollection_ListNode SALOME_ListNodeOfListIO
+#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
+#define TCollection_ListIterator SALOME_ListIteratorOfListIO
+#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
+#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
+#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
+#define TCollection_List SALOME_ListIO
+#define TCollection_List_hxx "SALOME_ListIO.hxx"
+#include <TCollection_List.gxx>
+
diff --git a/src/OBJECT/SALOME_ListIteratorOfListIO.hxx b/src/OBJECT/SALOME_ListIteratorOfListIO.hxx
new file mode 100644 (file)
index 0000000..e69f42d
--- /dev/null
@@ -0,0 +1,139 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_ListIteratorOfListIO.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_ListIteratorOfListIO_HeaderFile
+#define _SALOME_ListIteratorOfListIO_HeaderFile
+
+#ifndef _Standard_Address_HeaderFile
+#include <Standard_Address.hxx>
+#endif
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+#ifndef _Handle_SALOME_ListNodeOfListIO_HeaderFile
+#include <Handle_SALOME_ListNodeOfListIO.hxx>
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include <Standard_Boolean.hxx>
+#endif
+class Standard_NoMoreObject;
+class Standard_NoSuchObject;
+class SALOME_ListIO;
+class SALOME_InteractiveObject;
+class SALOME_ListNodeOfListIO;
+
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Standard_Macro_HeaderFile
+#include <Standard_Macro.hxx>
+#endif
+
+class SALOME_ListIteratorOfListIO  {
+
+public:
+
+    void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+ // Methods PUBLIC
+ // 
+Standard_EXPORT SALOME_ListIteratorOfListIO();
+Standard_EXPORT SALOME_ListIteratorOfListIO(const SALOME_ListIO& L);
+Standard_EXPORT   void Initialize(const SALOME_ListIO& L) ;
+Standard_EXPORT   Standard_Boolean More() const;
+Standard_EXPORT   void Next() ;
+Standard_EXPORT   Handle_SALOME_InteractiveObject& Value() const;
+
+
+friend class SALOME_ListIO;
+
+
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+
+
+private: 
+
+ // Methods PRIVATE
+ // 
+
+
+ // Fields PRIVATE
+ //
+Standard_Address current;
+Standard_Address previous;
+
+
+};
+
+#define Item Handle_SALOME_InteractiveObject
+#define Item_hxx "SALOME_InteractiveObject.hxx"
+#define TCollection_ListNode SALOME_ListNodeOfListIO
+#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
+#define TCollection_ListIterator SALOME_ListIteratorOfListIO
+#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
+#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
+#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
+#define TCollection_List SALOME_ListIO
+#define TCollection_List_hxx "SALOME_ListIO.hxx"
+
+#include <TCollection_ListIterator.lxx>
+
+#undef Item
+#undef Item_hxx
+#undef TCollection_ListNode
+#undef TCollection_ListNode_hxx
+#undef TCollection_ListIterator
+#undef TCollection_ListIterator_hxx
+#undef Handle_TCollection_ListNode
+#undef TCollection_ListNode_Type_
+#undef TCollection_List
+#undef TCollection_List_hxx
+
+
+// other Inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/OBJECT/SALOME_ListIteratorOfListIO_0.cxx b/src/OBJECT/SALOME_ListIteratorOfListIO_0.cxx
new file mode 100644 (file)
index 0000000..6f5fb7f
--- /dev/null
@@ -0,0 +1,58 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_ListIteratorOfListIO_0.cxx
+//  Module : SALOME
+
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#ifndef _Standard_NoMoreObject_HeaderFile
+#include <Standard_NoMoreObject.hxx>
+#endif
+#ifndef _Standard_NoSuchObject_HeaderFile
+#include <Standard_NoSuchObject.hxx>
+#endif
+#ifndef _SALOME_ListIO_HeaderFile
+#include "SALOME_ListIO.hxx"
+#endif
+#ifndef _SALOME_InteractiveObject_HeaderFile
+#include "SALOME_InteractiveObject.hxx"
+#endif
+#ifndef _SALOME_ListNodeOfListIO_HeaderFile
+#include "SALOME_ListNodeOfListIO.hxx"
+#endif
+using namespace std;
+
+#define Item Handle_SALOME_InteractiveObject
+#define Item_hxx "SALOME_InteractiveObject.hxx"
+#define TCollection_ListNode SALOME_ListNodeOfListIO
+#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
+#define TCollection_ListIterator SALOME_ListIteratorOfListIO
+#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
+#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
+#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
+#define TCollection_List SALOME_ListIO
+#define TCollection_List_hxx "SALOME_ListIO.hxx"
+#include <TCollection_ListIterator.gxx>
+
diff --git a/src/OBJECT/SALOME_ListNodeOfListIO.hxx b/src/OBJECT/SALOME_ListNodeOfListIO.hxx
new file mode 100644 (file)
index 0000000..6d288bc
--- /dev/null
@@ -0,0 +1,137 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_ListNodeOfListIO.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_ListNodeOfListIO_HeaderFile
+#define _SALOME_ListNodeOfListIO_HeaderFile
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Handle_SALOME_ListNodeOfListIO_HeaderFile
+#include <Handle_SALOME_ListNodeOfListIO.hxx>
+#endif
+
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+#ifndef _TCollection_MapNode_HeaderFile
+#include <TCollection_MapNode.hxx>
+#endif
+#ifndef _TCollection_MapNodePtr_HeaderFile
+#include <TCollection_MapNodePtr.hxx>
+#endif
+class SALOME_InteractiveObject;
+class SALOME_ListIO;
+class SALOME_ListIteratorOfListIO;
+
+/*!
+  \class SALOME_ListNodeOfListIO
+  Auxiliary class, represents list node for SALOME_ListIO
+*/
+class SALOME_ListNodeOfListIO : public TCollection_MapNode {
+
+public:
+
+    void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+ // Methods PUBLIC
+ // 
+SALOME_ListNodeOfListIO(const Handle(SALOME_InteractiveObject)& I,const TCollection_MapNodePtr& n);
+  Handle_SALOME_InteractiveObject& Value() const;
+Standard_EXPORT ~SALOME_ListNodeOfListIO();
+
+
+
+
+ // Type management
+ //
+ Standard_EXPORT friend Handle_Standard_Type& SALOME_ListNodeOfListIO_Type_();
+ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+ Standard_EXPORT Standard_Boolean             IsKind(const Handle(Standard_Type)&) const;
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+
+
+private: 
+
+ // Methods PRIVATE
+ // 
+
+
+ // Fields PRIVATE
+ //
+Handle_SALOME_InteractiveObject myValue;
+
+
+};
+
+#define Item Handle_SALOME_InteractiveObject
+#define Item_hxx "SALOME_InteractiveObject.hxx"
+#define TCollection_ListNode SALOME_ListNodeOfListIO
+#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
+#define TCollection_ListIterator SALOME_ListIteratorOfListIO
+#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
+#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
+#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
+#define TCollection_List SALOME_ListIO
+#define TCollection_List_hxx "SALOME_ListIO.hxx"
+
+#include <TCollection_ListNode.lxx>
+
+#undef Item
+#undef Item_hxx
+#undef TCollection_ListNode
+#undef TCollection_ListNode_hxx
+#undef TCollection_ListIterator
+#undef TCollection_ListIterator_hxx
+#undef Handle_TCollection_ListNode
+#undef TCollection_ListNode_Type_
+#undef TCollection_List
+#undef TCollection_List_hxx
+
+
+// other Inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/OBJECT/SALOME_ListNodeOfListIO_0.cxx b/src/OBJECT/SALOME_ListNodeOfListIO_0.cxx
new file mode 100644 (file)
index 0000000..63fda11
--- /dev/null
@@ -0,0 +1,122 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_ListNodeOfListIO_0.cxx
+//  Module : SALOME
+
+#include "SALOME_ListNodeOfListIO.hxx"
+
+#ifndef _Standard_TypeMismatch_HeaderFile
+#include <Standard_TypeMismatch.hxx>
+#endif
+
+#ifndef _SALOME_InteractiveObject_HeaderFile
+#include "SALOME_InteractiveObject.hxx"
+#endif
+#ifndef _SALOME_ListIO_HeaderFile
+#include "SALOME_ListIO.hxx"
+#endif
+#ifndef _SALOME_ListIteratorOfListIO_HeaderFile
+#include "SALOME_ListIteratorOfListIO.hxx"
+#endif
+using namespace std;
+
+/*!
+  Destructor
+*/
+SALOME_ListNodeOfListIO::~SALOME_ListNodeOfListIO() {}
+
+/*!
+  \return OCC Handle Type
+*/
+Standard_EXPORT Handle_Standard_Type& SALOME_ListNodeOfListIO_Type_()
+{
+
+    static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode);
+  if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode);
+  static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
+  if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
+  static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
+  if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
+
+  static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
+  static Handle_Standard_Type _aType = new Standard_Type("SALOME_ListNodeOfListIO",
+                                                        sizeof(SALOME_ListNodeOfListIO),
+                                                        1,
+                                                        (Standard_Address)_Ancestors,
+                                                        (Standard_Address)NULL);
+
+  return _aType;
+}
+
+
+/*!
+  DownCast method, allows safe downcasting
+*/
+const Handle(SALOME_ListNodeOfListIO) Handle(SALOME_ListNodeOfListIO)::DownCast(const Handle(Standard_Transient)& AnObject) 
+{
+  Handle(SALOME_ListNodeOfListIO) _anOtherObject;
+
+  if (!AnObject.IsNull()) {
+     if (AnObject->IsKind(STANDARD_TYPE(SALOME_ListNodeOfListIO))) {
+       _anOtherObject = Handle(SALOME_ListNodeOfListIO)((Handle(SALOME_ListNodeOfListIO)&)AnObject);
+     }
+  }
+
+  return _anOtherObject ;
+}
+
+/*!
+  \return OCC Handle dynamic Type
+*/
+const Handle(Standard_Type)& SALOME_ListNodeOfListIO::DynamicType() const 
+{ 
+  return STANDARD_TYPE(SALOME_ListNodeOfListIO) ; 
+}
+
+/*!
+  \return true if other type is the same
+  \param AType - type to be checked
+*/
+Standard_Boolean SALOME_ListNodeOfListIO::IsKind(const Handle(Standard_Type)& AType) const 
+{ 
+  return (STANDARD_TYPE(SALOME_ListNodeOfListIO) == AType || TCollection_MapNode::IsKind(AType)); 
+}
+/*!
+  Destructor
+*/
+Handle_SALOME_ListNodeOfListIO::~Handle_SALOME_ListNodeOfListIO() {}
+#define Item Handle_SALOME_InteractiveObject
+#define Item_hxx "SALOME_InteractiveObject.hxx"
+#define TCollection_ListNode SALOME_ListNodeOfListIO
+#define TCollection_ListNode_hxx "SALOME_ListNodeOfListIO.hxx"
+#define TCollection_ListIterator SALOME_ListIteratorOfListIO
+#define TCollection_ListIterator_hxx "SALOME_ListIteratorOfListIO.hxx"
+#define Handle_TCollection_ListNode Handle_SALOME_ListNodeOfListIO
+#define TCollection_ListNode_Type_() SALOME_ListNodeOfListIO_Type_()
+#define TCollection_List SALOME_ListIO
+#define TCollection_List_hxx "SALOME_ListIO.hxx"
+#include <TCollection_ListNode.gxx>
+
diff --git a/src/OBJECT/SALOME_Selection.h b/src/OBJECT/SALOME_Selection.h
new file mode 100644 (file)
index 0000000..696f68f
--- /dev/null
@@ -0,0 +1,42 @@
+//  SALOME Selection : description of enumeration Selection_Mode
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_Selection.h
+//  Author :
+//  Module : SALOME
+//  $Header$
+
+#ifndef SALOME_SELECTION_H
+#define SALOME_SELECTION_H
+
+enum Selection_Mode {
+ NodeSelection,
+ CellSelection,
+ EdgeOfCellSelection,
+ EdgeSelection,
+ FaceSelection,
+ VolumeSelection,
+ ActorSelection };
+#endif
+
diff --git a/src/OBJECT/SALOME_TypeFilter.cxx b/src/OBJECT/SALOME_TypeFilter.cxx
new file mode 100644 (file)
index 0000000..57d6390
--- /dev/null
@@ -0,0 +1,47 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_TypeFilter.cxx
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+#include "SALOME_TypeFilter.ixx"
+#include "SALOME_InteractiveObject.hxx"
+using namespace std;
+
+/*!
+  Constructor
+  \param TheKind - type of filter
+*/
+SALOME_TypeFilter::SALOME_TypeFilter(const Standard_CString TheKind):
+myKind(TheKind){}
+
+/*!
+  \return true if object passes filter
+  \param anObj - object to be checked
+*/
+Standard_Boolean SALOME_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const 
+{
+  return anObj->isComponentType( myKind );
+}
diff --git a/src/OBJECT/SALOME_TypeFilter.hxx b/src/OBJECT/SALOME_TypeFilter.hxx
new file mode 100644 (file)
index 0000000..5a32301
--- /dev/null
@@ -0,0 +1,116 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_TypeFilter.hxx
+//  Module : SALOME
+
+#ifndef _SALOME_TypeFilter_HeaderFile
+#define _SALOME_TypeFilter_HeaderFile
+
+#ifndef _Standard_HeaderFile
+#include <Standard.hxx>
+#endif
+#ifndef _Handle_SALOME_TypeFilter_HeaderFile
+#include <Handle_SALOME_TypeFilter.hxx>
+#endif
+
+#ifndef _Standard_CString_HeaderFile
+#include <Standard_CString.hxx>
+#endif
+#ifndef _SALOME_Filter_HeaderFile
+#include "SALOME_Filter.hxx"
+#endif
+#ifndef _Standard_Boolean_HeaderFile
+#include <Standard_Boolean.hxx>
+#endif
+#ifndef _Handle_SALOME_InteractiveObject_HeaderFile
+#include <Handle_SALOME_InteractiveObject.hxx>
+#endif
+
+class SALOME_TypeFilter : public SALOME_Filter {
+
+public:
+
+    inline void* operator new(size_t,void* anAddress) 
+      {
+        return anAddress;
+      }
+    inline void* operator new(size_t size) 
+      { 
+        return Standard::Allocate(size); 
+      }
+    inline void  operator delete(void *anAddress) 
+      { 
+        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+      }
+//    inline void  operator delete(void *anAddress, size_t size) 
+//      { 
+//        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
+//      }
+ // Methods PUBLIC
+ // 
+Standard_EXPORT SALOME_TypeFilter(const Standard_CString aGivenKind);
+Standard_EXPORT virtual  Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anobj) const;
+Standard_EXPORT ~SALOME_TypeFilter();
+
+
+
+
+ // Type management
+ //
+ Standard_EXPORT friend Handle_Standard_Type& SALOME_TypeFilter_Type_();
+ Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
+ Standard_EXPORT Standard_Boolean             IsKind(const Handle(Standard_Type)&) const;
+
+protected:
+
+ // Methods PROTECTED
+ // 
+
+
+ // Fields PROTECTED
+ //
+Standard_CString myKind;
+
+
+private: 
+
+ // Methods PRIVATE
+ // 
+
+
+ // Fields PRIVATE
+ //
+
+
+};
+
+
+
+
+
+// other inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/OBJECT/SALOME_TypeFilter.ixx b/src/OBJECT/SALOME_TypeFilter.ixx
new file mode 100644 (file)
index 0000000..13e1a3e
--- /dev/null
@@ -0,0 +1,83 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_TypeFilter.ixx
+//  Module : SALOME
+
+#include "SALOME_TypeFilter.jxx"
+
+#ifndef _Standard_TypeMismatch_HeaderFile
+#include <Standard_TypeMismatch.hxx>
+#endif
+
+SALOME_TypeFilter::~SALOME_TypeFilter() {}
+
+
+Standard_EXPORT Handle_Standard_Type& SALOME_TypeFilter_Type_()
+{
+
+    static Handle_Standard_Type aType1 = STANDARD_TYPE(SALOME_Filter);
+  if ( aType1.IsNull()) aType1 = STANDARD_TYPE(SALOME_Filter);
+  static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
+  if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
+  static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
+  if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
+
+  static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
+  static Handle_Standard_Type _aType = new Standard_Type("SALOME_TypeFilter",
+                                                        sizeof(SALOME_TypeFilter),
+                                                        1,
+                                                        (Standard_Address)_Ancestors,
+                                                        (Standard_Address)NULL);
+
+  return _aType;
+}
+
+
+// DownCast method
+//   allow safe downcasting
+//
+const Handle(SALOME_TypeFilter) Handle(SALOME_TypeFilter)::DownCast(const Handle(Standard_Transient)& AnObject) 
+{
+  Handle(SALOME_TypeFilter) _anOtherObject;
+
+  if (!AnObject.IsNull()) {
+     if (AnObject->IsKind(STANDARD_TYPE(SALOME_TypeFilter))) {
+       _anOtherObject = Handle(SALOME_TypeFilter)((Handle(SALOME_TypeFilter)&)AnObject);
+     }
+  }
+
+  return _anOtherObject ;
+}
+const Handle(Standard_Type)& SALOME_TypeFilter::DynamicType() const 
+{ 
+  return STANDARD_TYPE(SALOME_TypeFilter) ; 
+}
+Standard_Boolean SALOME_TypeFilter::IsKind(const Handle(Standard_Type)& AType) const 
+{ 
+  return (STANDARD_TYPE(SALOME_TypeFilter) == AType || SALOME_Filter::IsKind(AType)); 
+}
+Handle_SALOME_TypeFilter::~Handle_SALOME_TypeFilter() {}
+
diff --git a/src/OBJECT/SALOME_TypeFilter.jxx b/src/OBJECT/SALOME_TypeFilter.jxx
new file mode 100644 (file)
index 0000000..d519586
--- /dev/null
@@ -0,0 +1,29 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_TypeFilter.jxx
+//  Module : SALOME
+
+#ifndef _SALOME_TypeFilter_HeaderFile
+#include "SALOME_TypeFilter.hxx"
+#endif
diff --git a/src/Plot2d/resources/Plot2d_images.po b/src/Plot2d/resources/Plot2d_images.po
new file mode 100755 (executable)
index 0000000..59c1090
--- /dev/null
@@ -0,0 +1,76 @@
+#  Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+#  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
+#
+# This is a Qt message file in .po format.  Each msgid starts with
+# a scope.  This scope should *NOT* be translated - eg. "Foo::Bar"
+# would be translated to "Pub", not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: example-Qt-message-extraction\n"
+"POT-Creation-Date: 1999-02-23 15:38+0200\n"
+"PO-Revision-Date: 1999-02-23 15:38+0200\n"
+"Last-Translator: \n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+msgid "ICON_PLOT2D_DUMP"
+msgstr "plot2d_camera_dump.png"
+
+msgid "ICON_PLOT2D_FIT_ALL"
+msgstr "plot2d_fitall.png"
+
+msgid "ICON_PLOT2D_FIT_AREA"
+msgstr "plot2d_fitarea.png"
+
+msgid "ICON_PLOT2D_ZOOM"
+msgstr "plot2d_zoom.png"
+
+msgid "ICON_PLOT2D_PAN"
+msgstr "plot2d_pan.png"
+
+msgid "ICON_PLOT2D_GLOBALPAN"
+msgstr "plot2d_glpan.png"
+
+msgid "ICON_PLOT2D_CLONE_VIEW"
+msgstr "plot2d_clone.png"
+
+msgid "ICON_PLOT2D_MODE_LINEAR_HOR"
+msgstr "plot2d_linear.png"
+
+msgid "ICON_PLOT2D_MODE_LOGARITHMIC_HOR"
+msgstr "plot2d_log.png"
+
+msgid "ICON_PLOT2D_MODE_LINEAR_VER"
+msgstr "plot2d_linear_y.png"
+
+msgid "ICON_PLOT2D_MODE_LOGARITHMIC_VER"
+msgstr "plot2d_log_y.png"
+
+msgid "ICON_PLOT2D_SHOW_LEGEND"
+msgstr "plot2d_legend.png"
+
+msgid "ICON_PLOT2D_CURVES_POINTS"
+msgstr "plot2d_points.png"
+
+msgid "ICON_PLOT2D_CURVES_LINES"
+msgstr "plot2d_lines.png"
+
+msgid "ICON_PLOT2D_CURVES_SPLINES"
+msgstr "plot2d_splines.png"
+
+msgid "ICON_PLOT2D_SETTINGS"
+msgstr "plot2d_settings.png"
diff --git a/src/Plot2d/resources/Plot2d_images.ts b/src/Plot2d/resources/Plot2d_images.ts
new file mode 100644 (file)
index 0000000..9f30f86
--- /dev/null
@@ -0,0 +1,69 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>@default</name>
+    <message>
+        <source>ICON_PLOT2D_GLOBALPAN</source>
+        <translation>plot2d_glpan.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_CLONE_VIEW</source>
+        <translation>plot2d_clone.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_CURVES_POINTS</source>
+        <translation>plot2d_points.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_FIT_AREA</source>
+        <translation>plot2d_fitarea.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_DUMP</source>
+        <translation>plot2d_camera_dump.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_ZOOM</source>
+        <translation>plot2d_zoom.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_MODE_LINEAR_VER</source>
+        <translation>plot2d_linear_y.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_MODE_LINEAR_HOR</source>
+        <translation>plot2d_linear.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_PAN</source>
+        <translation>plot2d_pan.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_FIT_ALL</source>
+        <translation>plot2d_fitall.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_MODE_LOGARITHMIC_HOR</source>
+        <translation>plot2d_log.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_MODE_LOGARITHMIC_VER</source>
+        <translation>plot2d_log_y.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_SETTINGS</source>
+        <translation>plot2d_settings.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_CURVES_LINES</source>
+        <translation>plot2d_lines.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_CURVES_SPLINES</source>
+        <translation>plot2d_splines.png</translation>
+    </message>
+    <message>
+        <source>ICON_PLOT2D_SHOW_LEGEND</source>
+        <translation>plot2d_legend.png</translation>
+    </message>
+</context>
+</TS>
diff --git a/src/Plot2d/resources/Plot2d_msg_en.po b/src/Plot2d/resources/Plot2d_msg_en.po
new file mode 100755 (executable)
index 0000000..e0d764d
--- /dev/null
@@ -0,0 +1,411 @@
+#  Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+#
+#  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
+#
+# This is a Qt message file in .po format.  Each msgid starts with
+# a scope.  This scope should *NOT* be translated - eg. "Foo::Bar"
+# would be translated to "Pub", not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: example-Qt-message-extraction\n"
+"POT-Creation-Date: 1999-02-23 15:38+0200\n"
+"PO-Revision-Date: 1999-02-23 15:38+0200\n"
+"Last-Translator: \n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+# ------------------------------------
+# Plot2d_ViewFrame
+# ------------------------------------
+msgid "TOT_PLOT2D_MODE_LINEAR_HOR"
+msgstr "Horizontal axis: linear"
+
+msgid "MEN_PLOT2D_MODE_LINEAR_HOR"
+msgstr "Horizontal axis: linear"
+
+msgid "PRP_PLOT2D_MODE_LINEAR_HOR"
+msgstr "Switches view to linear scaling mode along horizontal axis"
+
+msgid "TOT_PLOT2D_MODE_LOGARITHMIC_HOR"
+msgstr "Horizontal axis: logarithmic"
+
+msgid "MEN_PLOT2D_MODE_LOGARITHMIC_HOR"
+msgstr "Horizontal axis: logarithmic"
+
+msgid "PRP_PLOT2D_MODE_LOGARITHMIC_HOR"
+msgstr "Switches view to logarithmic scaling mode along horizontal axis"
+
+msgid "TOT_PLOT2D_MODE_LINEAR_VER"
+msgstr "Vertical axis: linear"
+
+msgid "MEN_PLOT2D_MODE_LINEAR_VER"
+msgstr "Vertical axis: linear"
+
+msgid "PRP_PLOT2D_MODE_LINEAR_VER"
+msgstr "Switches view to linear scaling mode along vertical axis"
+
+msgid "TOT_PLOT2D_MODE_LOGARITHMIC_VER"
+msgstr "Vertical axis: logarithmic"
+
+msgid "MEN_PLOT2D_MODE_LOGARITHMIC_VER"
+msgstr "Vertical axis: logarithmic"
+
+msgid "PRP_PLOT2D_MODE_LOGARITHMIC_VER"
+msgstr "Switches view to logarithmic scaling mode along vertical axis"
+
+msgid "TOT_PLOT2D_SHOW_LEGEND"
+msgstr "Show Legend"
+
+msgid "MEN_PLOT2D_SHOW_LEGEND"
+msgstr "Show &Legend"
+
+msgid "PRP_PLOT2D_SHOW_LEGEND"
+msgstr "Enables/disables legend"
+
+msgid "TOT_PLOT2D_CURVES_POINTS"
+msgstr "Draw points"
+
+msgid "MEN_PLOT2D_CURVES_POINTS"
+msgstr "Draw points"
+
+msgid "PRP_PLOT2D_CURVES_POINTS"
+msgstr "Switches view to points mode"
+
+msgid "TOT_PLOT2D_CURVES_LINES"
+msgstr "Draw lines"
+
+msgid "MEN_PLOT2D_CURVES_LINES"
+msgstr "Draw lines"
+
+msgid "PRP_PLOT2D_CURVES_LINES"
+msgstr "Switches view to lines mode"
+
+msgid "TOT_PLOT2D_CURVES_SPLINES"
+msgstr "Draw splines"
+
+msgid "MEN_PLOT2D_CURVES_SPLINES"
+msgstr "Draw splines"
+
+msgid "PRP_PLOT2D_CURVES_SPLINES"
+msgstr "Switches view to splines mode"
+
+msgid "TOT_PLOT2D_SETTINGS"
+msgstr "Settings"
+
+msgid "MEN_PLOT2D_SETTINGS"
+msgstr "&Settings"
+
+msgid "PRP_PLOT2D_SETTINGS"
+msgstr "Setups view properties"
+
+msgid "TOT_PLOT2D_FITDATA"
+msgstr "Fit range"
+
+msgid "MEN_PLOT2D_FITDATA"
+msgstr "Fit &Range"
+
+msgid "PRP_PLOT2D_FITDATA"
+msgstr "Fits view to the given data range"
+
+msgid "TOT_PLOT2D_CHANGE_BACKGROUND"
+msgstr "Change background"
+
+msgid "MEN_PLOT2D_CHANGE_BACKGROUND"
+msgstr "Change background..."
+
+msgid "PRP_PLOT2D_CHANGE_BACKGROUND"
+msgstr "Change background color"
+
+msgid "SCALING_POPUP"
+msgstr "Scaling"
+
+msgid "CURVE_TYPE_POPUP"
+msgstr "Curve type"
+
+msgid "INF_COORDINATES"
+msgstr "Coordinates: X : %1, Y : %2"
+
+msgid "WARNING"
+msgstr "Warning"
+
+msgid "WRN_XLOG_NOT_ALLOWED"
+msgstr "Some points with non-positive abscissa values have been detected.\nLogarithmic scale for abscissa axis is not allowed."
+
+msgid "WRN_YLOG_NOT_ALLOWED"
+msgstr "Some points with non-positive ordinate values have been detected.\nLogarithmic scale for ordinate axis is not allowed."
+
+msgid "INF_COORDINATES_SOME_Y"
+msgstr "Coordinates: X : %1, Y : %2 ( %3 )"
+
+#msgid "INF_READY"
+#msgstr "Ready"
+
+msgid "PLOT2D_IMAGE_FILES"
+msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)"
+
+msgid "INF_APP_DUMP_VIEW"
+msgstr "Dump view"
+
+msgid "ERR_DOC_CANT_SAVE_FILE"
+msgstr "Cannot save file"
+
+msgid "ERROR"
+msgstr "Error"
+
+#-------------------------------------
+# Plot2d_SetupViewDlg
+# ------------------------------------
+msgid "TLT_SETUP_PLOT2D_VIEW"
+msgstr "Plot 2d View Settings"
+
+msgid "PLOT2D_ENABLE_MAIN_TITLE"
+msgstr "Main title"
+
+msgid "PLOT2D_ENABLE_HOR_TITLE"
+msgstr "Horizontal axis title"
+
+msgid "INF_AXES_X"
+msgstr "Axis X"
+
+msgid "INF_AXES_Y_LEFT"
+msgstr "Axis Y Left"
+
+msgid "INF_AXES_Y_RIGHT"
+msgstr "Axis Y Right"
+
+msgid "PLOT2D_ENABLE_VER_TITLE"
+msgstr "Vertical axis title"
+
+msgid "PLOT2D_CURVE_TYPE_LBL"
+msgstr "Curve type:"
+
+msgid "PLOT2D_CURVE_TYPE_POINTS"
+msgstr "Points"
+
+msgid "PLOT2D_CURVE_TYPE_LINES"
+msgstr "Lines"
+
+msgid "PLOT2D_CURVE_TYPE_SPLINE"
+msgstr "Spline"
+
+msgid "PLOT2D_ENABLE_LEGEND"
+msgstr "Show legend"
+
+msgid "PLOT2D_LEGEND_POSITION_LEFT"
+msgstr "Left"
+
+msgid "PLOT2D_LEGEND_POSITION_RIGHT"
+msgstr "Right"
+
+msgid "PLOT2D_LEGEND_POSITION_TOP"
+msgstr "Top"
+
+msgid "PLOT2D_LEGEND_POSITION_BOTTOM"
+msgstr "Bottom"
+
+msgid "PLOT2D_MARKER_SIZE_LBL"
+msgstr "Marker size:"
+
+msgid "PLOT2D_BACKGROUND_COLOR_LBL"
+msgstr "Background color:"
+
+msgid "PLOT2D_SCALE_TLT"
+msgstr "Scale mode"
+
+msgid "PLOT2D_SCALE_MODE_HOR"
+msgstr "Horizontal axis:"
+
+msgid "PLOT2D_SCALE_MODE_VER"
+msgstr "Vertical axis:"
+
+msgid "PLOT2D_SCALE_MODE_LINEAR"
+msgstr "Linear"
+
+msgid "PLOT2D_SCALE_MODE_LOGARITHMIC"
+msgstr "Logarithmic"
+
+msgid "PLOT2D_GRID_TLT"
+msgstr "Grid / Axes marks"
+
+msgid "PLOT2D_GRID_ENABLE_HOR_MAJOR"
+msgstr "Horizontal major"
+
+msgid "PLOT2D_GRID_ENABLE_VER_MAJOR"
+msgstr "Vertical major"
+
+msgid "PLOT2D_GRID_ENABLE_HOR_MINOR"
+msgstr "Horizontal minor"
+
+msgid "PLOT2D_GRID_ENABLE_VER_MINOR"
+msgstr "Vertical minor"
+
+msgid "PLOT2D_MAX_INTERVALS"
+msgstr "Max intervals"
+
+msgid "PLOT2D_SET_AS_DEFAULT_CHECK"
+msgstr "Save settings as default"
+
+# ------------------------------------
+# Plot2d_FitDataDlg
+# ------------------------------------
+msgid "FIT_DATA_TLT"
+msgstr "Fit Data Range"
+
+msgid "Plot2d_FitDataDlg::FIT_ALL"
+msgstr "Fit both"
+
+msgid "Plot2d_FitDataDlg::FIT_HORIZONTAL"
+msgstr "Fit horizontally"
+
+msgid "Plot2d_FitDataDlg::FIT_VERTICAL"
+msgstr "Fit vertically"
+
+msgid "Plot2d_FitDataDlg::HORIZONTAL_AXIS"
+msgstr "Horizontal axis"
+
+msgid "Plot2d_FitDataDlg::VERTICAL_AXIS"
+msgstr "Vertical axis"
+
+msgid "Plot2d_FitDataDlg::VERTICAL_LEFT_AXIS"
+msgstr "Vertical left axis"
+
+msgid "Plot2d_FitDataDlg::VERTICAL_RIGHT_AXIS"
+msgstr "Vertical right axis"
+
+msgid "Plot2d_FitDataDlg::MIN_VALUE_LAB"
+msgstr "Min:"
+
+msgid "Plot2d_FitDataDlg::MAX_VALUE_LAB"
+msgstr "Max:"
+
+# ------------------------------------
+# Plot2d_ViewWindow
+# ------------------------------------
+
+msgid "LBL_TOOLBAR_LABEL"
+msgstr "View Operations"
+
+msgid "DSC_DUMP_VIEW"
+msgstr "Saves the active view in the image file"
+
+msgid "MNU_DUMP_VIEW"
+msgstr "Dump view..."
+
+msgid "DSC_FITALL"
+msgstr "Fit all objects inside the view frame"
+
+msgid "MNU_FITALL"
+msgstr "Fit All"
+
+msgid "DSC_FITRECT"
+msgstr "Fit area within the view frame"
+
+msgid "MNU_FITRECT"
+msgstr "Fit Area"
+
+msgid "DSC_ZOOM_VIEW"
+msgstr "Zoom the view"
+
+msgid "MNU_ZOOM_VIEW"
+msgstr "Zoom"
+
+msgid "DSC_PAN_VIEW"
+msgstr "Panning the view"
+
+msgid "MNU_PAN_VIEW"
+msgstr "Panning"
+
+msgid "DSC_GLOBALPAN_VIEW"
+msgstr "Selection of a new center of the view"
+
+msgid "MNU_GLOBALPAN_VIEW"
+msgstr "Global Panning"
+
+msgid "DSC_CLONE_VIEW"
+msgstr "Create new OCC viewer for the active scene"
+
+msgid "MNU_CLONE_VIEW"
+msgstr "Clone View"
+
+
+msgid "TLT_SETUP_CURVE"
+msgstr "Setup Curve"
+
+msgid "CURVE_LINE_TYPE_LAB"
+msgstr "Line type:"
+
+msgid "CURVE_LINE_WIDTH_LAB"
+msgstr "Line width:"
+
+msgid "CURVE_MARKER_TYPE_LAB"
+msgstr "Marker type:"
+
+msgid "CURVE_COLOR_LAB"
+msgstr "Color:"
+
+msgid "NONE_LINE_LBL"
+msgstr "None"
+
+msgid "SOLID_LINE_LBL"
+msgstr "Solid"
+
+msgid "DASH_LINE_LBL"
+msgstr "Dash"
+
+msgid "DOT_LINE_LBL"
+msgstr "Dot"
+
+msgid "DASHDOT_LINE_LBL"
+msgstr "DashDot"
+
+msgid "DAHSDOTDOT_LINE_LBL"
+msgstr "DashDotDot"
+
+msgid "NONE_MARKER_LBL"
+msgstr "None"
+
+msgid "CIRCLE_MARKER_LBL"
+msgstr "Circle"
+
+msgid "RECTANGLE_MARKER_LBL"
+msgstr "Rectangle"
+
+msgid "DIAMOND_MARKER_LBL"
+msgstr "Diamond"
+
+msgid "DTRIANGLE_MARKER_LBL"
+msgstr "Downward triangle"
+
+msgid "UTRIANGLE_MARKER_LBL"
+msgstr "Upward triangle"
+
+msgid "LTRIANGLE_MARKER_LBL"
+msgstr "Leftward triangle"
+
+msgid "RTRIANGLE_MARKER_LBL"
+msgstr "Rightward triangle"
+
+msgid "CROSS_MARKER_LBL"
+msgstr "Cross"
+
+msgid "XCROSS_MARKER_LBL"
+msgstr "Diagonal cross"
+
+msgid "POSTSCRIPT_FILES"
+msgstr "PostScript files (*.ps)"
+
+msgid "Plot2d_ViewManager::PLOT2D_VIEW_TITLE"
+msgstr "Plot2d scene:%M - viewer:%V"
diff --git a/src/Plot2d/resources/Plot2d_msg_en.ts b/src/Plot2d/resources/Plot2d_msg_en.ts
new file mode 100644 (file)
index 0000000..367bde8
--- /dev/null
@@ -0,0 +1,505 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>@default</name>
+    <message>
+        <source>PLOT2D_CURVE_TYPE_LBL</source>
+        <translation>Curve type:</translation>
+    </message>
+    <message>
+        <source>ERROR</source>
+        <translation>Error</translation>
+    </message>
+    <message>
+        <source>PLOT2D_SET_AS_DEFAULT_CHECK</source>
+        <translation>Save settings as default</translation>
+    </message>
+    <message>
+        <source>TLT_SETUP_CURVE</source>
+        <translation>Setup Curve</translation>
+    </message>
+    <message>
+        <source>MNU_DUMP_VIEW</source>
+        <translation>Dump view...</translation>
+    </message>
+    <message>
+        <source>PLOT2D_SCALE_MODE_HOR</source>
+        <translation>Horizontal axis:</translation>
+    </message>
+    <message>
+        <source>PLOT2D_SCALE_MODE_VER</source>
+        <translation>Vertical axis:</translation>
+    </message>
+    <message>
+        <source>MNU_PAN_VIEW</source>
+        <translation>Panning</translation>
+    </message>
+    <message>
+        <source>MNU_CLONE_VIEW</source>
+        <translation>Clone View</translation>
+    </message>
+    <message>
+        <source>POSTSCRIPT_FILES</source>
+        <translation>PostScript files (*.ps)</translation>
+    </message>
+    <message>
+        <source>DSC_GLOBALPAN_VIEW</source>
+        <translation>Selection of a new center of the view</translation>
+    </message>
+    <message>
+        <source>PRP_PLOT2D_MODE_LINEAR_VER</source>
+        <translation>Switches view to linear scaling mode along vertical axis</translation>
+    </message>
+    <message>
+        <source>PRP_PLOT2D_MODE_LINEAR_HOR</source>
+        <translation>Switches view to linear scaling mode along horizontal axis</translation>
+    </message>
+    <message>
+        <source>CURVE_LINE_WIDTH_LAB</source>
+        <translation>Line width:</translation>
+    </message>
+    <message>
+        <source>CURVE_TYPE_POPUP</source>
+        <translation>Curve type</translation>
+    </message>
+    <message>
+        <source>TOT_PLOT2D_MODE_LINEAR_VER</source>
+        <translation>Vertical axis: linear</translation>
+    </message>
+    <message>
+        <source>TOT_PLOT2D_MODE_LINEAR_HOR</source>
+        <translation>Horizontal axis: linear</translation>
+    </message>
+    <message>
+        <source>FIT_DATA_TLT</source>
+        <translation>Fit Data Range</translation>
+    </message>
+    <message>
+        <source>MNU_ZOOM_VIEW</source>
+        <translation>Zoom</translation>
+    </message>
+    <message>
+        <source>PLOT2D_GRID_TLT</source>
+        <translation>Grid / Axes marks</translation>
+    </message>
+    <message>
+        <source>DSC_PAN_VIEW</source>
+        <translation>Panning the view</translation>
+    </message>
+    <message>
+        <source>DASHDOT_LINE_LBL</source>
+        <translation>DashDot</translation>
+    </message>
+    <message>
+        <source>PRP_PLOT2D_CURVES_SPLINES</source>
+        <translation>Switches view to splines mode</translation>
+    </message>
+    <message>
+        <source>INF_AXES_X</source>
+        <translation>Axis X</translation>
+    </message>
+    <message>
+        <source>PLOT2D_SCALE_TLT</source>
+        <translation>Scale mode</translation>
+    </message>
+    <message>
+        <source>DSC_FITALL</source>
+        <translation>Fit all objects inside the view frame</translation>
+    </message>
+    <message>
+        <source>MNU_FITALL</source>
+        <translation>Fit All</translation>
+    </message>
+    <message>
+        <source>TOT_PLOT2D_MODE_LOGARITHMIC_HOR</source>
+        <translation>Horizontal axis: logarithmic</translation>
+    </message>
+    <message>
+        <source>TOT_PLOT2D_MODE_LOGARITHMIC_VER</source>
+        <translation>Vertical axis: logarithmic</translation>
+    </message>
+    <message>
+        <source>MNU_GLOBALPAN_VIEW</source>
+        <translation>Global Panning</translation>
+    </message>
+    <message>
+        <source>INF_APP_DUMP_VIEW</source>
+        <translation>Dump view</translation>
+    </message>
+    <message>
+        <source>PLOT2D_LEGEND_POSITION_BOTTOM</source>
+        <translation>Bottom</translation>
+    </message>
+    <message>
+        <source>INF_COORDINATES</source>
+        <translation>Coordinates: X : %1, Y : %2</translation>
+    </message>
+    <message>
+        <source>DSC_CLONE_VIEW</source>
+        <translation>Create new OCC viewer for the active scene</translation>
+    </message>
+    <message>
+        <source>DASH_LINE_LBL</source>
+        <translation>Dash</translation>
+    </message>
+    <message>
+        <source>DTRIANGLE_MARKER_LBL</source>
+        <translation>Downward triangle</translation>
+    </message>
+    <message>
+        <source>UTRIANGLE_MARKER_LBL</source>
+        <translation>Upward triangle</translation>
+    </message>
+    <message>
+        <source>LTRIANGLE_MARKER_LBL</source>
+        <translation>Leftward triangle</translation>
+    </message>
+    <message>
+        <source>RTRIANGLE_MARKER_LBL</source>
+        <translation>Rightward triangle</translation>
+    </message>
+    <message>
+        <source>RECTANGLE_MARKER_LBL</source>
+        <translation>Rectangle</translation>
+    </message>
+    <message>
+        <source>TLT_SETUP_PLOT2D_VIEW</source>
+        <translation>Plot 2d View Settings</translation>
+    </message>
+    <message>
+        <source>CURVE_LINE_TYPE_LAB</source>
+        <translation>Line type:</translation>
+    </message>
+    <message>
+        <source>CROSS_MARKER_LBL</source>
+        <translation>Cross</translation>
+    </message>
+    <message>
+        <source>XCROSS_MARKER_LBL</source>
+        <translation>Diagonal cross</translation>
+    </message>
+    <message>
+        <source>PLOT2D_ENABLE_VER_TITLE</source>
+        <translation>Vertical axis title</translation>
+    </message>
+    <message>
+        <source>PLOT2D_ENABLE_HOR_TITLE</source>
+        <translation>Horizontal axis title</translation>
+    </message>
+    <message>
+        <source>TOT_PLOT2D_SETTINGS</source>
+        <translation>Settings</translation>
+    </message>
+    <message>
+        <source>PLOT2D_CURVE_TYPE_LINES</source>
+        <translation>Lines</translation>
+    </message>
+    <message>
+        <source>MEN_PLOT2D_CURVES_SPLINES</source>
+        <translation>Draw splines</translation>
+    </message>
+    <message>
+        <source>PRP_PLOT2D_MODE_LOGARITHMIC_HOR</source>
+        <translation>Switches view to logarithmic scaling mode along horizontal axis</translation>
+    </message>
+    <message>
+        <source>PRP_PLOT2D_MODE_LOGARITHMIC_VER</source>
+        <translation>Switches view to logarithmic scaling mode along vertical axis</translation>
+    </message>
+    <message>
+        <source>PLOT2D_IMAGE_FILES</source>
+        <translation>Images Files (*.bmp *.png *.jpg *.jpeg)</translation>
+    </message>
+    <message>
+        <source>PLOT2D_MAX_INTERVALS</source>
+        <translation>Max intervals</translation>
+    </message>
+    <message>
+        <source>INF_AXES_Y_LEFT</source>
+        <translation>Axis Y Left</translation>
+    </message>
+    <message>
+        <source>CURVE_COLOR_LAB</source>
+        <translation>Color:</translation>
+    </message>
+    <message>
+        <source>CURVE_PREVIEW_LAB</source>
+        <translation>Preview:</translation>
+    </message>
+    <message>
+        <source>DIAMOND_MARKER_LBL</source>
+        <translation>Diamond</translation>
+    </message>
+    <message>
+        <source>PLOT2D_LEGEND_POSITION_TOP</source>
+        <translation>Top</translation>
+    </message>
+    <message>
+        <source>TOT_PLOT2D_CHANGE_BACKGROUND</source>
+        <translation>Change background</translation>
+    </message>
+    <message>
+        <source>MEN_PLOT2D_CHANGE_BACKGROUND</source>
+        <translation>Change background...</translation>
+    </message>
+    <message>
+        <source>PRP_PLOT2D_CHANGE_BACKGROUND</source>
+        <translation>Change background color</translation>
+    </message>
+    <message>
+        <source>SOLID_LINE_LBL</source>
+        <translation>Solid</translation>
+    </message>
+    <message>
+        <source>PLOT2D_GRID_ENABLE_VER_MAJOR</source>
+        <translation>Vertical major</translation>
+    </message>
+    <message>
+        <source>PLOT2D_GRID_ENABLE_HOR_MAJOR</source>
+        <translation>Horizontal major</translation>
+    </message>
+    <message>
+        <source>PLOT2D_GRID_ENABLE_VER_MINOR</source>
+        <translation>Vertical minor</translation>
+    </message>
+    <message>
+        <source>TOT_PLOT2D_CURVES_POINTS</source>
+        <translation>Draw points</translation>
+    </message>
+    <message>
+        <source>PLOT2D_GRID_ENABLE_HOR_MINOR</source>
+        <translation>Horizontal minor</translation>
+    </message>
+    <message>
+        <source>PLOT2D_BACKGROUND_COLOR_LBL</source>
+        <translation>Background color:</translation>
+    </message>
+    <message>
+        <source>WRN_XLOG_NOT_ALLOWED</source>
+        <translation>Some points with non-positive abscissa values have been detected.
+Logarithmic scale for abscissa axis is not allowed.</translation>
+    </message>
+    <message>
+        <source>WRN_YLOG_NOT_ALLOWED</source>
+        <translation>Some points with non-positive ordinate values have been detected.
+Logarithmic scale for ordinate axis is not allowed.</translation>
+    </message>
+    <message>
+        <source>DSC_FITRECT</source>
+        <translation>Fit area within the view frame</translation>
+    </message>
+    <message>
+        <source>PLOT2D_LEGEND_POSITION_LEFT</source>
+        <translation>Left</translation>
+    </message>
+    <message>
+        <source>MNU_FITRECT</source>
+        <translation>Fit Area</translation>
+    </message>
+    <message>
+        <source>DOT_LINE_LBL</source>
+        <translation>Dot</translation>
+    </message>
+    <message>
+        <source>MEN_PLOT2D_CURVES_POINTS</source>
+        <translation>Draw points</translation>
+    </message>
+    <message>
+        <source>PRP_PLOT2D_CURVES_POINTS</source>
+        <translation>Switches view to points mode</translation>
+    </message>
+    <message>
+        <source>PLOT2D_SCALE_MODE_LOGARITHMIC</source>
+        <translation>Logarithmic</translation>
+    </message>
+    <message>
+        <source>PLOT2D_LEGEND_POSITION_RIGHT</source>
+        <translation>Right</translation>
+    </message>
+    <message>
+        <source>DSC_DUMP_VIEW</source>
+        <translation>Saves the active view in the image file</translation>
+    </message>
+    <message>
+        <source>WARNING</source>
+        <translation>Warning</translation>
+    </message>
+    <message>
+        <source>PLOT2D_ENABLE_LEGEND</source>
+        <translation>Show legend</translation>
+    </message>
+    <message>
+        <source>DSC_ZOOM_VIEW</source>
+        <translation>Zoom the view</translation>
+    </message>
+    <message>
+        <source>PRP_PLOT2D_SETTINGS</source>
+        <translation>Setups view properties</translation>
+    </message>
+    <message>
+        <source>INF_COORDINATES_SOME_Y</source>
+        <translation>Coordinates: X : %1, Y : %2 ( %3 )</translation>
+    </message>
+    <message>
+        <source>SCALING_POPUP</source>
+        <translation>Scaling</translation>
+    </message>
+    <message>
+        <source>PLOT2D_SCALE_MODE_LINEAR</source>
+        <translation>Linear</translation>
+    </message>
+    <message>
+        <source>TOT_PLOT2D_FITDATA</source>
+        <translation>Fit range</translation>
+    </message>
+    <message>
+        <source>PLOT2D_CURVE_TYPE_POINTS</source>
+        <translation>Points</translation>
+    </message>
+    <message>
+        <source>PLOT2D_CURVE_TYPE_SPLINE</source>
+        <translation>Spline</translation>
+    </message>
+    <message>
+        <source>MEN_PLOT2D_FITDATA</source>
+        <translation>Fit &amp;Range</translation>
+    </message>
+    <message>
+        <source>MEN_PLOT2D_MODE_LOGARITHMIC_HOR</source>
+        <translation>Horizontal axis: logarithmic</translation>
+    </message>
+    <message>
+        <source>MEN_PLOT2D_MODE_LOGARITHMIC_VER</source>
+        <translation>Vertical axis: logarithmic</translation>
+    </message>
+    <message>
+        <source>PRP_PLOT2D_FITDATA</source>
+        <translation>Fits view to the given data range</translation>
+    </message>
+    <message>
+        <source>MEN_PLOT2D_MODE_LINEAR_VER</source>
+        <translation>Vertical axis: linear</translation>
+    </message>
+    <message>
+        <source>MEN_PLOT2D_MODE_LINEAR_HOR</source>
+        <translation>Horizontal axis: linear</translation>
+    </message>
+    <message>
+        <source>NONE_MARKER_LBL</source>
+        <translation>None</translation>
+    </message>
+    <message>
+        <source>ERR_DOC_CANT_SAVE_FILE</source>
+        <translation>Cannot save file</translation>
+    </message>
+    <message>
+        <source>MEN_PLOT2D_SHOW_LEGEND</source>
+        <translation>Show &amp;Legend</translation>
+    </message>
+    <message>
+        <source>PRP_PLOT2D_SHOW_LEGEND</source>
+        <translation>Enables/disables legend</translation>
+    </message>
+    <message>
+        <source>TOT_PLOT2D_SHOW_LEGEND</source>
+        <translation>Show Legend</translation>
+    </message>
+    <message>
+        <source>INF_AXES_Y_RIGHT</source>
+        <translation>Axis Y Right</translation>
+    </message>
+    <message>
+        <source>DAHSDOTDOT_LINE_LBL</source>
+        <translation>DashDotDot</translation>
+    </message>
+    <message>
+        <source>TOT_PLOT2D_CURVES_SPLINES</source>
+        <translation>Draw splines</translation>
+    </message>
+    <message>
+        <source>CURVE_MARKER_TYPE_LAB</source>
+        <translation>Marker type:</translation>
+    </message>
+    <message>
+        <source>MEN_PLOT2D_SETTINGS</source>
+        <translation>&amp;Settings</translation>
+    </message>
+    <message>
+        <source>CIRCLE_MARKER_LBL</source>
+        <translation>Circle</translation>
+    </message>
+    <message>
+        <source>LBL_TOOLBAR_LABEL</source>
+        <translation>View Operations</translation>
+    </message>
+    <message>
+        <source>NONE_LINE_LBL</source>
+        <translation>None</translation>
+    </message>
+    <message>
+        <source>PLOT2D_MARKER_SIZE_LBL</source>
+        <translation>Marker size:</translation>
+    </message>
+    <message>
+        <source>PLOT2D_ENABLE_MAIN_TITLE</source>
+        <translation>Main title</translation>
+    </message>
+    <message>
+        <source>TOT_PLOT2D_CURVES_LINES</source>
+        <translation>Draw lines</translation>
+    </message>
+    <message>
+        <source>PRP_PLOT2D_CURVES_LINES</source>
+        <translation>Switches view to lines mode</translation>
+    </message>
+    <message>
+        <source>MEN_PLOT2D_CURVES_LINES</source>
+        <translation>Draw lines</translation>
+    </message>
+</context>
+<context>
+    <name>Plot2d_FitDataDlg</name>
+    <message>
+        <source>FIT_HORIZONTAL</source>
+        <translation>Fit horizontally</translation>
+    </message>
+    <message>
+        <source>MIN_VALUE_LAB</source>
+        <translation>Min:</translation>
+    </message>
+    <message>
+        <source>VERTICAL_AXIS</source>
+        <translation>Vertical axis</translation>
+    </message>
+    <message>
+        <source>MAX_VALUE_LAB</source>
+        <translation>Max:</translation>
+    </message>
+    <message>
+        <source>HORIZONTAL_AXIS</source>
+        <translation>Horizontal axis</translation>
+    </message>
+    <message>
+        <source>VERTICAL_LEFT_AXIS</source>
+        <translation>Vertical left axis</translation>
+    </message>
+    <message>
+        <source>FIT_ALL</source>
+        <translation>Fit both</translation>
+    </message>
+    <message>
+        <source>VERTICAL_RIGHT_AXIS</source>
+        <translation>Vertical right axis</translation>
+    </message>
+    <message>
+        <source>FIT_VERTICAL</source>
+        <translation>Fit vertically</translation>
+    </message>
+</context>
+<context>
+    <name>Plot2d_ViewManager</name>
+    <message>
+        <source>PLOT2D_VIEW_TITLE</source>
+        <translation>Plot2d scene:%M - viewer:%V</translation>
+    </message>
+</context>
+</TS>
diff --git a/src/Plot2d/resources/plot2d_camera_dump.png b/src/Plot2d/resources/plot2d_camera_dump.png
new file mode 100755 (executable)
index 0000000..b02616f
Binary files /dev/null and b/src/Plot2d/resources/plot2d_camera_dump.png differ
diff --git a/src/Plot2d/resources/plot2d_clone.png b/src/Plot2d/resources/plot2d_clone.png
new file mode 100755 (executable)
index 0000000..441482d
Binary files /dev/null and b/src/Plot2d/resources/plot2d_clone.png differ
diff --git a/src/Plot2d/resources/plot2d_fitall.png b/src/Plot2d/resources/plot2d_fitall.png
new file mode 100755 (executable)
index 0000000..87e001d
Binary files /dev/null and b/src/Plot2d/resources/plot2d_fitall.png differ
diff --git a/src/Plot2d/resources/plot2d_fitarea.png b/src/Plot2d/resources/plot2d_fitarea.png
new file mode 100755 (executable)
index 0000000..450dc56
Binary files /dev/null and b/src/Plot2d/resources/plot2d_fitarea.png differ
diff --git a/src/Plot2d/resources/plot2d_glpan.png b/src/Plot2d/resources/plot2d_glpan.png
new file mode 100755 (executable)
index 0000000..28ab547
Binary files /dev/null and b/src/Plot2d/resources/plot2d_glpan.png differ
diff --git a/src/Plot2d/resources/plot2d_legend.png b/src/Plot2d/resources/plot2d_legend.png
new file mode 100755 (executable)
index 0000000..cdcc1e0
Binary files /dev/null and b/src/Plot2d/resources/plot2d_legend.png differ
diff --git a/src/Plot2d/resources/plot2d_linear.png b/src/Plot2d/resources/plot2d_linear.png
new file mode 100755 (executable)
index 0000000..d79f214
Binary files /dev/null and b/src/Plot2d/resources/plot2d_linear.png differ
diff --git a/src/Plot2d/resources/plot2d_linear_y.png b/src/Plot2d/resources/plot2d_linear_y.png
new file mode 100755 (executable)
index 0000000..e396eac
Binary files /dev/null and b/src/Plot2d/resources/plot2d_linear_y.png differ
diff --git a/src/Plot2d/resources/plot2d_lines.png b/src/Plot2d/resources/plot2d_lines.png
new file mode 100755 (executable)
index 0000000..6baf573
Binary files /dev/null and b/src/Plot2d/resources/plot2d_lines.png differ
diff --git a/src/Plot2d/resources/plot2d_log.png b/src/Plot2d/resources/plot2d_log.png
new file mode 100755 (executable)
index 0000000..aecca8c
Binary files /dev/null and b/src/Plot2d/resources/plot2d_log.png differ
diff --git a/src/Plot2d/resources/plot2d_log_y.png b/src/Plot2d/resources/plot2d_log_y.png
new file mode 100755 (executable)
index 0000000..4e1e211
Binary files /dev/null and b/src/Plot2d/resources/plot2d_log_y.png differ
diff --git a/src/Plot2d/resources/plot2d_pan.png b/src/Plot2d/resources/plot2d_pan.png
new file mode 100755 (executable)
index 0000000..ec56cac
Binary files /dev/null and b/src/Plot2d/resources/plot2d_pan.png differ
diff --git a/src/Plot2d/resources/plot2d_points.png b/src/Plot2d/resources/plot2d_points.png
new file mode 100755 (executable)
index 0000000..4847c4e
Binary files /dev/null and b/src/Plot2d/resources/plot2d_points.png differ
diff --git a/src/Plot2d/resources/plot2d_settings.png b/src/Plot2d/resources/plot2d_settings.png
new file mode 100755 (executable)
index 0000000..d291da9
Binary files /dev/null and b/src/Plot2d/resources/plot2d_settings.png differ
diff --git a/src/Plot2d/resources/plot2d_splines.png b/src/Plot2d/resources/plot2d_splines.png
new file mode 100755 (executable)
index 0000000..c39d432
Binary files /dev/null and b/src/Plot2d/resources/plot2d_splines.png differ
diff --git a/src/Plot2d/resources/plot2d_zoom.png b/src/Plot2d/resources/plot2d_zoom.png
new file mode 100755 (executable)
index 0000000..386c966
Binary files /dev/null and b/src/Plot2d/resources/plot2d_zoom.png differ
diff --git a/src/Prs/Prs.pro b/src/Prs/Prs.pro
new file mode 100644 (file)
index 0000000..06b1455
--- /dev/null
@@ -0,0 +1,20 @@
+TEMPLATE = lib
+
+DESTDIR = ../../$(CONFIG_ID)/lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../$(CONFIG_ID)/obj/$$TARGET
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += PRS_EXPORTS
+
+HEADERS  = *.h
+
+SOURCES  = *.cxx
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+INSTALLS += includes
diff --git a/src/Prs/SALOME_Prs.cxx b/src/Prs/SALOME_Prs.cxx
new file mode 100755 (executable)
index 0000000..2e685e8
--- /dev/null
@@ -0,0 +1,274 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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
+//
+// File:       SALOME_Prs.cxx
+// Created:    Wed Apr 28 15:03:43 2004
+// Author:     Sergey ANIKIN
+//             <san@startrex.nnov.opencascade.com>
+
+
+#include "SALOME_Prs.h"
+
+//#include "utilities.h"
+
+//using namespace std;
+
+/*!
+  Dispatches display operation to proper Display() method of SALOME_View
+*/
+void SALOME_OCCPrs::DisplayIn( SALOME_View* v ) const
+{
+  if ( v ) v->Display( this );
+}
+
+/*!
+  Dispatches display operation to proper Erase() method of SALOME_View
+*/
+void SALOME_OCCPrs::EraseIn( SALOME_View* v, const bool forced ) const
+{
+  if ( v ) v->Erase( this, forced );
+}
+
+/*!
+  Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
+void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
+{
+  if ( v ) v->LocalSelection( this, mode );
+}
+
+/*!
+   Dispatches update operation to proper Update() method of SALOME_Displayer
+*/
+void SALOME_OCCPrs::Update( SALOME_Displayer* d )
+{
+  if ( d ) d->Update( this );
+}
+
+/*!
+  Dispatches display operation to proper Display() method of SALOME_View
+*/
+void SALOME_VTKPrs::DisplayIn( SALOME_View* v ) const
+{
+  if ( v ) v->Display( this );
+}
+
+/*!
+  Dispatches display operation to proper Erase() method of SALOME_View
+*/
+void SALOME_VTKPrs::EraseIn( SALOME_View* v, const bool forced ) const
+{
+  if ( v ) v->Erase( this, forced );
+}
+
+/*!
+  Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
+void SALOME_VTKPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
+{
+  if ( v ) v->LocalSelection( this, mode );
+}
+
+/*!
+  Dispatches update operation to proper Update() method of SALOME_Displayer
+*/
+void SALOME_VTKPrs::Update( SALOME_Displayer* d )
+{
+  if ( d ) d->Update( this );
+}
+
+/*!
+  Dispatches display operation to proper Display() method of SALOME_View
+*/
+void SALOME_Prs2d::DisplayIn( SALOME_View* v ) const
+{
+  if ( v ) v->Display( this );
+}
+
+/*!
+  Dispatches display operation to proper Erase() method of SALOME_View
+*/
+void SALOME_Prs2d::EraseIn( SALOME_View* v, const bool forced ) const
+{
+  if ( v ) v->Erase( this, forced );
+}
+
+/*!
+  Dispatches operation to proper LocalSelectionIn() method of SALOME_View
+*/
+void SALOME_Prs2d::LocalSelectionIn( SALOME_View* v, const int mode ) const
+{
+  if ( v ) v->LocalSelection( this, mode );
+}
+
+/*!
+  Dispatches update operation to proper Update() method of SALOME_Displayer
+*/
+void SALOME_Prs2d::Update( SALOME_Displayer* d )
+{
+  if ( d ) d->Update( this );
+}
+
+/*!
+  Gives control to SALOME_Prs object, so that it could perform double dispatch
+*/
+void SALOME_View::Display( const SALOME_Prs* prs )
+{
+  prs->DisplayIn( this );
+}
+
+/*!
+  Gives control to SALOME_Prs object, so that it could perform double dispatch
+*/
+void SALOME_View::Erase( const SALOME_Prs* prs, const bool forced )
+{
+  prs->EraseIn( this, forced );
+}
+
+/*!
+  Gives control to SALOME_Prs object, so that it could perform double dispatch
+*/
+void SALOME_View::LocalSelection( const SALOME_Prs* prs, const int mode )
+{
+  prs->LocalSelectionIn( this, mode );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::Display( const SALOME_OCCPrs* )
+{
+//  MESSAGE( "SALOME_View::Display( const SALOME_OCCPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::Display( const SALOME_VTKPrs* )
+{
+//  MESSAGE( "SALOME_View::Display( const SALOME_VTKPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::Display( const SALOME_Prs2d* )
+{
+//  MESSAGE( "SALOME_View::Display( const SALOME_Prs2d& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::Erase( const SALOME_OCCPrs*, const bool )
+{
+//  MESSAGE( "SALOME_View::Erase( const SALOME_OCCPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::Erase( const SALOME_VTKPrs*, const bool )
+{
+//  MESSAGE( "SALOME_View::Erase( const SALOME_VTKPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::Erase( const SALOME_Prs2d*, const bool )
+{
+//  MESSAGE( "SALOME_View::Erase( const SALOME_Prs2d& ) called! Probably, presentation is being erased in uncompatible viewframe." );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::EraseAll( const bool )
+{
+//  MESSAGE( "SALOME_View::EraseAll() called!" );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const int )
+{
+//  MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called!
+//   Probably, selection is being activated in uncompatible viewframe." );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::LocalSelection( const SALOME_VTKPrs*, const int )
+{
+//  MESSAGE( "SALOME_View::LocalSelection( const SALOME_VTKPrs* ) called!
+//   Probably, selection is being activated in uncompatible viewframe." );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::LocalSelection( const SALOME_Prs2d*, const int )
+{
+//  MESSAGE( "SALOME_View::LocalSelection( const SALOME_Prs2d* ) called!
+//   Probably, selection is being activated in uncompatible viewframe." );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_View::GlobalSelection( const bool ) const
+{
+//  MESSAGE( "SALOME_View::GlobalSelection() called!
+//   Probably, selection is being activated in uncompatible viewframe." );
+}
+
+/*!
+  Gives control to SALOME_Prs object, so that it could perform double dispatch
+*/
+void SALOME_Displayer::UpdatePrs( SALOME_Prs* prs )
+{
+  prs->Update( this );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_Displayer::Update( SALOME_OCCPrs* )
+{
+//  MESSAGE( "SALOME_Displayer::Update( SALOME_OCCPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_Displayer::Update( SALOME_VTKPrs* )
+{
+//  MESSAGE( "SALOME_Displayer::Update( SALOME_VTKPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
+}
+
+/*!
+  Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
+*/
+void SALOME_Displayer::Update( SALOME_Prs2d* )
+{
+//  MESSAGE( "SALOME_Displayer::Update( SALOME_Prs2d* ) called! Probably, presentation is being updated in uncompatible viewframe." );
+}
+
diff --git a/src/Prs/SALOME_Prs.h b/src/Prs/SALOME_Prs.h
new file mode 100755 (executable)
index 0000000..ba8562c
--- /dev/null
@@ -0,0 +1,240 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 SALOME_PRS_H
+#define SALOME_PRS_H
+
+#ifdef WIN32
+#ifdef PRS_EXPORTS
+#define PRS_EXPORT __declspec(dllexport)
+#else
+#define PRS_EXPORT __declspec(dllimport)
+#endif
+#else
+#define PRS_EXPORT
+#endif
+
+class SALOME_View;
+class SALOME_Displayer;
+class Handle_SALOME_InteractiveObject;
+
+/*!
+ \class SALOME_Prs
+ Base class for SALOME graphic object wrappers - presentations.
+ Presentations are temporary objects, so they can be created on the stack.
+*/
+
+class PRS_EXPORT SALOME_Prs
+{
+public:
+  //! Destructor
+  virtual ~SALOME_Prs() {}
+
+  //! Key method for double dispatch of display operation
+  virtual void DisplayIn( SALOME_View* ) const = 0;
+
+  //! Key method for double dispatch of erase operation
+  virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
+
+  //! Key method for double dispatch of update operation
+  virtual void Update( SALOME_Displayer* ) = 0;
+
+  //! Should return true, if this presentation contains a graphic object
+  virtual bool IsNull() const = 0;
+
+  //! Key method for double dispatch of activation of subshapes selection
+  virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
+};
+
+/*!
+ \class SALOME_OCCPrs
+ Base class for OpenCASCADE graphic object (AIS_InteractiveObject) wrappers.
+ This intermediate class is necessary to avoid dependencies from OCC libs.
+*/
+
+class PRS_EXPORT SALOME_OCCPrs : public SALOME_Prs
+{
+public:
+  //! It uses double dispatch in order to \n
+  //! invoke Display() method corresponding to the actual type of presentation.
+  virtual void DisplayIn( SALOME_View* ) const;
+
+  //! It uses double dispatch in order to \n
+  //! invoke Erase() method corresponding to the actual type of presentation.
+  virtual void EraseIn( SALOME_View*, const bool = false ) const;
+
+  //! It uses double dispatch in order to \n
+  //! invoke Update() method corresponding to the actual type of presentation.
+  virtual void Update( SALOME_Displayer* );
+
+  //! Key method for double dispatch of activation of subshapes selection
+  virtual void LocalSelectionIn( SALOME_View*, const int ) const;
+};
+
+/*!
+ \class SALOME_VTKPrs
+ Base class for VTK graphic object (vtkActor) wrappers.
+ This intermediate class is necessary to avoid dependencies from VTK libs.
+*/
+class PRS_EXPORT SALOME_VTKPrs : public SALOME_Prs
+{
+public:
+  //! It uses double dispatch in order to \n
+  //! invoke Display() method corresponding to the actual type of presentation.
+  virtual void DisplayIn( SALOME_View* ) const;
+
+  //! It uses double dispatch in order to \n
+  //! invoke Erase() method corresponding to the actual type of presentation.
+  virtual void EraseIn( SALOME_View*, const bool = false ) const;
+
+  //! It uses double dispatch in order to \n
+  //! invoke Update() method corresponding to the actual type of presentation.
+  virtual void Update( SALOME_Displayer* );
+
+  //! Key method for double dispatch of activation of subshapes selection
+  virtual void LocalSelectionIn( SALOME_View*, const int ) const;
+};
+
+/*!
+ \class SALOME_Prs2d
+ Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
+*/
+class PRS_EXPORT SALOME_Prs2d : public SALOME_Prs
+{
+public:
+  //! It uses double dispatch in order to
+  //! invoke Display() method corresponding to the actual type of presentation.
+  virtual void DisplayIn( SALOME_View* ) const;
+
+  //! It uses double dispatch in order to
+  //! invoke Erase() method corresponding to the actual type of presentation.
+  virtual void EraseIn( SALOME_View*, const bool = false ) const;
+
+  //! It uses double dispatch in order to
+  //! invoke Update() method corresponding to the actual type of presentation.
+  virtual void Update( SALOME_Displayer* );
+
+  //! Key method for double dispatch of activation of subshapes selection
+  virtual void LocalSelectionIn( SALOME_View*, const int ) const;
+};
+
+/*!
+  Base classes for object wrappers for any other visualization libraries should be added here!
+*/
+/*!
+ \class SALOME_View
+ Base class for SALOME views (or view frames)
+*/
+class PRS_EXPORT SALOME_View
+{
+public:
+  //! Destructor
+  virtual ~SALOME_View() {}
+
+  //! This Display() method should be called to display given presentation \n
+  //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
+  //! so that it could perform double dispatch.
+  void Display( const SALOME_Prs* );
+
+  //! This Erase() method should be called to erase given presentation \n
+  //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
+  //! so that it could perform double dispatch.
+  void Erase( const SALOME_Prs*, const bool = false );
+
+  //! This LocalSelection() method should be called to activate sub-shapes selection \n
+  //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
+  //! so that it could perform double dispatch.
+  void LocalSelection( const SALOME_Prs*, const int );
+
+  // Interface for derived views
+
+  // Display() methods for ALL kinds of presentation should appear here
+  virtual void Display( const SALOME_OCCPrs* );//!< Display SALOME_OCCPrs presentation.
+  virtual void Display( const SALOME_VTKPrs* );//!< Display SALOME_VTKPrs presentation.
+  virtual void Display( const SALOME_Prs2d* );//!< Display SALOME_Prs2d presentation.
+  // Add new Display() methods here...
+
+  // Erase() methods for ALL kinds of presentation should appear here
+  virtual void Erase( const SALOME_OCCPrs*, const bool = false );//!< Erase SALOME_OCCPrs
+  virtual void Erase( const SALOME_VTKPrs*, const bool = false );//!< Erase SALOME_VTKPrs
+  virtual void Erase( const SALOME_Prs2d*, const bool = false );//!< Erase SALOME_Prs2d
+  virtual void EraseAll( const bool = false );
+  // Add new Erase() methods here...
+
+  // LocalSelection() methods for ALL kinds of presentation should appear here
+  virtual void LocalSelection( const SALOME_OCCPrs*, const int );//!< Local selection SALOME_OCCPrs
+  virtual void LocalSelection( const SALOME_VTKPrs*, const int );//!< Local selection SALOME_VTKPrs
+  virtual void LocalSelection( const SALOME_Prs2d* , const int );//!< Local selection SALOME_Prs2d
+
+  //! Deactivates selection of sub-shapes (must be redefined with OCC viewer)
+  virtual void GlobalSelection( const bool = false ) const;
+
+  //! Creates empty presenation of corresponding type
+  virtual SALOME_Prs* CreatePrs( const char* /*entry*/ = 0 ) { return 0; }
+
+  // Axiluary methods called before and after displaying of objects
+  virtual void BeforeDisplay( SALOME_Displayer* ) {} //!< Null body here
+  virtual void AfterDisplay ( SALOME_Displayer* ) {} //!< Null body here
+
+  // New methods (asv)
+  //! \retval Return false.
+  virtual bool isVisible( const Handle_SALOME_InteractiveObject& ){ return false; }
+  virtual void Repaint() {} //!< Null body here.
+};
+
+/*!
+ \class SALOME_Displayer
+ These classes are used to specify type of view VTK, OCC or Plot2d
+*/
+class PRS_EXPORT SALOME_OCCViewType    {};
+class PRS_EXPORT SALOME_VTKViewType    {};
+class PRS_EXPORT SALOME_Plot2dViewType {};
+
+/*!
+ \class SALOME_Displayer
+ Base class for SALOME displayers
+*/
+class PRS_EXPORT SALOME_Displayer
+{
+public:
+  //! Destructor
+  virtual ~SALOME_Displayer() {/*! Null body here*/}
+
+  //! This Update() method should be called to update given presentation \n
+  //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
+  //! so that it could perform double dispatch.
+  void UpdatePrs( SALOME_Prs* );
+
+  // Interface for derived displayers
+
+  // Update() methods for ALL kinds of presentation should appear here
+  virtual void Update( SALOME_OCCPrs* );//!< Update SALOME_OCCPrs presentation.
+  virtual void Update( SALOME_VTKPrs* );//!< Update SALOME_VTKPrs presentation.
+  virtual void Update( SALOME_Prs2d* );//!< Update SALOME_Prs2d presentation.
+  // Add new Update() methods here...
+
+  // Axiluary methods called before and after displaying of objects
+  virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType&    ){/*! Null body here*/};
+  virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType&    ){/*! Null body here*/};
+  virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKViewType&    ){/*! Null body here*/};
+  virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKViewType&    ){/*! Null body here*/};
+  virtual void BeforeDisplay( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};
+  virtual void AfterDisplay ( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};
+};
+
+#endif
diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx
new file mode 100644 (file)
index 0000000..7f17c27
--- /dev/null
@@ -0,0 +1,819 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_Actor.cxx
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+/*!
+  \class SALOME_Actor SALOME_Actor.h
+  \brief Abstract class of SALOME Objects in VTK.
+*/
+
+
+#include "SALOME_Actor.h"
+#include "SALOME_InteractiveObject.hxx"
+
+#include "VTKViewer_Transform.h"
+#include "VTKViewer_TransformFilter.h"
+#include "VTKViewer_GeometryFilter.h"
+#include "SVTK_RectPicker.h"
+
+#include "SVTK_Actor.h"
+
+// VTK Includes
+#include <vtkCell.h>
+#include <vtkLine.h>
+#include <vtkPicker.h>
+#include <vtkPointPicker.h>
+#include <vtkCellPicker.h>
+#include <vtkRenderer.h>
+#include <vtkPolyData.h>
+#include <vtkObjectFactory.h>
+#include <vtkDataSetMapper.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkProperty.h>
+#include <vtkOutlineSource.h>
+
+#include <vtkInteractorStyle.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkPassThroughFilter.h>
+
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+using namespace std;
+
+#if defined __GNUC__
+  #if __GNUC__ == 2
+    #define __GNUC_2__
+  #endif
+#endif
+
+int SALOME_POINT_SIZE = 5;
+int SALOME_LINE_WIDTH = 3;
+
+namespace
+{
+  int
+  GetEdgeId(SALOME_Actor* theActor,
+           vtkPicker* thePicker, 
+           int theObjId)
+  {
+    int anEdgeId = 0;
+    if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) {
+      vtkFloatingPointType aPickPosition[3];
+      thePicker->GetPickPosition(aPickPosition);
+      vtkFloatingPointType aMinDist = 1000000.0, aDist = 0;
+      for (int i = 0, iEnd = aPickedCell->GetNumberOfEdges(); i < iEnd; i++){
+       if(vtkLine* aLine = vtkLine::SafeDownCast(aPickedCell->GetEdge(i))){
+         int subId;  
+         vtkFloatingPointType pcoords[3], closestPoint[3], weights[3];
+         aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights);
+         if (aDist < aMinDist) {
+           aMinDist = aDist;
+           anEdgeId = -1 - i;
+         }
+       }
+      }
+    }
+    return anEdgeId;
+  }
+
+  inline
+  bool
+  CheckDimensionId(Selection_Mode theMode, 
+                  SALOME_Actor *theActor, 
+                  vtkIdType theObjId)
+  {
+    switch(theMode){
+    case CellSelection:
+      return true;
+    case EdgeSelection:
+      return ( theActor->GetObjDimension( theObjId ) == 1 );
+    case FaceSelection:
+      return ( theActor->GetObjDimension( theObjId ) == 2 );
+    case VolumeSelection:
+      return ( theActor->GetObjDimension( theObjId ) == 3 );
+    };
+    return false;
+  }
+
+}
+
+
+vtkStandardNewMacro(SALOME_Actor);
+
+/*!
+  Constructor
+*/
+SALOME_Actor
+::SALOME_Actor():
+  myRenderer(NULL),
+  myInteractor(NULL),
+  mySelectionMode(ActorSelection),
+  myPreHighlightActor(SVTK_Actor::New()),
+  myHighlightActor(SVTK_Actor::New()),
+  myOutline(vtkOutlineSource::New()),
+  myOutlineActor(VTKViewer_Actor::New())
+{
+  myPreHighlightActor->Delete();
+  myPreHighlightActor->Initialize();
+  myPreHighlightActor->PickableOff();
+  myPreHighlightActor->SetVisibility( false );
+
+  myHighlightActor->Delete();
+  myHighlightActor->Initialize();
+  myHighlightActor->PickableOff();
+  myHighlightActor->SetVisibility( false );
+
+  myOutline->Delete();
+
+  vtkPolyDataMapper* anOutlineMapper = vtkPolyDataMapper::New();
+  anOutlineMapper->SetInput(myOutline->GetOutput());
+
+  myOutlineActor->Delete();
+  myOutlineActor->SetMapper( anOutlineMapper );
+  anOutlineMapper->Delete();
+
+  myOutlineActor->PickableOff();
+  myOutlineActor->DragableOff();
+  myOutlineActor->GetProperty()->SetColor(1.0,0.0,0.0);
+  myOutlineActor->GetProperty()->SetAmbient(1.0);
+  myOutlineActor->GetProperty()->SetDiffuse(0.0);
+  myOutlineActor->SetVisibility( false );
+}
+
+/*!
+  Destructor
+*/
+SALOME_Actor
+::~SALOME_Actor()
+{}
+
+
+/*!
+  \return true if the SALOME_Actor has a reference to SALOME_InteractiveObject
+*/
+Standard_Boolean 
+SALOME_Actor
+::hasIO() 
+{ 
+  return !myIO.IsNull(); 
+}
+
+/*!
+  \return correspoinding reference to SALOME_InteractiveObject
+*/
+const Handle(SALOME_InteractiveObject)& 
+SALOME_Actor
+::getIO()
+{ 
+  return myIO; 
+}
+
+/*!
+  Sets reference to SALOME_InteractiveObject
+  \param theIO - new SALOME_InteractiveObject
+*/
+void
+SALOME_Actor
+::setIO(const Handle(SALOME_InteractiveObject)& theIO) 
+{ 
+  myIO = theIO; 
+}
+
+/*!
+  Sets name the SALOME_Actor
+  \param theName - new name
+*/
+void
+SALOME_Actor
+::setName(const char* theName)
+{
+  if(hasIO())  
+    myIO->setName(theName);
+  Superclass::setName(theName);
+}
+
+
+/*!
+  Publishes the actor in all its internal devices
+*/
+void
+SALOME_Actor
+::AddToRender(vtkRenderer* theRenderer)
+{
+  Superclass::AddToRender(theRenderer);
+
+  myRenderer = theRenderer;
+
+  theRenderer->AddActor( myPreHighlightActor.GetPointer() );
+  theRenderer->AddActor( myHighlightActor.GetPointer() );
+  theRenderer->AddActor( myOutlineActor.GetPointer() );
+}
+
+/*!
+  Removes the actor from all its internal devices
+*/
+void 
+SALOME_Actor
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+  Superclass::RemoveFromRender(theRenderer);
+
+  theRenderer->RemoveActor( myPreHighlightActor.GetPointer() );
+  theRenderer->RemoveActor( myHighlightActor.GetPointer() );
+  theRenderer->RemoveActor( myOutlineActor.GetPointer() );
+}
+
+/*!
+  \return reference on renderer where it is published
+*/
+vtkRenderer*
+SALOME_Actor
+::GetRenderer()
+{
+  return myRenderer;
+}
+
+/*!
+  Sets interactor in order to use vtkInteractorObserver devices
+  \param theInteractor - new interactor
+*/
+void
+SALOME_Actor
+::SetInteractor(vtkRenderWindowInteractor* theInteractor)
+{
+  myInteractor = theInteractor;
+}
+
+/*!
+  Put a request to redraw the view 
+*/
+void
+SALOME_Actor
+::Update()
+{
+  myInteractor->CreateTimer(VTKI_TIMER_UPDATE);    
+}
+
+/*!
+  Apply view transformation
+  \param theTransform - transformation
+*/
+void
+SALOME_Actor
+::SetTransform(VTKViewer_Transform* theTransform)
+{
+  Superclass::SetTransform(theTransform);
+
+  myPreHighlightActor->SetTransform(theTransform);
+  myHighlightActor->SetTransform(theTransform);
+  myOutlineActor->SetTransform(theTransform);
+}
+
+/*!
+  Apply additional position
+*/
+void
+SALOME_Actor
+::SetPosition(vtkFloatingPointType _arg1, 
+             vtkFloatingPointType _arg2, 
+             vtkFloatingPointType _arg3)
+{
+  Superclass::SetPosition(_arg1,_arg2,_arg3);
+
+  myPreHighlightActor->SetPosition(_arg1,_arg2,_arg3);
+  myHighlightActor->SetPosition(_arg1,_arg2,_arg3);
+  myOutlineActor->SetPosition(_arg1,_arg2,_arg3);
+}
+
+/*!
+  Apply additional position
+*/
+void
+SALOME_Actor
+::SetPosition(vtkFloatingPointType _arg[3])
+{
+  SetPosition(_arg[0],_arg[1],_arg[2]);
+}
+
+/*!
+  Shows/hides actor
+  \param theVisibility - new visibility state
+*/
+void
+SALOME_Actor
+::SetVisibility( int theVisibility )
+{
+  Superclass::SetVisibility( theVisibility );
+
+  myOutlineActor->SetVisibility( theVisibility && isHighlighted() && !hasHighlight() );
+
+  myPreHighlightActor->SetVisibility( theVisibility && myIsPreselected );
+
+  if(mySelector.GetPointer() && hasIO()){
+    if(mySelector->SelectionMode() != ActorSelection){
+      int aHasIndex = mySelector->HasIndex( getIO() );
+      myHighlightActor->SetVisibility( theVisibility && isHighlighted() && aHasIndex);
+    }
+  }
+}
+
+/*!
+  Set selector in order to the actor at any time can restore current selection
+  \param theSelector - new selector
+*/
+void
+SALOME_Actor
+::SetSelector(SVTK_Selector* theSelector)
+{
+  mySelector = theSelector;
+}
+
+/*!
+  To map current selection to VTK representation
+*/
+void
+SALOME_Actor
+::Highlight(bool theIsHighlight)
+{
+  mySelectionMode = mySelector->SelectionMode();
+  myHighlightActor->SetVisibility( false );
+  myOutlineActor->SetVisibility( false );
+
+  if(mySelector.GetPointer()){
+    if(mySelectionMode != ActorSelection){
+      TColStd_IndexedMapOfInteger aMapIndex;
+      mySelector->GetIndex( getIO(), aMapIndex );
+      switch( mySelectionMode ){
+      case NodeSelection:
+       myHighlightActor->GetProperty()->SetRepresentationToPoints();
+       myHighlightActor->MapPoints( this, aMapIndex );
+       break;
+      case EdgeOfCellSelection:
+       myHighlightActor->GetProperty()->SetRepresentationToWireframe();
+       myHighlightActor->MapEdge( this, aMapIndex );
+       break;
+      case CellSelection:
+      case EdgeSelection:
+      case FaceSelection:
+      case VolumeSelection:
+       myHighlightActor->GetProperty()->SetRepresentationToSurface();
+       myHighlightActor->MapCells( this, aMapIndex );
+       break;
+      }
+      myHighlightActor->SetVisibility( GetVisibility() && theIsHighlight );
+    }
+  }
+
+  highlight(theIsHighlight);
+}
+
+/*!
+  Updates visibility of the highlight devices  
+*/
+void
+SALOME_Actor
+::highlight(bool theIsHighlight)
+{
+  vtkFloatingPointType aBounds[6];
+  GetInput()->GetBounds(aBounds);
+  myOutline->SetBounds(aBounds);
+  myOutlineActor->SetVisibility( GetVisibility() && theIsHighlight );
+
+  Superclass::highlight(theIsHighlight);
+}
+
+
+/*!
+  To process prehighlight (called from SVTK_InteractorStyle)
+*/
+bool
+SALOME_Actor
+::PreHighlight(vtkInteractorStyle *theInteractorStyle, 
+              SVTK_SelectionEvent* theSelectionEvent,
+              bool theIsHighlight)
+{
+  if ( !GetPickable() )
+    return false;
+
+  vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
+  //
+  myPreHighlightActor->SetVisibility( false );
+  bool anIsPreselected = myIsPreselected;
+  
+  Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
+  bool anIsChanged = (mySelectionMode != aSelectionMode);
+
+  vtkFloatingPointType x = theSelectionEvent->myX;
+  vtkFloatingPointType y = theSelectionEvent->myY;
+  vtkFloatingPointType z = 0.0;
+
+  if( !theIsHighlight ) {
+    SetPreSelected( false );
+    vtkActorCollection* theActors = aRenderer->GetActors();
+    theActors->InitTraversal();
+    while( vtkActor *ac = theActors->GetNextActor() )
+      if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) )
+       if( anActor->hasIO() && myIO->isSame( anActor->getIO() ) )
+         anActor->SetPreSelected( false );
+
+  }else{
+    switch(aSelectionMode){
+    case NodeSelection: 
+    {
+      myPointPicker->Pick( x, y, z, aRenderer );
+      
+      int aVtkId = myPointPicker->GetPointId();
+      if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) ) {
+       int anObjId = GetNodeObjId( aVtkId );
+       myIsPreselected = (anObjId >= 0);
+       if(myIsPreselected){
+         const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
+         int anExtent = aMapIndex.Extent();
+         anIsChanged |= (anExtent == 0 || anExtent > 0 && anObjId != aMapIndex(1));
+         if(anIsChanged){
+           TColStd_IndexedMapOfInteger aMapIndex;
+           aMapIndex.Add( anObjId );
+           
+           myPreHighlightActor->GetProperty()->SetRepresentationToPoints();
+           myPreHighlightActor->MapPoints( this, aMapIndex );
+         }
+         myPreHighlightActor->SetVisibility( true );
+       }
+      }
+      break;
+    }
+    case CellSelection: 
+    case EdgeSelection:
+    case FaceSelection:
+    case VolumeSelection: 
+    {
+      myCellPicker->Pick( x, y, z, aRenderer );
+      
+      int aVtkId = myCellPicker->GetCellId();
+      if ( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) && hasIO() ) {
+       int anObjId = GetElemObjId (aVtkId );
+       if ( anObjId >= 0 ) {
+         myIsPreselected = CheckDimensionId(aSelectionMode,this,anObjId);
+         if(myIsPreselected){
+           const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
+           int anExtent = aMapIndex.Extent();
+           anIsChanged |= (anExtent == 0 || anExtent > 0 && anObjId != aMapIndex(1));
+           if(anIsChanged){
+             TColStd_IndexedMapOfInteger aMapIndex;
+             aMapIndex.Add( anObjId );
+             
+             myPreHighlightActor->GetProperty()->SetRepresentationToSurface();
+             myPreHighlightActor->MapCells( this, aMapIndex );
+           }
+           myPreHighlightActor->SetVisibility( true );
+         }
+       }
+      }
+      break;
+    }
+    case EdgeOfCellSelection:
+    {
+      myCellPicker->Pick( x, y, z, aRenderer );
+      
+      int aVtkId = myCellPicker->GetCellId();
+      if ( aVtkId >= 0 && mySelector->IsValid( this, aVtkId )) {
+       int anObjId = GetElemObjId( aVtkId );
+       if ( anObjId >= 0 ) {
+         int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId);
+         myIsPreselected = anEdgeId < 0;
+         if(myIsPreselected){
+           const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
+           int anExtent = aMapIndex.Extent();
+           anIsChanged |= (anExtent == 0);
+           anIsChanged |= (anExtent == 2 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2)));
+           if(anIsChanged){
+             TColStd_IndexedMapOfInteger aMapIndex;
+             aMapIndex.Add( anObjId );
+             aMapIndex.Add( anEdgeId );
+
+             myPreHighlightActor->GetProperty()->SetRepresentationToWireframe();
+             myPreHighlightActor->MapEdge( this, aMapIndex );
+           }
+           myPreHighlightActor->SetVisibility( true );
+         }
+       }
+      }
+      break;
+    }
+    case ActorSelection : 
+    {
+      if( !mySelector->IsSelected( myIO ) ) {
+       SetPreSelected( true );
+
+       vtkActorCollection* theActors = aRenderer->GetActors();
+       theActors->InitTraversal();
+       while( vtkActor *anAct = theActors->GetNextActor() ) {
+         if( anAct != this )
+           if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( anAct ) )
+             if( anActor->hasIO() && myIO->isSame( anActor->getIO() ) )
+               anActor->SetPreSelected( true );
+       }
+      }
+    }
+    default:
+      break;
+    }
+  }
+
+  mySelectionMode = aSelectionMode;
+  anIsChanged |= (anIsPreselected != myIsPreselected);
+
+  return anIsChanged;
+}
+
+/*!
+  To process highlight (called from SVTK_InteractorStyle)
+*/
+bool
+SALOME_Actor
+::Highlight(vtkInteractorStyle *theInteractorStyle, 
+           SVTK_SelectionEvent* theSelectionEvent,
+           bool theIsHighlight)
+{
+  if ( !GetPickable() )
+    return false;
+
+  myOutlineActor->SetVisibility( false );
+  myHighlightActor->SetVisibility( false );
+
+  vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
+  //
+  Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
+  bool anIsShift = theSelectionEvent->myIsShift;
+  if( !anIsShift || !theIsHighlight ) {
+    mySelector->RemoveIObject( this );
+  }
+
+  if ( !theIsHighlight )
+    return true;
+
+  vtkFloatingPointType x = theSelectionEvent->myX;
+  vtkFloatingPointType y = theSelectionEvent->myY;
+  vtkFloatingPointType z = 0.0;
+
+  if( !theSelectionEvent->myIsRectangle ) {
+    switch(aSelectionMode){
+    case NodeSelection: {
+      myPointPicker->Pick( x, y, z, aRenderer );
+
+      int aVtkId = myPointPicker->GetPointId();
+      if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) ) {
+       int anObjId = GetNodeObjId( aVtkId );
+       if( anObjId >= 0 ) {
+         mySelector->AddOrRemoveIndex( myIO, anObjId, anIsShift );
+         mySelector->AddIObject( this );
+       }
+      }
+      break;
+    }
+    case CellSelection: 
+    case EdgeSelection:
+    case FaceSelection:
+    case VolumeSelection: 
+    {
+      myCellPicker->Pick( x, y, z, aRenderer );
+    
+      int aVtkId = myCellPicker->GetCellId();
+      if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) ) {
+       int anObjId = GetElemObjId( aVtkId );
+       if( anObjId >= 0 ) {
+         if ( CheckDimensionId(aSelectionMode,this,anObjId) ) {
+           mySelector->AddOrRemoveIndex( myIO, anObjId, anIsShift );
+           mySelector->AddIObject( this );
+         }
+       }
+      }
+      break;
+    }
+    case EdgeOfCellSelection: 
+    {
+      myCellPicker->Pick( x, y, z, aRenderer );
+    
+      int aVtkId = myCellPicker->GetCellId();
+      if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) ) {
+       int anObjId = GetElemObjId( aVtkId );
+       if( anObjId >= 0 ) {
+         int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId);
+         if( anEdgeId < 0 ) {
+           mySelector->AddOrRemoveIndex( myIO, anObjId, false );
+           mySelector->AddOrRemoveIndex( myIO, anEdgeId, true );
+           mySelector->AddIObject( this );
+         } 
+       }
+      }
+      break;
+    }
+    case ActorSelection : 
+    {
+      if( mySelector->IsSelected( myIO ) && anIsShift )
+       mySelector->RemoveIObject( this );
+      else {
+       mySelector->AddIObject( this );
+      }
+      break;
+    }
+    default:
+      break;
+    }
+  }else{
+    vtkFloatingPointType xLast = theSelectionEvent->myLastX;
+    vtkFloatingPointType yLast = theSelectionEvent->myLastY;
+    vtkFloatingPointType zLast = 0.0;
+
+    vtkFloatingPointType x1 = x < xLast ? x : xLast;
+    vtkFloatingPointType y1 = y < yLast ? y : yLast;
+    vtkFloatingPointType z1 = z < zLast ? z : zLast;
+    vtkFloatingPointType x2 = x > xLast ? x : xLast;
+    vtkFloatingPointType y2 = y > yLast ? y : yLast;
+    vtkFloatingPointType z2 = z > zLast ? z : zLast;
+
+    switch(aSelectionMode){
+    case NodeSelection: {
+      myPointRectPicker->InitializePickList();
+      myPointRectPicker->AddPickList(this);
+      myPointRectPicker->Pick( x1, y1, z1, x2, y2, z2, aRenderer );
+
+      const SVTK_RectPicker::TVectorIdsMap& aVectorIdsMap = myPointRectPicker->GetPointIdsMap();
+      SVTK_RectPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this);
+      TColStd_MapOfInteger anIndexes;
+      if(aMapIter != aVectorIdsMap.end()){
+       const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
+       vtkIdType anEnd = aVectorIds.size();
+       for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
+         int aPointId = aVectorIds[anId];
+         if( aPointId >= 0 && mySelector->IsValid( this, aPointId, true ) ) {
+           int anObjId = GetNodeObjId( aPointId );
+           anIndexes.Add( anObjId );
+         }
+       }
+      }
+      
+      if( !anIndexes.IsEmpty() ) {
+       mySelector->AddOrRemoveIndex( myIO, anIndexes, anIsShift );
+       mySelector->AddIObject( this );
+       anIndexes.Clear();
+      }
+      else
+       mySelector->RemoveIObject( this );
+
+      break;
+    }
+    case ActorSelection :
+    {
+      vtkFloatingPointType aPnt[3];
+      vtkFloatingPointType* aBounds = GetBounds();
+
+      bool anIsPicked = true;
+      for( int i = 0; i <= 1; i++ ) {
+       for( int j = 2; j <= 3; j++ ) {
+         for( int k = 4; k <= 5; k++ ) {
+           aRenderer->SetWorldPoint( aBounds[ i ], aBounds[ j ], aBounds[ k ], 1.0 );
+           aRenderer->WorldToDisplay();
+           aRenderer->GetDisplayPoint( aPnt );
+
+           if( aPnt[0] < x1 || aPnt[0] > x2 || aPnt[1] < y1 || aPnt[1] > y2 ) {
+             anIsPicked = false;
+             break;
+           }
+         }
+       }
+      }
+
+      if( anIsPicked )
+       mySelector->AddIObject(this);
+
+      break;
+    }
+    case CellSelection: 
+    case EdgeSelection:
+    case FaceSelection:
+    case VolumeSelection: 
+    {
+      myCellRectPicker->InitializePickList();
+      myCellRectPicker->AddPickList(this);
+      myCellRectPicker->Pick( x1, y1, z1, x2, y2, z2, aRenderer );
+
+      const SVTK_RectPicker::TVectorIdsMap& aVectorIdsMap = myCellRectPicker->GetCellIdsMap();
+      SVTK_RectPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this);
+      TColStd_MapOfInteger anIndexes;
+      if(aMapIter != aVectorIdsMap.end()){
+       const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
+       vtkIdType anEnd = aVectorIds.size();
+       for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
+         int aCellId = aVectorIds[anId];
+         if ( !mySelector->IsValid( this, aCellId ) )
+           continue;
+
+         int anObjId = GetElemObjId( aCellId );
+         if( anObjId != -1 )
+           if ( CheckDimensionId(aSelectionMode,this,anObjId) ) {
+             anIndexes.Add(anObjId);
+           }
+       }
+      }
+      mySelector->AddOrRemoveIndex( myIO, anIndexes, anIsShift );
+      mySelector->AddIObject( this );
+    }
+    default:
+      break;
+    }
+  }
+
+  mySelectionMode = aSelectionMode;
+
+  return true;
+}
+
+/*!
+  To set up a picker for nodal selection (initialized by SVTK_Renderer::AddActor)
+  \param thePointPicker - new picker
+*/
+void
+SALOME_Actor
+::SetPointPicker(vtkPointPicker* thePointPicker) 
+{
+  myPointPicker = thePointPicker;
+}
+
+/*!
+  To set up a picker for cell selection (initialized by SVTK_Renderer::AddActor)
+  \param theCellPicker - new picker
+*/
+void
+SALOME_Actor
+::SetCellPicker(vtkCellPicker* theCellPicker) 
+{
+  myCellPicker = theCellPicker;
+}
+
+/*!
+  To set up a picker for point rectangle selection (initialized by SVTK_Renderer::AddActor)
+  \param theRectPicker - new picker
+*/
+void
+SALOME_Actor
+::SetPointRectPicker(SVTK_RectPicker* theRectPicker) 
+{
+  myPointRectPicker = theRectPicker;
+}
+
+/*!
+  To set up a picker for cell rectangle selection (initialized by SVTK_Renderer::AddActor)
+  \param theRectPicker - new picker
+*/
+void
+SALOME_Actor
+::SetCellRectPicker(SVTK_RectPicker* theRectPicker) 
+{
+  myCellRectPicker = theRectPicker;
+}
+
+/*!
+  To set up a prehighlight property (initialized by SVTK_Renderer::AddActor)
+*/
+void
+SALOME_Actor
+::SetPreHighlightProperty(vtkProperty* theProperty) 
+{
+  myPreHighlightActor->SetProperty(theProperty);
+}
+
+/*!
+  To set up a highlight property (initialized by SVTK_Renderer::AddActor)
+*/
+void
+SALOME_Actor
+::SetHighlightProperty(vtkProperty* theProperty) 
+{
+  myHighlightActor->SetProperty(theProperty);
+}
diff --git a/src/SVTK/SALOME_Actor.h b/src/SVTK/SALOME_Actor.h
new file mode 100644 (file)
index 0000000..db4e2e5
--- /dev/null
@@ -0,0 +1,238 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_Actor.h
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+#ifndef SALOME_ACTOR_H
+#define SALOME_ACTOR_H
+
+#include "SVTK_SelectionEvent.h"
+#include "SVTK_Selector.h"
+#include "SVTK.h"
+
+class Handle(SALOME_InteractiveObject);
+
+// undefining min and max because CASCADE's defines them and
+// it clashes with std::min(), std::max()
+#undef min
+#undef max
+
+#include "VTKViewer_Actor.h"
+
+#include <vtkSmartPointer.h>
+
+class vtkPointPicker;
+class vtkCellPicker;
+class vtkOutlineSource;
+class vtkInteractorStyle;
+class vtkRenderWindowInteractor;
+
+class SVTK_Actor;
+class SVTK_RectPicker;
+class SVTK_InteractorStyle;
+
+extern int SALOME_POINT_SIZE;
+extern int SALOME_LINE_WIDTH;
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+//! The class is a basic one for all SALOME VTK presentation.
+/*!
+  It provide highlight and prehighlight capabilites,
+  common way to publish and remove VTK presentation, 
+  mapping of VTK and object IDs and so on.
+ */
+class SVTK_EXPORT SALOME_Actor : public VTKViewer_Actor 
+{
+ public:
+  static SALOME_Actor* New();
+  
+  vtkTypeMacro(SALOME_Actor,VTKViewer_Actor);
+
+  //----------------------------------------------------------------------------
+  //! To check, if the #SALOME_Actor has a reference to #SALOME_InteractiveObject
+  virtual
+  Standard_Boolean 
+  hasIO();
+
+  //! Get correspoinding reference to #SALOME_InteractiveObject
+  virtual 
+  const Handle(SALOME_InteractiveObject)& 
+  getIO(); 
+
+  //! Set reference to #SALOME_InteractiveObject
+  virtual
+  void
+  setIO(const Handle(SALOME_InteractiveObject)& theIO);
+
+  //! Name the #SALOME_Actor
+  virtual
+  void
+  setName(const char* theName);
+
+  //----------------------------------------------------------------------------
+  //! Apply view transformation
+  virtual
+  void
+  SetTransform(VTKViewer_Transform* theTransform); 
+
+  //! Apply additional position
+  virtual
+  void
+  SetPosition(vtkFloatingPointType _arg1, 
+             vtkFloatingPointType _arg2, 
+             vtkFloatingPointType _arg3);
+
+  //! Apply additional position
+  virtual
+  void
+  SetPosition(vtkFloatingPointType _arg[3]);
+
+  //----------------------------------------------------------------------------
+  //! Visibility management
+  virtual
+  void
+  SetVisibility( int );
+
+  //----------------------------------------------------------------------------
+  //! To publish the actor an all its internal devices
+  virtual
+  void
+  AddToRender(vtkRenderer* theRendere); 
+
+  //! To remove the actor an all its internal devices
+  virtual
+  void
+  RemoveFromRender(vtkRenderer* theRendere);
+
+  //! Get reference on renderer where it is published
+  vtkRenderer*
+  GetRenderer();
+
+  //----------------------------------------------------------------------------
+  //! To set interactor in order to use #vtkInteractorObserver devices
+  virtual
+  void
+  SetInteractor(vtkRenderWindowInteractor* theInteractor);
+
+  //! Put a request to redraw the view 
+  virtual
+  void
+  Update();
+
+  //----------------------------------------------------------------------------
+  //! Set selector in order to the actor at any time can restore current selection
+  virtual
+  void
+  SetSelector(SVTK_Selector* theSelector);
+
+  //! Just to update visibility of the highlight devices
+  virtual
+  void
+  highlight(bool theHighlight);  
+
+  //! To map current selection to VTK representation
+  virtual
+  void
+  Highlight(bool theHighlight);  
+
+  //----------------------------------------------------------------------------
+  //! To process prehighlight (called from #SVTK_InteractorStyle)
+  virtual
+  bool
+  PreHighlight(vtkInteractorStyle* theInteractorStyle, 
+              SVTK_SelectionEvent* theSelectionEvent,
+              bool theIsHighlight);
+
+  //! To process highlight (called from #SVTK_InteractorStyle)
+  virtual 
+  bool
+  Highlight(vtkInteractorStyle* theInteractorStyle, 
+           SVTK_SelectionEvent* theSelectionEvent,
+           bool theIsHighlight);
+
+  //----------------------------------------------------------------------------
+  //! To set up a picker for nodal selection (initialized by #SVTK_Renderer::AddActor)
+  void
+  SetPointPicker(vtkPointPicker* thePointPicker); 
+
+  //! To set up a picker for cell selection (initialized by #SVTK_Renderer::AddActor)
+  void
+  SetCellPicker(vtkCellPicker* theCellPicker); 
+
+  //! To set up a picker for point rectangle selection (initialized by #SVTK_Renderer::AddActor)
+  void
+  SetPointRectPicker(SVTK_RectPicker* theRectPicker);
+
+  //! To set up a picker for cell rectangle selection (initialized by #SVTK_Renderer::AddActor)
+  void
+  SetCellRectPicker(SVTK_RectPicker* theRectPicker);
+
+  //----------------------------------------------------------------------------
+  //! To set up a prehighlight property (initialized by #SVTK_Renderer::AddActor)
+  void
+  SetPreHighlightProperty(vtkProperty* theProperty);
+
+  //! To set up a highlight property (initialized by #SVTK_Renderer::AddActor)
+  void
+  SetHighlightProperty(vtkProperty* theProperty);
+
+ protected:
+  //----------------------------------------------------------------------------
+  vtkRenderWindowInteractor* myInteractor;
+  vtkRenderer* myRenderer;
+
+  Handle(SALOME_InteractiveObject) myIO;
+
+  SALOME_Actor();
+  ~SALOME_Actor();
+
+ protected:
+  Selection_Mode mySelectionMode;
+  vtkSmartPointer<SVTK_Selector> mySelector;
+
+  //----------------------------------------------------------------------------
+  // Highlight/ Prehighlight devices
+  vtkSmartPointer<vtkPointPicker> myPointPicker;
+  vtkSmartPointer<vtkCellPicker> myCellPicker;
+
+  vtkSmartPointer<SVTK_RectPicker> myPointRectPicker;
+  vtkSmartPointer<SVTK_RectPicker> myCellRectPicker;
+
+  vtkSmartPointer<SVTK_Actor> myPreHighlightActor;
+  vtkSmartPointer<SVTK_Actor> myHighlightActor;
+
+  vtkSmartPointer<VTKViewer_Actor> myOutlineActor;
+  vtkSmartPointer<vtkOutlineSource> myOutline;
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif // SALOME_ACTOR_H
diff --git a/src/SVTK/SVTK.cxx b/src/SVTK/SVTK.cxx
new file mode 100644 (file)
index 0000000..674714f
--- /dev/null
@@ -0,0 +1,60 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   :
+//  Author :
+//  Module :
+//  $Header$
+
+#include "SVTK.h"
+#include "SVTK_Prs.h"
+#include "SVTK_Actor.h"
+#include "SALOME_Actor.h"
+#include "SVTK_RectPicker.h"
+#include "SVTK_DeviceActor.h"
+#include "SVTK_CubeAxesActor2D.h"
+#include "SVTK_Functor.h"
+#include "SVTK_View.h"
+#include "SVTK_MainWindow.h"
+#include "SVTK_MainWindow.h"
+#include "SVTK_NonIsometricDlg.h"
+#include "SVTK_CubeAxesDlg.h"
+#include "SVTK_FontWidget.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Renderer.h"
+#include "SVTK_InteractorStyle.h"
+#include "SVTK_RenderWindowInteractor.h"
+#include "SVTK_GenericRenderWindowInteractor.h"
+#include "SVTK_Selector.h"
+#include "SVTK_Selection.h"
+#include "SVTK_SelectionEvent.h"
+#include "SVTK_SpaceMouse.h"
+#include "SVTK_Event.h"
+#include "SVTK_ViewModelBase.h"
+
+int
+main(int argc, char** argv)
+{
+  return 0;
+}
diff --git a/src/SVTK/SVTK.h b/src/SVTK/SVTK.h
new file mode 100755 (executable)
index 0000000..970bd38
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 SVTK_H
+#define SVTK_H
+
+#include "VTKViewer.h"
+
+#ifdef WIN32
+#  ifdef SVTK_EXPORTS
+#    define SVTK_EXPORT __declspec(dllexport)
+#  else
+#   define SVTK_EXPORT __declspec(dllimport)
+#  endif
+#else
+#  define SVTK_EXPORT
+#endif
+
+#if defined WIN32
+#pragma warning ( disable: 4251 )
+#pragma warning ( disable: 4786 )
+#endif
+
+#endif
diff --git a/src/SVTK/SVTK.pro b/src/SVTK/SVTK.pro
new file mode 100644 (file)
index 0000000..12b7038
--- /dev/null
@@ -0,0 +1,49 @@
+TEMPLATE = lib
+
+DESTDIR = ../../$(CONFIG_ID)/lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../$(CONFIG_ID)/obj/$$TARGET
+
+VTK_LIBS = -L$$(VTKLIB) -lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets   -lGL -L/usr/X11R6/lib -lGLU -L/usr/X11R6/lib -lX11 -lXt
+
+CASROOT = $$(CASROOT)
+CAS_CPPFLAGS = $${CASROOT}/inc
+
+OCC_LIBS = 
+
+INCLUDEPATH += ../../include $${CAS_CPPFLAGS} $$(VTKINC) ../Qtx ../SUIT ../OBJECT ../Prs ../VTKViewer
+LIBS += -L../../$(CONFIG_ID)/lib -lQtx -lSUIT -lOBJECT -lPrs -lVTKViewer $${OCC_LIBS} $${VTK_LIBS}
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32 
+DEFINES += SVTK_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
+
+HEADERS  = *.h
+
+SOURCES  = *.cxx
+
+TRANSLATIONS = resources/SVTK_images.ts \
+               resources/SVTK_msg_en.ts
+
+unix:GUIResources = ../../resources
+win32:GUIResources = ..\\..\\resources
+
+lrelease.name = LRELASE ${QMAKE_FILE_IN}
+unix:lrelease.commands = $(QTDIR)/$(CONFIG_ID)/bin/lrelease ${QMAKE_FILE_NAME} -qm $${GUIResources}/${QMAKE_FILE_BASE}.qm
+win32:lrelease.commands = $(QTDIR)\\$(CONFIG_ID)\\bin\\lrelease ${QMAKE_FILE_NAME} -qm $${GUIResources}\\${QMAKE_FILE_BASE}.qm
+unix:lrelease.output = $${GUIResources}/${QMAKE_FILE_BASE}.qm
+win32:lrelease.output = $${GUIResources}\\${QMAKE_FILE_BASE}.qm
+lrelease.input = TRANSLATIONS
+unix:lrelease.clean = $${GUIResources}/${QMAKE_FILE_BASE}.qm
+win32:lrelease.clean = $${GUIResources}\\${QMAKE_FILE_BASE}.qm
+lrelease.CONFIG += no_link target_predeps
+QMAKE_EXTRA_COMPILERS += lrelease
+
+ICONS   = resources/*.png
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+INSTALLS += includes
diff --git a/src/SVTK/SVTK_Actor.cxx b/src/SVTK/SVTK_Actor.cxx
new file mode 100644 (file)
index 0000000..8ccb82a
--- /dev/null
@@ -0,0 +1,201 @@
+//  Copyright (C) 2003  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 "SVTK_Actor.h"
+#include "SALOME_Actor.h"
+
+#include "SALOME_InteractiveObject.hxx"
+
+// VTK Includes
+#include <vtkObjectFactory.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDataSetMapper.h>
+#include <vtkRenderer.h>
+
+#include <vtkCell.h>
+#include <vtkPolyData.h>
+
+using namespace std;
+
+
+static 
+void
+CopyPoints(vtkUnstructuredGrid* theGrid, vtkDataSet *theSourceDataSet)
+{
+  vtkPoints *aPoints = vtkPoints::New();
+  vtkIdType iEnd = theSourceDataSet->GetNumberOfPoints();
+  aPoints->SetNumberOfPoints(iEnd);
+  for(vtkIdType i = 0; i < iEnd; i++){
+    aPoints->SetPoint(i,theSourceDataSet->GetPoint(i));
+  }
+  theGrid->SetPoints(aPoints);
+  aPoints->Delete();
+}
+
+vtkStandardNewMacro(SVTK_Actor);
+
+/*!
+  Constructor
+*/
+SVTK_Actor
+::SVTK_Actor():
+  myUnstructuredGrid(vtkUnstructuredGrid::New())
+{
+  myIsShaded = true;
+  myIsResolveCoincidentTopology = false;
+
+  Visibility = Pickable = false;
+
+  myUnstructuredGrid->Delete();
+  myUnstructuredGrid->Allocate();
+}
+
+void
+SVTK_Actor
+::Initialize()
+{
+  SetInput(GetSource());
+}
+
+void
+SVTK_Actor
+::SetSource(vtkUnstructuredGrid* theUnstructuredGrid)
+{
+  if(GetSource() == theUnstructuredGrid)
+    return;
+
+  myUnstructuredGrid = theUnstructuredGrid;
+
+  SetInput(theUnstructuredGrid);
+}
+
+vtkUnstructuredGrid*
+SVTK_Actor
+::GetSource()
+{
+  return myUnstructuredGrid.GetPointer();
+}
+
+/*!
+  Destructor
+*/
+SVTK_Actor
+::~SVTK_Actor()
+{
+}
+
+const TColStd_IndexedMapOfInteger&
+SVTK_Actor
+::GetMapIndex() const
+{
+  return myMapIndex;
+}
+
+void
+SVTK_Actor
+::MapCells(SALOME_Actor* theMapActor,
+          const TColStd_IndexedMapOfInteger& theMapIndex)
+{
+  myUnstructuredGrid->Initialize();
+  myUnstructuredGrid->Allocate();
+
+  vtkDataSet *aSourceDataSet = theMapActor->GetInput();
+  CopyPoints(GetSource(),aSourceDataSet);
+
+  int aNbOfParts = theMapIndex.Extent();
+  for(int ind = 1; ind <= aNbOfParts; ind++){
+    int aPartId = theMapIndex( ind );
+    if(vtkCell* aCell = theMapActor->GetElemCell(aPartId))
+      myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+  }
+
+  UnShrink();
+  if(theMapActor->IsShrunk()){
+    SetShrinkFactor(theMapActor->GetShrinkFactor());
+    SetShrink();
+  }
+
+  myMapIndex = theMapIndex;
+}
+
+void 
+SVTK_Actor
+::MapPoints(SALOME_Actor* theMapActor,
+           const TColStd_IndexedMapOfInteger& theMapIndex)
+{
+  myUnstructuredGrid->Initialize();
+  myUnstructuredGrid->Allocate();
+
+  if(int aNbOfParts = theMapIndex.Extent()){
+    vtkPoints *aPoints = vtkPoints::New();
+    aPoints->SetNumberOfPoints(aNbOfParts);
+    for(int i = 0; i < aNbOfParts; i++){
+      int aPartId = theMapIndex( i+1 );
+      if(vtkFloatingPointType* aCoord = theMapActor->GetNodeCoord(aPartId)){
+       aPoints->SetPoint(i,aCoord);
+       myUnstructuredGrid->InsertNextCell(VTK_VERTEX,1,&i);
+      }
+    }
+    myUnstructuredGrid->SetPoints(aPoints);
+    aPoints->Delete();
+  }
+
+  UnShrink();
+
+  myMapIndex = theMapIndex;
+}
+
+void
+SVTK_Actor
+::MapEdge(SALOME_Actor* theMapActor,
+         const TColStd_IndexedMapOfInteger& theMapIndex)
+{
+  myUnstructuredGrid->Initialize();
+  myUnstructuredGrid->Allocate();
+
+  vtkDataSet *aSourceDataSet = theMapActor->GetInput();
+  CopyPoints(GetSource(),aSourceDataSet);
+
+
+  if(theMapIndex.Extent() == 2){
+    int anEdgeId = theMapIndex(1) < 0 ? theMapIndex(1) : theMapIndex(2);
+    int aCellId = theMapIndex(1) < 0 ? theMapIndex(2) : theMapIndex(1);
+
+    if(aCellId > 0){
+      if(vtkCell* aCell = theMapActor->GetElemCell(aCellId)){
+       if(anEdgeId < 0){
+         anEdgeId = -anEdgeId - 1;
+         int aNbOfEdges = aCell->GetNumberOfEdges();
+         if(0 <= anEdgeId || anEdgeId < aNbOfEdges){
+           if(vtkCell* anEdge = aCell->GetEdge(anEdgeId))
+             myUnstructuredGrid->InsertNextCell(VTK_LINE,anEdge->GetPointIds());
+         }
+       }
+      }
+    }
+  }
+
+  UnShrink();
+  if(theMapActor->IsShrunk()){
+    SetShrinkFactor(theMapActor->GetShrinkFactor());
+    SetShrink();
+  }
+
+  myMapIndex = theMapIndex;
+}
diff --git a/src/SVTK/SVTK_Actor.h b/src/SVTK/SVTK_Actor.h
new file mode 100644 (file)
index 0000000..e0a8afc
--- /dev/null
@@ -0,0 +1,93 @@
+//  Copyright (C) 2003  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 SVTK_ACTOR_H
+#define SVTK_ACTOR_H
+
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+class vtkRenderer;
+class vtkShrinkFilter;
+class vtkDataSetMapper;
+class vtkUnstructuredGrid;
+
+#include "SVTK.h"
+#include "SVTK_DeviceActor.h"
+
+#include <vtkSmartPointer.h>
+
+class SALOME_Actor;
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+//! This class used for internal SVTK package purpose (highlight and prehighlight)
+class SVTK_EXPORT SVTK_Actor : public SVTK_DeviceActor
+{
+public:
+  static SVTK_Actor* New();
+
+  vtkTypeMacro(SVTK_Actor,SVTK_DeviceActor);
+
+  //! Initialiaze the instance completely
+  void
+  Initialize();
+
+  //! Allows to set an external source 
+  void
+  SetSource(vtkUnstructuredGrid* theUnstructuredGrid);
+
+  //! Get its internal data set
+  vtkUnstructuredGrid*
+  GetSource();
+
+  //! Allow to recostruct selected cells from source SALOME_Actor and map of subindexes
+  void
+  MapCells(SALOME_Actor* theMapActor, 
+          const TColStd_IndexedMapOfInteger& theMapIndex);
+
+  //! Allow to recostruct selected points from source SALOME_Actor and map of subindexes
+  void 
+  MapPoints(SALOME_Actor* theMapActor, 
+           const TColStd_IndexedMapOfInteger& theMapIndex);
+
+  //! Allow to recostruct selected edges from source SALOME_Actor and map of subindexes
+  void 
+  MapEdge(SALOME_Actor* theMapActor, 
+         const TColStd_IndexedMapOfInteger& theMapIndex);
+
+  const TColStd_IndexedMapOfInteger&
+  GetMapIndex() const;
+
+ protected:
+  TColStd_IndexedMapOfInteger myMapIndex;
+
+  vtkSmartPointer<vtkUnstructuredGrid> myUnstructuredGrid;
+
+  SVTK_Actor();
+  virtual
+  ~SVTK_Actor();
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
diff --git a/src/SVTK/SVTK_CubeAxesActor2D.cxx b/src/SVTK/SVTK_CubeAxesActor2D.cxx
new file mode 100644 (file)
index 0000000..4f10980
--- /dev/null
@@ -0,0 +1,673 @@
+//  SALOME OBJECT : kernel of SALOME component
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_CubeAxesActor2D.cxx
+//  Author : Eugeny Nikolaev
+//  Module : SALOME
+//  $Header$
+
+#include "SVTK_CubeAxesActor2D.h"
+#include "VTKViewer_Transform.h"
+
+#include <vtkPolyDataMapper.h>
+#include <vtkRectilinearGridGeometryFilter.h>
+#include <vtkActor.h>
+#include <vtkCubeAxesActor2D.h>
+#include <vtkAxisActor2D.h>
+#include <vtkCamera.h>
+#include <vtkDataSet.h>
+#include <vtkMath.h>
+#include <vtkObjectFactory.h>
+#include <vtkTextProperty.h>
+#include <vtkViewport.h>
+#include <vtkFloatArray.h>
+#include <vtkRectilinearGrid.h>
+#include <vtkProperty.h>
+#include <vtkProperty2D.h>
+
+vtkCxxRevisionMacro(SVTK_CubeAxesActor2D, "$Revision$");
+vtkStandardNewMacro(SVTK_CubeAxesActor2D);
+
+// Instantiate this object.
+SVTK_CubeAxesActor2D::SVTK_CubeAxesActor2D()
+{
+  this->wireActorXY = vtkActor::New();
+  this->wireActorYZ = vtkActor::New();
+  this->wireActorXZ = vtkActor::New();
+
+  this->planeXY = vtkRectilinearGridGeometryFilter::New();
+  this->planeYZ = vtkRectilinearGridGeometryFilter::New();
+  this->planeXZ = vtkRectilinearGridGeometryFilter::New();
+
+  this->rgridMapperXY = vtkPolyDataMapper::New();
+  this->rgridMapperYZ = vtkPolyDataMapper::New();
+  this->rgridMapperXZ = vtkPolyDataMapper::New();
+
+  this->rgridMapperXY->SetInput(this->planeXY->GetOutput());
+  this->rgridMapperYZ->SetInput(this->planeYZ->GetOutput());
+  this->rgridMapperXZ->SetInput(this->planeXZ->GetOutput());
+
+  this->wireActorXY->SetMapper(rgridMapperXY);
+  this->wireActorYZ->SetMapper(rgridMapperYZ);
+  this->wireActorXZ->SetMapper(rgridMapperXZ);
+
+  this->wireActorXY->GetProperty()->SetRepresentationToWireframe();
+  this->wireActorYZ->GetProperty()->SetRepresentationToWireframe();
+  this->wireActorXZ->GetProperty()->SetRepresentationToWireframe();
+
+  // setting ambient to 1 (if no - incorrect reaction on light)
+  this->wireActorXY->GetProperty()->SetAmbient(1);
+  this->wireActorYZ->GetProperty()->SetAmbient(1);
+  this->wireActorXZ->GetProperty()->SetAmbient(1);
+
+  this->XAxis->SetTitle(this->XLabel);
+  this->YAxis->SetTitle(this->YLabel);
+  this->ZAxis->SetTitle(this->ZLabel);
+  
+  this->XAxis->SetNumberOfLabels(this->NumberOfLabels);
+  this->YAxis->SetNumberOfLabels(this->NumberOfLabels);
+  this->ZAxis->SetNumberOfLabels(this->NumberOfLabels);
+  this->XAxis->SetLabelFormat(this->LabelFormat);
+  this->YAxis->SetLabelFormat(this->LabelFormat);
+  this->ZAxis->SetLabelFormat(this->LabelFormat);
+  
+  this->XAxis->SetFontFactor(this->FontFactor);
+  this->YAxis->SetFontFactor(this->FontFactor);
+  this->ZAxis->SetFontFactor(this->FontFactor);
+  
+  this->XAxis->SetProperty(this->GetProperty());
+  this->YAxis->SetProperty(this->GetProperty());
+  this->ZAxis->SetProperty(this->GetProperty());
+
+  vtkTextProperty* aTLProp = vtkTextProperty::New();
+  aTLProp->SetBold(0);
+  aTLProp->SetItalic(0);
+  aTLProp->SetShadow(0);
+  aTLProp->SetFontFamilyToArial();
+  aTLProp->SetColor(1,0,0);
+  if (this->XAxis->GetLabelTextProperty())
+    this->XAxis->GetLabelTextProperty()->ShallowCopy(aTLProp);
+  aTLProp->SetColor(0,1,0);
+  if (this->YAxis->GetLabelTextProperty())
+    this->YAxis->GetLabelTextProperty()->ShallowCopy(aTLProp);
+  aTLProp->SetColor(0,0,1);
+  if (this->ZAxis->GetLabelTextProperty())
+    this->ZAxis->GetLabelTextProperty()->ShallowCopy(aTLProp);;
+
+  aTLProp->SetColor(1,0,0);
+  if (this->XAxis->GetLabelTextProperty())
+    this->XAxis->GetTitleTextProperty()->ShallowCopy(aTLProp);
+  aTLProp->SetColor(0,1,0);
+  if (this->YAxis->GetLabelTextProperty())
+    this->YAxis->GetTitleTextProperty()->ShallowCopy(aTLProp);
+  aTLProp->SetColor(0,0,1);
+  if (this->ZAxis->GetLabelTextProperty())
+    this->ZAxis->GetTitleTextProperty()->ShallowCopy(aTLProp);
+  
+  aTLProp->Delete();
+  
+}
+
+SVTK_CubeAxesActor2D::~SVTK_CubeAxesActor2D()
+{
+  this->wireActorXY->Delete();
+  this->wireActorYZ->Delete();
+  this->wireActorXZ->Delete();
+
+  this->planeXY->Delete();
+  this->planeYZ->Delete();
+  this->planeXZ->Delete();
+
+  this->rgridMapperXY->Delete();
+  this->rgridMapperYZ->Delete();
+  this->rgridMapperXZ->Delete();
+}
+
+// Static variable describes connections in cube.
+static int Conn[8][3] = {{1,2,4}, {0,3,5}, {3,0,6}, {2,1,7},
+                         {5,6,0}, {4,7,1}, {7,4,2}, {6,5,3}};
+
+// Project the bounding box and compute edges on the border of the bounding
+// cube. Determine which parts of the edges are visible via intersection 
+// with the boundary of the viewport (minus borders).
+int SVTK_CubeAxesActor2D::RenderOverlay(vtkViewport *viewport)
+{
+  int renderedSomething=0;
+
+  // Initialization
+  if ( ! this->RenderSomething )
+    {
+    return 0;
+    }
+  
+  //Render the axes
+  if ( this->XAxisVisibility )
+    {
+    renderedSomething += this->XAxis->RenderOverlay(viewport);
+    }
+  if ( this->YAxisVisibility )
+    {
+    renderedSomething += this->YAxis->RenderOverlay(viewport);
+    }
+  if ( this->ZAxisVisibility )
+    {
+    renderedSomething += this->ZAxis->RenderOverlay(viewport);
+    }
+  
+  bool RX=false,RY=false;
+  if (this->XAxisVisibility){
+    this->wireActorXY->RenderOverlay(viewport);
+    this->wireActorXZ->RenderOverlay(viewport);
+    RX = true;
+  }
+  if (this->YAxisVisibility){
+    if(!RX) this->wireActorXY->RenderOverlay(viewport);
+    this->wireActorYZ->RenderOverlay(viewport);
+    RY = true;
+  }
+  if (this->ZAxisVisibility){
+    if(!RX) this->wireActorXZ->RenderOverlay(viewport);
+    if(!RY) this->wireActorYZ->RenderOverlay(viewport);
+  }
+
+  return renderedSomething;
+}
+
+static void ChangeValues(vtkFloatingPointType* aArray1,
+                        vtkFloatingPointType* aArray2,
+                        vtkFloatingPointType *aRange1,
+                        vtkFloatingPointType* aRange2,
+                        bool theY)
+{
+  vtkFloatingPointType tmp=-1000;
+  if (!theY){
+    for (int i=0; i<4; i++){
+      tmp = aArray1[i]; aArray1[i] = aArray2[i]; aArray2[i] = tmp;
+    }
+#ifndef WIN32
+    for(int i=0;i<2; i++){
+#else
+    for(i=0;i<2; i++){
+#endif
+      tmp = aRange1[i]; aRange1[i] = aRange2[i]; aRange2[i] = tmp;
+    }
+  }
+  else{
+    tmp = aArray1[2]; aArray1[2] = aArray2[0]; aArray2[0] = tmp;
+    tmp = aArray1[3]; aArray1[3] = aArray2[1]; aArray2[1] = tmp;
+    tmp = aArray1[0]; aArray1[0] = aArray2[2]; aArray2[2] = tmp;
+    tmp = aArray1[1]; aArray1[1] = aArray2[3]; aArray2[3] = tmp;
+
+    tmp = aRange1[0]; aRange1[0] = aRange2[1]; aRange2[1] = tmp;
+    tmp = aRange1[1]; aRange1[1] = aRange2[0]; aRange2[0] = tmp;
+  }
+}
+
+static void ChangeArrays(vtkFloatingPointType* xCoords,
+                        vtkFloatingPointType* yCoords,
+                        vtkFloatingPointType* zCoords,
+                        vtkFloatingPointType* xRange,
+                        vtkFloatingPointType* yRange,
+                        vtkFloatingPointType* zRange,
+                        const int xAxes,
+                        const int yAxes, 
+                        const int zAxes)
+{
+  if ( xAxes == 0 && yAxes == 2 && zAxes == 1)
+    ChangeValues(yCoords,zCoords,yRange,zRange,true);
+  else if (xAxes == 1 && yAxes == 0 && zAxes == 2)
+    ChangeValues(xCoords,yCoords,xRange,yRange,true);
+  else if (xAxes == 1 && yAxes == 2 && zAxes == 0){
+    ChangeValues(xCoords,zCoords,xRange,zRange,false);
+    // xAxes == 0 && yAxes == 2 && zAxes == 1
+    ChangeValues(yCoords,zCoords,yRange,zRange,true);
+  } else if (xAxes == 2 && yAxes == 0 && zAxes == 1){
+    ChangeValues(xCoords,yCoords,xRange,yRange,true);
+    // xAxes == 0 && yAxes == 2 && zAxes == 1
+    ChangeValues(zCoords,yCoords,zRange,yRange,true);
+  } else if (xAxes == 2 && yAxes == 1 && zAxes == 0)
+    ChangeValues(zCoords,xCoords,zRange,xRange,false);
+}
+
+// Project the bounding box and compute edges on the border of the bounding
+// cube. Determine which parts of the edges are visible via intersection 
+// with the boundary of the viewport (minus borders).
+int SVTK_CubeAxesActor2D::RenderOpaqueGeometry(vtkViewport *viewport)
+{
+  vtkFloatingPointType bounds[6], slope = 0.0, minSlope, num, den;
+  vtkFloatingPointType pts[8][3], d2, d2Min, min;
+  int i, idx = 0;
+  int xIdx, yIdx = 0, zIdx = 0, zIdx2, renderedSomething=0;
+  int xAxes = 0, yAxes, zAxes;
+
+  // Initialization
+  if ( !this->Camera )
+    {
+    vtkErrorMacro(<<"No camera!");
+    this->RenderSomething = 0;
+    return 0;
+    }
+  
+  this->RenderSomething = 1;
+
+  // determine the bounds to use
+  this->GetBounds(bounds);
+
+  // Build the axes (almost always needed so we don't check mtime)
+  // Transform all points into display coordinates
+  this->TransformBounds(viewport, bounds, pts);
+
+  // Find the portion of the bounding box that fits within the viewport,
+  if ( this->ClipBounds(viewport, pts, bounds) == 0 )
+    {
+    this->RenderSomething = 0;
+    return 0;
+    }
+
+  // Take into account the inertia. Process only so often.
+  if ( this->RenderCount++ == 0 || !(this->RenderCount % this->Inertia) )
+    {
+    // Okay, we have a bounding box, maybe clipped and scaled, that is visible.
+    // We setup the axes depending on the fly mode.
+    if ( this->FlyMode == VTK_FLY_CLOSEST_TRIAD )
+      {
+      // Loop over points and find the closest point to the camera
+      min = VTK_LARGE_FLOAT;
+      for (i=0; i < 8; i++)
+        {
+        if ( pts[i][2] < min )
+          {
+          idx = i;
+          min = pts[i][2];
+          }
+        }
+
+      // Setup the three axes to be drawn
+      xAxes = 0;
+      xIdx = Conn[idx][0];
+      yAxes = 1;
+      yIdx = Conn[idx][1];
+      zAxes = 2;
+      zIdx = idx;
+      zIdx2 = Conn[idx][2];
+      }
+    else
+      {
+      vtkFloatingPointType e1[2], e2[2], e3[2];
+
+      // Find distance to origin
+      d2Min = VTK_LARGE_FLOAT;
+      for (i=0; i < 8; i++)
+        {
+        d2 = pts[i][0]*pts[i][0] + pts[i][1]*pts[i][1];
+        if ( d2 < d2Min )
+          {
+          d2Min = d2;
+          idx = i;
+          }
+        }
+
+      // find minimum slope point connected to closest point and on 
+      // right side (in projected coordinates). This is the first edge.
+      minSlope = VTK_LARGE_FLOAT;
+      for (xIdx=0, i=0; i<3; i++)
+        {
+        num = (pts[Conn[idx][i]][1] - pts[idx][1]);
+        den = (pts[Conn[idx][i]][0] - pts[idx][0]);
+        if ( den != 0.0 )
+          {
+          slope = num / den;
+          }
+        if ( slope < minSlope && den > 0 )
+          {
+          xIdx = Conn[idx][i];
+          yIdx = Conn[idx][(i+1)%3];
+          zIdx = Conn[idx][(i+2)%3];
+          xAxes = i;
+          minSlope = slope;
+          }
+        }
+
+      // find edge (connected to closest point) on opposite side
+      for ( i=0; i<2; i++)
+        {
+        e1[i] = (pts[xIdx][i] - pts[idx][i]);
+        e2[i] = (pts[yIdx][i] - pts[idx][i]);
+        e3[i] = (pts[zIdx][i] - pts[idx][i]);
+        }
+      vtkMath::Normalize2D(e1);
+      vtkMath::Normalize2D(e2);
+      vtkMath::Normalize2D(e3);
+
+      if ( vtkMath::Dot2D(e1,e2) < vtkMath::Dot2D(e1,e3) )
+        {
+        yAxes = (xAxes + 1) % 3;
+        }
+      else
+        {
+        yIdx = zIdx;
+        yAxes = (xAxes + 2) % 3;
+        }
+
+      // Find the final point by determining which global x-y-z axes have not 
+      // been represented, and then determine the point closest to the viewer.
+      zAxes = (xAxes != 0 && yAxes != 0 ? 0 :
+              (xAxes != 1 && yAxes != 1 ? 1 : 2));
+      if ( pts[Conn[xIdx][zAxes]][2] < pts[Conn[yIdx][zAxes]][2] )
+        {
+        zIdx = xIdx;
+        zIdx2 = Conn[xIdx][zAxes];
+        }
+      else
+        {
+        zIdx = yIdx;
+        zIdx2 = Conn[yIdx][zAxes];
+        }
+      }//else boundary edges fly mode
+    this->InertiaAxes[0] = idx;
+    this->InertiaAxes[1] = xIdx;
+    this->InertiaAxes[2] = yIdx;
+    this->InertiaAxes[3] = zIdx;
+    this->InertiaAxes[4] = zIdx2;
+    this->InertiaAxes[5] = xAxes;
+    this->InertiaAxes[6] = yAxes;
+    this->InertiaAxes[7] = zAxes;
+    } //inertia
+  else
+    {
+    idx = this->InertiaAxes[0];
+    xIdx = this->InertiaAxes[1];
+    yIdx = this->InertiaAxes[2];
+    zIdx = this->InertiaAxes[3];
+    zIdx2 = this->InertiaAxes[4];
+    xAxes = this->InertiaAxes[5];
+    yAxes = this->InertiaAxes[6];
+    zAxes = this->InertiaAxes[7];
+    }
+
+  // Setup the axes for plotting
+  vtkFloatingPointType xCoords[4], yCoords[4], zCoords[4], xRange[2], yRange[2], zRange[2];
+  this->AdjustAxes(pts, bounds, idx, xIdx, yIdx, zIdx, zIdx2, 
+                   xAxes, yAxes, zAxes, 
+                   xCoords, yCoords, zCoords, xRange, yRange, zRange);
+
+  // Upate axes
+  this->Labels[0] = this->XLabel;
+  this->Labels[1] = this->YLabel;
+  this->Labels[2] = this->ZLabel;
+
+  // correct XAxis, YAxis, ZAxis, which must be 
+  // parallel OX, OY, OZ system coordinates
+  // if xAxes=0 yAxes=1 zAxes=2 - good situation
+  if (!(xAxes == 0 && yAxes == 1 && zAxes == 2))
+    ChangeArrays(xCoords,yCoords,zCoords,
+                xRange,yRange,zRange,
+                xAxes,yAxes,zAxes);
+
+  double aTScale[3];
+  if(m_Transform.GetPointer() != NULL)
+    m_Transform->GetMatrixScale(aTScale);
+
+  this->XAxis->GetPositionCoordinate()->SetValue(xCoords[0], xCoords[1]);
+  this->XAxis->GetPosition2Coordinate()->SetValue(xCoords[2], xCoords[3]);
+  if(m_Transform.GetPointer() != NULL) this->XAxis->SetRange(xRange[0]/aTScale[0], xRange[1]/aTScale[0]);
+  else this->XAxis->SetRange(xRange[0], xRange[1]);
+
+  this->YAxis->GetPositionCoordinate()->SetValue(yCoords[2], yCoords[3]);
+  this->YAxis->GetPosition2Coordinate()->SetValue(yCoords[0], yCoords[1]);
+  if(m_Transform.GetPointer() != NULL) this->YAxis->SetRange(yRange[1]/aTScale[1], yRange[0]/aTScale[1]);
+  else this->YAxis->SetRange(yRange[1], yRange[0]);
+
+  this->ZAxis->GetPositionCoordinate()->SetValue(zCoords[0], zCoords[1]);
+  this->ZAxis->GetPosition2Coordinate()->SetValue(zCoords[2], zCoords[3]);
+  if(m_Transform.GetPointer() != NULL) this->ZAxis->SetRange(zRange[0]/aTScale[2], zRange[1]/aTScale[2]);
+  else this->ZAxis->SetRange(zRange[0], zRange[1]);
+
+  int numOfLabelsX = this->XAxis->GetNumberOfLabels();
+  int numOfLabelsY = this->YAxis->GetNumberOfLabels();
+  int numOfLabelsZ = this->ZAxis->GetNumberOfLabels();
+
+  // XCoords coordinates for X grid
+  vtkFloatArray *XCoords = vtkFloatArray::New();
+#ifndef WIN32
+  for(int i=0;i<numOfLabelsX;i++){
+#else
+  for(i=0;i<numOfLabelsX;i++){
+#endif
+    vtkFloatingPointType val = bounds[0]+i*(bounds[1]-bounds[0])/(numOfLabelsX-1);
+    XCoords->InsertNextValue(val);
+  }
+  // YCoords coordinates for Y grid
+  vtkFloatArray *YCoords = vtkFloatArray::New();
+#ifndef WIN32
+  for(int i=0;i<numOfLabelsX;i++){
+#else
+  for(i=0;i<numOfLabelsX;i++){
+#endif
+    vtkFloatingPointType val = bounds[2]+i*(bounds[3]-bounds[2])/(numOfLabelsY-1);
+    YCoords->InsertNextValue(val);
+  }
+  // ZCoords coordinates for Z grid
+  vtkFloatArray *ZCoords = vtkFloatArray::New();
+#ifndef WIN32
+  for(int i=0;i<numOfLabelsZ;i++){
+#else
+  for(i=0;i<numOfLabelsZ;i++){
+#endif
+    vtkFloatingPointType val = bounds[4]+i*(bounds[5]-bounds[4])/(numOfLabelsZ-1);
+    ZCoords->InsertNextValue(val);
+  }
+
+  vtkRectilinearGrid *rgrid = vtkRectilinearGrid::New();
+  rgrid->SetDimensions(numOfLabelsX,numOfLabelsY,numOfLabelsZ);
+  rgrid->SetXCoordinates(XCoords);
+  rgrid->SetYCoordinates(YCoords);
+  rgrid->SetZCoordinates(ZCoords);
+
+  this->planeXY->SetInput(rgrid);
+  this->planeYZ->SetInput(rgrid);
+  this->planeXZ->SetInput(rgrid);
+
+  rgrid->Delete();
+
+  vtkFloatingPointType aCPosition[3];
+  vtkFloatingPointType aCDirection[3];
+  this->Camera->GetPosition(aCPosition);
+  this->Camera->GetDirectionOfProjection(aCDirection);
+
+  // culculate placement of XY
+  bool replaceXY=false;
+  bool replaceYZ=false;
+  bool replaceXZ=false;
+  vtkFloatingPointType p[6][3]; // centers of planes
+  vtkFloatingPointType vecs[6][3]; // 6 vectors from camera position to centers
+
+  vtkFloatingPointType aMiddleX = (XCoords->GetValue(0) + XCoords->GetValue(numOfLabelsX-1))/2;
+  vtkFloatingPointType aMiddleY = (YCoords->GetValue(0) + YCoords->GetValue(numOfLabelsY-1))/2;
+  vtkFloatingPointType aMiddleZ = (ZCoords->GetValue(0) + ZCoords->GetValue(numOfLabelsZ-1))/2;
+
+  // plane XY
+  p[0][0] = aMiddleX; // plane X=0.5 Y=0.5 Z=0
+  p[0][1] = aMiddleY;
+  p[0][2] = ZCoords->GetValue(0);
+
+  p[1][0] = aMiddleX; // plane X=0.5 Y=0.5 Z=1
+  p[1][1] = aMiddleY;
+  p[1][2] = ZCoords->GetValue(numOfLabelsZ-1);
+
+  // plane YZ
+  p[2][0] = XCoords->GetValue(0); // plane X=0 Y=0.5 Z=0.5
+  p[2][1] = aMiddleY;
+  p[2][2] = aMiddleZ;
+
+  p[3][0] = XCoords->GetValue(numOfLabelsX-1);
+  p[3][1] = aMiddleY;
+  p[3][2] = aMiddleZ;
+
+  // plane XZ
+  p[4][0] = aMiddleX; // plane X=0.5 Y=0 Z=0.5
+  p[4][1] = YCoords->GetValue(0);
+  p[4][2] = aMiddleZ;
+
+  p[5][0] = aMiddleX; // plane X=0.5 Y=1 Z=0.5
+  p[5][1] = YCoords->GetValue(numOfLabelsY-1);
+  p[5][2] = aMiddleZ;
+
+#ifndef WIN32
+  for(int i=0;i<3;i++) 
+#else
+  for(i=0;i<3;i++) 
+#endif
+    for(int j=0;j<6;j++) vecs[j][i] = p[j][i] - aCPosition[i];
+
+  if ( vtkMath::Dot(vecs[0],aCDirection) < vtkMath::Dot(vecs[1],aCDirection))
+    replaceXY = true;
+  if ( vtkMath::Dot(vecs[2],aCDirection) < vtkMath::Dot(vecs[3],aCDirection))
+    replaceYZ = true;
+  if ( vtkMath::Dot(vecs[4],aCDirection) < vtkMath::Dot(vecs[5],aCDirection))
+    replaceXZ = true;
+
+  if(replaceXY) this->planeXY->SetExtent(0,numOfLabelsX, 0,numOfLabelsY, numOfLabelsZ,numOfLabelsZ);
+  else this->planeXY->SetExtent(0,numOfLabelsX, 0,numOfLabelsY, 0,0);
+
+  if(replaceYZ) this->planeYZ->SetExtent(numOfLabelsX,numOfLabelsX, 0,numOfLabelsY, 0,numOfLabelsZ);
+  else this->planeYZ->SetExtent(0,0, 0,numOfLabelsY, 0,numOfLabelsZ);
+
+  if(replaceXZ) this->planeXZ->SetExtent(0,numOfLabelsX, numOfLabelsY,numOfLabelsY, 0,numOfLabelsZ);
+  else this->planeXZ->SetExtent(0,numOfLabelsX, 0,0, 0,numOfLabelsZ);
+
+  XCoords->Delete();
+  YCoords->Delete();
+  ZCoords->Delete();
+
+  vtkFloatingPointType color[3];
+
+  this->GetProperty()->GetColor(color);
+  this->wireActorXY->GetProperty()->SetColor(color);
+  this->wireActorYZ->GetProperty()->SetColor(color);
+  this->wireActorXZ->GetProperty()->SetColor(color);
+
+  /*
+  // Rebuid text props
+  // Perform shallow copy here since each individual axis can be
+  // accessed through the class API (i.e. each individual axis text prop
+  // can be changed). Therefore, we can not just assign pointers otherwise
+  // each individual axis text prop would point to the same text prop.
+
+  if (this->AxisLabelTextProperty &&
+      this->AxisLabelTextProperty->GetMTime() > this->BuildTime)
+    {
+    if (this->XAxis->GetLabelTextProperty())
+      {
+      this->XAxis->GetLabelTextProperty()->ShallowCopy(
+        this->AxisLabelTextProperty);
+      }
+    if (this->YAxis->GetLabelTextProperty())
+      {
+      this->YAxis->GetLabelTextProperty()->ShallowCopy(
+        this->AxisLabelTextProperty);
+      }
+    if (this->ZAxis->GetLabelTextProperty())
+      {
+      this->ZAxis->GetLabelTextProperty()->ShallowCopy(
+        this->AxisLabelTextProperty);
+      }
+    }
+
+  if (this->AxisTitleTextProperty &&
+      this->AxisTitleTextProperty->GetMTime() > this->BuildTime)
+    {
+    if (this->XAxis->GetLabelTextProperty())
+      {
+      this->XAxis->GetTitleTextProperty()->ShallowCopy(
+        this->AxisTitleTextProperty);
+      }
+    if (this->YAxis->GetLabelTextProperty())
+      {
+      this->YAxis->GetTitleTextProperty()->ShallowCopy(
+        this->AxisTitleTextProperty);
+      }
+    if (this->ZAxis->GetLabelTextProperty())
+      {
+      this->ZAxis->GetTitleTextProperty()->ShallowCopy(
+        this->AxisTitleTextProperty);
+      }
+    }
+  */  
+  this->BuildTime.Modified();
+
+  //Render the axes
+  if ( this->XAxisVisibility )
+  {
+    renderedSomething += this->XAxis->RenderOpaqueGeometry(viewport);
+  }
+  if ( this->YAxisVisibility )
+  {
+    renderedSomething += this->YAxis->RenderOpaqueGeometry(viewport);
+  }
+  if ( this->ZAxisVisibility )
+  {
+    renderedSomething += this->ZAxis->RenderOpaqueGeometry(viewport);
+  }
+
+  bool RX=false,RY=false;
+  if (this->XAxisVisibility){
+    this->wireActorXY->RenderOpaqueGeometry(viewport);
+    this->wireActorXZ->RenderOpaqueGeometry(viewport);
+    RX = true;
+  }
+  if (this->YAxisVisibility){
+    if(!RX) this->wireActorXY->RenderOpaqueGeometry(viewport);
+    this->wireActorYZ->RenderOpaqueGeometry(viewport);
+    RY = true;
+  }
+  if (this->ZAxisVisibility){
+    if(!RX) this->wireActorXZ->RenderOpaqueGeometry(viewport);
+    if(!RY) this->wireActorYZ->RenderOpaqueGeometry(viewport);
+  }
+
+  return renderedSomething;
+}
+
+// Release any graphics resources that are being consumed by this actor.
+// The parameter window could be used to determine which graphic
+// resources to release.
+void SVTK_CubeAxesActor2D::ReleaseGraphicsResources(vtkWindow *win)
+{
+  this->XAxis->ReleaseGraphicsResources(win);
+  this->YAxis->ReleaseGraphicsResources(win);
+  this->ZAxis->ReleaseGraphicsResources(win);
+
+  this->wireActorXY->ReleaseGraphicsResources(win);
+  this->wireActorYZ->ReleaseGraphicsResources(win);
+  this->wireActorXZ->ReleaseGraphicsResources(win);
+}
+
+void SVTK_CubeAxesActor2D::SetTransform(VTKViewer_Transform* theTransform){
+  this->m_Transform = theTransform;
+}
+
+VTKViewer_Transform* SVTK_CubeAxesActor2D::GetTransform(){
+  return (this->m_Transform.GetPointer());
+}
diff --git a/src/SVTK/SVTK_CubeAxesActor2D.h b/src/SVTK/SVTK_CubeAxesActor2D.h
new file mode 100644 (file)
index 0000000..0443f0b
--- /dev/null
@@ -0,0 +1,117 @@
+//  SALOME OBJECT : kernel of SALOME component
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_CubeAxesActor2D.h
+//  Author : Eugeny Nikolaev
+//  Module : SALOME
+//  $Header$
+
+#ifndef __SVTK_CubeAxesActor2D_h
+#define __SVTK_CubeAxesActor2D_h
+
+#include <vtkCubeAxesActor2D.h>
+#include <vtkSmartPointer.h>
+
+class vtkActor;
+class vtkAxisActor2D;
+class vtkCamera;
+class vtkDataSet;
+class vtkTextProperty;
+class vtkPolyDataMapper;
+class vtkRectilinearGridGeometryFilter;
+class VTKViewer_Transform;
+
+#include "SVTK.h"
+#include "VTKViewer.h"
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+#ifndef WIN32
+class VTK_HYBRID_EXPORT SVTK_CubeAxesActor2D : public vtkCubeAxesActor2D
+#else
+class SVTK_EXPORT SVTK_CubeAxesActor2D : public vtkCubeAxesActor2D
+#endif
+{
+public:
+  vtkTypeRevisionMacro(SVTK_CubeAxesActor2D,vtkCubeAxesActor2D);
+
+  // Description:
+  // Instantiate object with bold, italic, and shadow enabled; font family
+  // set to Arial; and label format "6.3g". The number of labels per axis
+  // is set to 3.
+  static SVTK_CubeAxesActor2D *New();
+  
+  // Description:
+  // Draw the axes as per the vtkProp superclass' API.
+  int RenderOverlay(vtkViewport*);
+  int RenderOpaqueGeometry(vtkViewport*);
+
+  // Description:
+  // Release any graphics resources that are being consumed by this actor.
+  // The parameter window could be used to determine which graphic
+  // resources to release.
+  void ReleaseGraphicsResources(vtkWindow *);
+
+  // Description:
+  
+  vtkActor* GetWireActorXY(){return this->wireActorXY;}
+  vtkActor* GetWireActorYZ(){return this->wireActorYZ;}
+  vtkActor* GetWireActorXZ(){return this->wireActorXZ;}
+
+  void SetTransform(VTKViewer_Transform* theTransform);
+  VTKViewer_Transform* GetTransform();
+  
+protected:
+  SVTK_CubeAxesActor2D();
+  ~SVTK_CubeAxesActor2D();
+
+  vtkActor* wireActorXY;
+  vtkActor* wireActorYZ;
+  vtkActor* wireActorXZ;
+
+private:
+  // hide the superclass' ShallowCopy() from the user and the compiler.
+  void ShallowCopy(vtkProp *prop) { this->vtkProp::ShallowCopy( prop ); };
+
+  vtkRectilinearGridGeometryFilter *planeXY; // rectilinear grid XY
+  vtkPolyDataMapper *rgridMapperXY;
+  
+  vtkRectilinearGridGeometryFilter *planeYZ; // rectilinear grid YZ
+  vtkPolyDataMapper *rgridMapperYZ;
+
+  vtkRectilinearGridGeometryFilter *planeXZ; // rectilinear grid XZ
+  vtkPolyDataMapper *rgridMapperXZ;
+  
+  vtkSmartPointer<VTKViewer_Transform> m_Transform;
+private:
+  SVTK_CubeAxesActor2D(const SVTK_CubeAxesActor2D&);  // Not implemented.
+  void operator=(const SVTK_CubeAxesActor2D&);  // Not implemented.
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
diff --git a/src/SVTK/SVTK_CubeAxesDlg.cxx b/src/SVTK/SVTK_CubeAxesDlg.cxx
new file mode 100644 (file)
index 0000000..1258e98
--- /dev/null
@@ -0,0 +1,555 @@
+//  VISU VISUGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_CubeAxesDlg.cxx
+//  Author : Sergey LITONIN
+//  Module : VISU
+
+#include "SVTK_CubeAxesDlg.h"
+
+#include "SVTK_MainWindow.h"
+#include "SVTK_FontWidget.h"
+
+#include "SVTK_CubeAxesActor2D.h"
+
+#include "QtxAction.h"
+#include "QtxIntSpinBox.h"
+
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QPushButton>
+#include <QTabWidget>
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QLineEdit>
+#include <QLabel>
+
+#include <vtkAxisActor2D.h>
+#include <vtkTextProperty.h>
+
+/*!
+ * Class       : AxisWg
+ * Description : Tab of dialog
+ */
+
+/*!
+  Constructor
+*/
+SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent)
+:  QFrame(theParent)
+{
+  QList< QLabel* > aLabels;
+
+  // "Name" grp
+
+  myNameGrp = new QGroupBox(tr("AXIS_NAME"), this);
+  QVBoxLayout* aVBox = new QVBoxLayout;
+  
+  myIsNameVisible = new QCheckBox(tr("IS_VISIBLE"), myNameGrp);
+  aVBox->addWidget(myIsNameVisible);
+
+  QHBoxLayout* aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  QLabel* aLabel = new QLabel(tr("NAME"));
+  aHBox->addWidget(aLabel);
+  myAxisName = new QLineEdit;
+  aHBox->addWidget(myAxisName);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  aLabel = new QLabel(tr("FONT"));
+  aHBox->addWidget(aLabel);
+  myNameFont = new SVTK_FontWidget(myNameGrp);
+  aHBox->addWidget(myNameFont);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  myNameGrp->setLayout(aVBox);
+
+  // "Labels" grp
+
+  myLabelsGrp = new QGroupBox(tr("LABELS"), this);
+  aVBox = new QVBoxLayout;
+
+  myIsLabelsVisible = new QCheckBox(tr("IS_VISIBLE"), myLabelsGrp);
+  aVBox->addWidget(myIsLabelsVisible);
+
+  aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  aLabel = new QLabel(tr("NUMBER"));
+  aHBox->addWidget(aLabel);
+  myLabelNumber = new QtxIntSpinBox(0,25,1,myLabelsGrp);
+  myLabelNumber->setObjectName("SpinBoxLabelNumber");
+  aHBox->addWidget(myLabelNumber);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  aLabel = new QLabel(tr("OFFSET"));
+  aHBox->addWidget(aLabel);
+  myLabelOffset = new QtxIntSpinBox(0,100,1,myLabelsGrp);
+  myLabelOffset->setObjectName("SpinBoxLabellOffset");
+  aHBox->addWidget(myLabelOffset);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  aLabel = new QLabel(tr("FONT"));
+  aHBox->addWidget(aLabel);
+  myLabelsFont = new SVTK_FontWidget(myLabelsGrp);
+  aHBox->addWidget(myLabelsFont);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  myLabelsGrp->setLayout(aVBox);
+
+  // "Tick marks" grp
+
+  myTicksGrp = new QGroupBox(tr("TICK_MARKS"), this);
+  aVBox = new QVBoxLayout;
+
+  myIsTicksVisible = new QCheckBox(tr("IS_VISIBLE"), myTicksGrp);
+  aVBox->addWidget(myIsTicksVisible);
+
+  aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  aLabel = new QLabel(tr("LENGTH"));
+  aHBox->addWidget(aLabel);
+  myTickLength = new QtxIntSpinBox(0,100,1,myTicksGrp);
+  myTickLength->setObjectName("SpinBoxTickLength");
+  aHBox->addWidget(myTickLength);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  myTicksGrp->setLayout(aVBox);
+
+  // Layout
+
+  QVBoxLayout* aLay = new QVBoxLayout(this);
+  aLay->setMargin(0);
+  aLay->setSpacing(5);
+  aLay->addWidget(myNameGrp);
+  aLay->addWidget(myLabelsGrp);
+  aLay->addWidget(myTicksGrp);
+
+  // init
+  myIsNameVisible->setChecked(true);
+  myIsLabelsVisible->setChecked(true);
+  myIsTicksVisible->setChecked(true);
+  updateControlState();
+
+  // Adjust label widths
+  QList< QLabel* >::iterator anIter;
+  int aMaxWidth = 0;
+  for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++)
+    aMaxWidth = qMax(aMaxWidth, (*anIter)->sizeHint().width());
+  for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++)
+    (*anIter)->setFixedWidth(aMaxWidth);
+
+  // connect signals and slots
+  connect(myIsNameVisible, SIGNAL(stateChanged(int)), SLOT(onNameChecked()));
+  connect(myIsLabelsVisible, SIGNAL(stateChanged(int)), SLOT(onLabelsChecked()));
+  connect(myIsTicksVisible, SIGNAL(stateChanged(int)), SLOT(onTicksChecked()));
+}
+
+/*!
+  Destructor
+*/
+SVTK_AxisWidget::~SVTK_AxisWidget()
+{
+}
+
+void SVTK_AxisWidget::updateControlState()
+{
+  onNameChecked();
+  onLabelsChecked();
+  onTicksChecked();
+}
+
+void SVTK_AxisWidget::setEnabled(QGroupBox* theGrp, const bool theState)
+{
+  QObjectList aChildren(theGrp->children());
+  QObject* anObj;
+  for(int i = 0; i < aChildren.size(); i++)
+  {
+    anObj = aChildren.at(i);
+    if (anObj !=0 && anObj->inherits("QHBoxLayout"))
+      ((QHBoxLayout*)anObj)->setEnabled(theState);
+  }
+}
+
+void SVTK_AxisWidget::onLabelsChecked()
+{
+  setEnabled(myLabelsGrp, myIsLabelsVisible->isChecked());
+}
+
+void SVTK_AxisWidget::onTicksChecked()
+{
+  setEnabled(myTicksGrp, myIsTicksVisible->isChecked());
+}
+
+void SVTK_AxisWidget::onNameChecked()
+{
+  setEnabled(myNameGrp, myIsNameVisible->isChecked());
+}
+
+void SVTK_AxisWidget::UseName(const bool toUse)
+{
+  myIsNameVisible->setChecked(toUse);
+}
+
+void SVTK_AxisWidget::SetName(const QString& theName)
+{
+  myAxisName->setText(theName);
+}
+
+void SVTK_AxisWidget::SetNameFont(const QColor& theColor,
+                                  const int theFont,
+                                  const bool theIsBold,
+                                  const bool theIsItalic,
+                                  const bool theIsShadow)
+{
+  myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow);
+}
+
+bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor)
+{
+  if (theActor == 0)
+    return false;
+
+  // Name
+
+  bool useName = theActor->GetTitleVisibility();
+  QString aTitle(theActor->GetTitle());
+
+  QColor aTitleColor(255, 255, 255);
+  int aTitleFontFamily = VTK_ARIAL;
+  bool isTitleBold = false;
+  bool isTitleItalic = false;
+  bool isTitleShadow = false;
+
+  vtkTextProperty* aTitleProp = theActor->GetTitleTextProperty();
+  if (aTitleProp !=0)
+  {
+    vtkFloatingPointType c[ 3 ];
+    aTitleProp->GetColor(c);
+    aTitleColor.setRgb((int)(c[ 0 ] * 255), (int)(c[ 1 ] * 255), (int)(c[ 2 ] * 255));
+    aTitleFontFamily = aTitleProp->GetFontFamily();
+    isTitleBold = aTitleProp->GetBold() ? true : false;
+    isTitleItalic = aTitleProp->GetItalic() ? true : false;
+    isTitleShadow = aTitleProp->GetShadow() ? true : false;
+  }
+
+  myIsNameVisible->setChecked(useName);
+  myAxisName->setText(aTitle);
+  myNameFont->SetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow);
+
+  // Labels
+
+  bool useLabels = theActor->GetLabelVisibility();
+  int nbLabels = theActor->GetNumberOfLabels();
+  int anOffset = theActor->GetTickOffset();
+
+  QColor aLabelsColor(255, 255, 255);
+  int aLabelsFontFamily = VTK_ARIAL;
+  bool isLabelsBold = false;
+  bool isLabelsItalic = false;
+  bool isLabelsShadow = false;
+
+  vtkTextProperty* aLabelsProp = theActor->GetLabelTextProperty();
+  if (aLabelsProp !=0)
+  {
+    vtkFloatingPointType c[ 3 ];
+    aLabelsProp->GetColor(c);
+    aLabelsColor.setRgb((int)(c[ 0 ] * 255), (int)(c[ 1 ] * 255), (int)(c[ 2 ] * 255));
+    aLabelsFontFamily = aLabelsProp->GetFontFamily();
+    isLabelsBold = aLabelsProp->GetBold() ? true : false;
+    isLabelsItalic = aLabelsProp->GetItalic() ? true : false;
+    isLabelsShadow = aLabelsProp->GetShadow() ? true : false;
+  }
+
+  myIsLabelsVisible->setChecked(useLabels);
+  myLabelNumber->setValue(nbLabels);
+  myLabelOffset->setValue(anOffset);
+  myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow);
+
+  // Tick marks
+  bool useTickMarks = theActor->GetTickVisibility();
+  int aTickLength = theActor->GetTickLength();
+
+  myIsTicksVisible->setChecked(useTickMarks);
+  myTickLength->setValue(aTickLength);
+
+  return true;
+}
+
+bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor)
+{
+   if (theActor == 0)
+    return false;
+
+  // Name
+
+  theActor->SetTitleVisibility(myIsNameVisible->isChecked() ? 1 : 0);
+  theActor->SetTitle(myAxisName->text().toLatin1());
+
+  QColor aTitleColor(255, 255, 255);
+  int aTitleFontFamily = VTK_ARIAL;
+  bool isTitleBold = false;
+  bool isTitleItalic = false;
+  bool isTitleShadow = false;
+
+  myNameFont->GetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow);
+  vtkTextProperty* aTitleProp = theActor->GetTitleTextProperty();
+  if (aTitleProp)
+  {
+    aTitleProp->SetColor(aTitleColor.red() / 255.,
+                          aTitleColor.green() / 255.,
+                          aTitleColor.blue() / 255.);
+    aTitleProp->SetFontFamily(aTitleFontFamily);
+
+    aTitleProp->SetBold(isTitleBold ? 1 : 0);
+    aTitleProp->SetItalic(isTitleItalic ? 1 : 0);
+    aTitleProp->SetShadow(isTitleShadow ? 1 : 0);
+
+    theActor->SetTitleTextProperty(aTitleProp);
+  }
+
+  // Labels
+
+  theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0);
+
+  int nbLabels = myLabelNumber->value();
+  theActor->SetNumberOfLabels(nbLabels);
+
+  int anOffset = myLabelOffset->value();
+  theActor->SetTickOffset(anOffset);
+
+  QColor aLabelsColor(255, 255, 255);
+  int aLabelsFontFamily = VTK_ARIAL;
+  bool isLabelsBold = false;
+  bool isLabelsItalic = false;
+  bool isLabelsShadow = false;
+
+  myLabelsFont->GetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow);
+  vtkTextProperty* aLabelsProp = theActor->GetLabelTextProperty();
+  if (aLabelsProp)
+  {
+    aLabelsProp->SetColor(aLabelsColor.red() / 255.,
+                          aLabelsColor.green() / 255.,
+                          aLabelsColor.blue() / 255.);
+    aLabelsProp->SetFontFamily(aLabelsFontFamily);
+
+    aLabelsProp->SetBold(isLabelsBold ? 1 : 0);
+    aLabelsProp->SetItalic(isLabelsItalic ? 1 : 0);
+    aLabelsProp->SetShadow(isLabelsShadow ? 1 : 0);
+
+    aLabelsProp->Modified();
+    theActor->SetLabelTextProperty(aLabelsProp);
+  }
+
+
+  // Tick marks
+  theActor->SetTickVisibility(myIsTicksVisible->isChecked());
+  int aTickLength = myTickLength->value();
+  theActor->SetTickLength(aTickLength);
+
+  return true;
+}
+
+/*
+  Class       : SVTK_CubeAxesDlg
+  Description : Dialog for specifynig cube axes properties
+*/
+
+/*!
+  Constructor
+*/
+SVTK_CubeAxesDlg::SVTK_CubeAxesDlg(QtxAction* theAction,
+                                  SVTK_MainWindow* theParent,
+                                  const char* theName):
+  SVTK_DialogBase(theAction,
+                 theParent, 
+                 theName),
+  myMainWindow(theParent)
+{
+  setWindowTitle(tr("CAPTION"));
+
+  QVBoxLayout* aLay = new QVBoxLayout(this);
+  aLay->setMargin(5);
+  aLay->setSpacing(5);
+  aLay->addWidget(createMainFrame(this));
+  aLay->addWidget(createButtonFrame(this));
+
+  connect(theParent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow()));
+  connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide()));
+}
+
+/*!
+  Create frame containing dialog's input fields
+*/
+QWidget* SVTK_CubeAxesDlg::createMainFrame(QWidget* theParent)
+{
+  QFrame* aFrame = new QFrame(theParent);
+
+  myTabWg = new QTabWidget(aFrame);
+
+  myAxes[ 0 ] = new SVTK_AxisWidget(myTabWg);
+  myAxes[ 1 ] = new SVTK_AxisWidget(myTabWg);
+  myAxes[ 2 ] = new SVTK_AxisWidget(myTabWg);
+
+  myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS"));
+  myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS"));
+  myTabWg->addTab(myAxes[ 2 ], tr("Z_AXIS"));
+
+  myTabWg->setContentsMargins(5,5,5,5);
+
+  myIsVisible = new QCheckBox(tr("IS_VISIBLE"), aFrame);
+
+  QVBoxLayout* aLay = new QVBoxLayout(aFrame);
+  aLay->setMargin(0);
+  aLay->setSpacing(5);
+  aLay->addWidget(myTabWg);
+  aLay->addWidget(myIsVisible);
+
+  return aFrame;
+}
+
+/*!
+  Create frame containing buttons
+*/
+QWidget* SVTK_CubeAxesDlg::createButtonFrame(QWidget* theParent)
+{
+  QFrame* aFrame = new QFrame(theParent);
+  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
+
+  myOkBtn    = new QPushButton(tr("BUT_OK"), aFrame);
+  myApplyBtn = new QPushButton(tr("BUT_APPLY"), aFrame);
+  myCloseBtn = new QPushButton(tr("BUT_CLOSE"), aFrame);
+
+  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+  QHBoxLayout* aLay = new QHBoxLayout(aFrame);
+  aLay->setMargin(5);
+  aLay->setSpacing(5);
+
+  aLay->addWidget(myOkBtn);
+  aLay->addWidget(myApplyBtn);
+  aLay->addItem(aSpacer);
+  aLay->addWidget(myCloseBtn);
+
+  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
+  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
+  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
+
+  return aFrame;
+}
+
+/*!
+  Destructor
+*/
+SVTK_CubeAxesDlg::~SVTK_CubeAxesDlg()
+{
+}
+
+/*!
+  Update dialog fields, connect signals and slots, show dialog
+*/
+void SVTK_CubeAxesDlg::Update()
+{
+  myActor = myMainWindow->GetCubeAxes();
+
+  myAxes[ 0 ]->ReadData(myActor->GetXAxisActor2D());
+  myAxes[ 1 ]->ReadData(myActor->GetYAxisActor2D());
+  myAxes[ 2 ]->ReadData(myActor->GetZAxisActor2D());
+
+  myIsVisible->setChecked(myActor->GetVisibility() ? true : false);
+}
+
+/*!
+  Verify validity of entry data
+*/
+bool SVTK_CubeAxesDlg::isValid() const
+{
+  return true;
+}
+
+/*!
+  Verify validity of entry data
+*/
+bool SVTK_CubeAxesDlg::onApply()
+{
+  bool isOk = true;
+
+  try
+  {
+    QWidget *aCurrWid = this->focusWidget();
+    aCurrWid->clearFocus();
+    aCurrWid->setFocus();
+
+    isOk = isOk && myAxes[ 0 ]->Apply(myActor->GetXAxisActor2D());
+    isOk = isOk && myAxes[ 1 ]->Apply(myActor->GetYAxisActor2D());
+    isOk = isOk && myAxes[ 2 ]->Apply(myActor->GetZAxisActor2D());
+
+
+    //myActor->SetXLabel(myAxes[ 0 ]->myAxisName->text());
+    //myActor->SetYLabel(myAxes[ 1 ]->myAxisName->text());
+    //myActor->SetZLabel(myAxes[ 2 ]->myAxisName->text());
+
+    //myActor->SetNumberOfLabels(myActor->GetXAxisActor2D()->GetNumberOfLabels());
+    if (myIsVisible->isChecked())
+      myActor->VisibilityOn();
+    else
+      myActor->VisibilityOff();
+
+    if (isOk)
+      myMainWindow->Repaint();
+  }
+  catch(...)
+  {
+    isOk = false;
+  }
+
+  return isOk;
+}
+
+/*!
+  SLOT called when "Ok" button pressed.
+*/
+void SVTK_CubeAxesDlg::onOk()
+{
+  if (onApply())
+    onClose();
+}
+
+/*!
+  SLOT: called when "Close" button pressed. Close dialog
+*/
+void SVTK_CubeAxesDlg::onClose()
+{
+  reject();
+}
diff --git a/src/SVTK/SVTK_CubeAxesDlg.h b/src/SVTK/SVTK_CubeAxesDlg.h
new file mode 100644 (file)
index 0000000..f573f94
--- /dev/null
@@ -0,0 +1,140 @@
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_CubeAxesDlg.h
+//  Author : Sergey LITONIN
+//  Module : VISU
+
+
+#ifndef SVTK_CubeAxesDlg_H
+#define SVTK_CubeAxesDlg_H
+
+#include "SVTK.h"
+#include "SVTK_DialogBase.h"
+
+#include <QFrame>
+
+class QWidget;
+class QPushButton;
+class QTabWidget;
+class QCheckBox;
+class QLineEdit;
+class QGroupBox;
+
+class QtxAction;
+class QtxIntSpinBox;
+
+class vtkAxisActor2D;
+class SVTK_CubeAxesActor2D;
+
+class SVTK_FontWidget;
+class SVTK_AxisWidget;
+class SVTK_MainWindow;
+
+/*!
+ * Class       : SVTK_CubeAxesDlg
+ * Description : Dialog for specifynig cube axes properties
+ */
+class SVTK_EXPORT SVTK_CubeAxesDlg : public SVTK_DialogBase
+{
+  Q_OBJECT
+
+public:
+                  SVTK_CubeAxesDlg(QtxAction* theAction,
+                                  SVTK_MainWindow* theParent,
+                                  const char* theName);
+  virtual         ~SVTK_CubeAxesDlg();
+
+  void            Update();
+
+private slots:
+  void            onOk();
+  bool            onApply();
+  void            onClose();
+
+private:
+  QWidget*        createButtonFrame( QWidget* );
+  QWidget*        createMainFrame  ( QWidget* );
+  bool            isValid() const;
+
+private:
+  SVTK_MainWindow *myMainWindow;
+  SVTK_CubeAxesActor2D* myActor;
+
+  QTabWidget*     myTabWg;
+  QCheckBox*      myIsVisible;
+
+  QPushButton*    myOkBtn;
+  QPushButton*    myApplyBtn;
+  QPushButton*    myCloseBtn;
+  SVTK_AxisWidget* myAxes[ 3 ];
+};
+
+/*!
+ * Class       : SVTK_AxisWidget
+ * Description : Tab of dialog
+ */
+class SVTK_EXPORT SVTK_AxisWidget : public QFrame
+{
+  Q_OBJECT
+
+public:
+                  SVTK_AxisWidget( QWidget* );
+                  ~SVTK_AxisWidget();
+
+  void            UseName( const bool );
+  void            SetName( const QString& );
+  void            SetNameFont( const QColor&, const int, const bool, const bool, const bool );
+  bool            ReadData( vtkAxisActor2D* );
+  bool            Apply( vtkAxisActor2D* );
+
+private slots:
+  void            onNameChecked();
+  void            onLabelsChecked();
+  void            onTicksChecked();
+
+private:
+  void            updateControlState();
+  void            setEnabled( QGroupBox*, const bool );
+
+private:
+  // name
+  QGroupBox*      myNameGrp;
+  QCheckBox*      myIsNameVisible;
+  QLineEdit*      myAxisName;
+  SVTK_FontWidget* myNameFont;
+
+  // labels
+  QGroupBox*      myLabelsGrp;
+  QCheckBox*      myIsLabelsVisible;
+  QtxIntSpinBox*  myLabelNumber;
+  QtxIntSpinBox*  myLabelOffset;
+  SVTK_FontWidget* myLabelsFont;
+
+  // tick marks
+  QGroupBox*      myTicksGrp;
+  QCheckBox*      myIsTicksVisible;
+  QtxIntSpinBox*  myTickLength;
+
+  friend class SVTK_CubeAxesDlg;
+};
+
+#endif
diff --git a/src/SVTK/SVTK_DeviceActor.cxx b/src/SVTK/SVTK_DeviceActor.cxx
new file mode 100644 (file)
index 0000000..a3bb037
--- /dev/null
@@ -0,0 +1,507 @@
+//  SVTK OBJECT : interactive object for SVTK visualization
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_DeviceActor.cxx
+//  Author : 
+//  Module : 
+//  $Header$
+
+
+#include "SVTK_DeviceActor.h"
+
+#include "VTKViewer_Transform.h"
+#include "VTKViewer_TransformFilter.h"
+#include "VTKViewer_GeometryFilter.h"
+
+// VTK Includes
+#include <vtkObjectFactory.h>
+#include <vtkShrinkFilter.h>
+
+#include <vtkPolyData.h>
+#include <vtkUnstructuredGrid.h>
+
+#include <vtkPolyDataMapper.h>
+#include <vtkDataSetMapper.h>
+
+#include <vtkPassThroughFilter.h>
+
+using namespace std;
+
+vtkStandardNewMacro(SVTK_DeviceActor);
+
+/*!
+  Constructor
+*/
+SVTK_DeviceActor
+::SVTK_DeviceActor()
+{
+  myIsShrunk = false;
+  myIsShrinkable = true;
+
+  myIsShaded = true;
+  myProperty = vtkProperty::New();
+  myRepresentation = SVTK::Representation::Surface;
+
+  myIsResolveCoincidentTopology = true;
+  vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
+                                                                myPolygonOffsetUnits);
+
+  myMapper = vtkDataSetMapper::New();
+
+  myShrinkFilter = vtkShrinkFilter::New();
+
+  myGeomFilter = VTKViewer_GeometryFilter::New();
+
+  myTransformFilter = VTKViewer_TransformFilter::New();
+
+  for(int i = 0; i < 6; i++)
+    myPassFilter.push_back(vtkPassThroughFilter::New());
+}
+
+/*!
+  Destructor
+*/
+SVTK_DeviceActor
+::~SVTK_DeviceActor()
+{
+  myMapper->Delete();
+
+  myProperty->Delete();
+
+  myGeomFilter->Delete();
+
+  myTransformFilter->Delete();
+
+  myShrinkFilter->Delete();
+
+  for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++)
+    myPassFilter[i]->Delete();
+}
+
+/*!
+  To insert some additional filters and then sets the given vtkMapper
+*/
+void
+SVTK_DeviceActor
+::SetMapper(vtkMapper* theMapper)
+{
+  InitPipeLine(theMapper);
+}
+
+/*!
+  To initialize internal pipeline
+*/
+void
+SVTK_DeviceActor
+::InitPipeLine(vtkMapper* theMapper)
+{
+  if(theMapper){
+    int anId = 0;
+    myPassFilter[ anId ]->SetInput( theMapper->GetInput() );
+    myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
+    
+    anId++; // 1
+    myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
+
+    anId++; // 2
+    myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() ); 
+    myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+
+    anId++; // 3
+    myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
+
+    anId++; // 4
+    myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
+    myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+
+    anId++; // 5
+    if(vtkDataSetMapper* aMapper = dynamic_cast<vtkDataSetMapper*>(theMapper)){
+      aMapper->SetInput(myPassFilter[anId]->GetOutput());
+    }else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper)){
+      aMapper->SetInput(myPassFilter[anId]->GetPolyDataOutput());
+    }
+  }
+  Superclass::SetMapper(theMapper);
+}
+
+/*!
+  Allows to get initial vtkDataSet
+*/
+vtkDataSet* 
+SVTK_DeviceActor
+::GetInput()
+{
+  return myPassFilter.front()->GetOutput();
+}
+
+/*!
+  Allows to set initial vtkDataSet
+*/
+void
+SVTK_DeviceActor
+::SetInput(vtkDataSet* theDataSet)
+{
+  myMapper->SetInput(theDataSet);
+  InitPipeLine(myMapper);
+}
+
+/*!
+  To provide VTK to Object and backward mapping
+*/
+void
+SVTK_DeviceActor::
+SetStoreMapping(bool theStoreMapping)
+{
+  myGeomFilter->SetStoreMapping(theStoreMapping);
+}
+
+
+/*!
+  \return time of modification
+*/
+unsigned long int 
+SVTK_DeviceActor
+::GetMTime()
+{
+  unsigned long mTime = this->Superclass::GetMTime();
+
+  mTime = max(mTime,myGeomFilter->GetMTime());
+
+  mTime = max(mTime,myTransformFilter->GetMTime());
+
+  if(myIsShrunk)
+    mTime = max(mTime,myShrinkFilter->GetMTime());
+
+  for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++)
+    max(mTime,myPassFilter[i]->GetMTime());
+
+  return mTime;
+}
+
+/*!
+  Apply a view transformation
+  \param theTransform - transformation
+*/
+void 
+SVTK_DeviceActor
+::SetTransform(VTKViewer_Transform* theTransform)
+{
+  myTransformFilter->SetTransform(theTransform);
+}
+
+/*!
+  \return true if actor is shrinkable
+*/
+bool
+SVTK_DeviceActor
+::IsShrunkable() 
+{ 
+  return myIsShrinkable;
+}
+
+/*!
+  Changes shrinkable state of actor
+  theIsShrinkable - new shrinkable state
+*/  
+void
+SVTK_DeviceActor
+::SetShrinkable(bool theIsShrinkable) 
+{ 
+  myIsShrinkable = theIsShrinkable;
+}
+  
+/*!
+  \return true if actor is shrunkable
+*/
+bool
+SVTK_DeviceActor
+::IsShrunk() 
+{ 
+  return myIsShrunk;
+}
+
+/*!
+  Insert shrink filter into pipeline
+*/
+void
+SVTK_DeviceActor
+::SetShrink() 
+{
+  if ( !myIsShrinkable ) 
+    return;
+  
+  if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
+  {     
+    aDataSet->Update();
+    int numCells=aDataSet->GetNumberOfCells();
+    int numPts = aDataSet->GetNumberOfPoints();
+    //It's impossible to use to apply "shrink" for "empty" dataset
+    if (numCells < 1 || numPts < 1)
+           return;
+    myShrinkFilter->SetInput( aDataSet );
+    myPassFilter[ 1 ]->SetInput( myShrinkFilter->GetOutput() );
+    myIsShrunk = true;
+  }
+}
+
+/*!
+  Remove shrink filter from pipeline
+*/
+void 
+SVTK_DeviceActor
+::UnShrink() 
+{
+  if ( !myIsShrunk ) return;
+  if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
+  {    
+    myPassFilter[ 1 ]->SetInput( aDataSet );
+    myIsShrunk = false;
+  }
+}
+
+/*!
+  \return shrink factor
+*/
+vtkFloatingPointType
+SVTK_DeviceActor
+::GetShrinkFactor()
+{
+  return myShrinkFilter->GetShrinkFactor();
+}
+
+/*!
+  Changes shrink factor
+  \param theValue - new shrink factor
+*/
+void 
+SVTK_DeviceActor
+::SetShrinkFactor(vtkFloatingPointType theValue)
+{
+  myShrinkFilter->SetShrinkFactor(theValue);
+}
+
+/*!
+  Set representation (VTK_SURFACE, VTK_POINTS, VTK_WIREFRAME and so on)
+  param theMode - new mode
+*/
+void
+SVTK_DeviceActor
+::SetRepresentation(SVTK::Representation::Type theMode)
+{ 
+  using namespace SVTK::Representation;
+  if(IsShaded()){
+    switch(myRepresentation){
+    case Points : 
+    case Surface : 
+      myProperty->SetAmbient(GetProperty()->GetAmbient());
+      myProperty->SetDiffuse(GetProperty()->GetDiffuse());
+      myProperty->SetSpecular(GetProperty()->GetSpecular());
+    }
+    
+    switch(theMode){
+    case Points : 
+    case Surface : 
+      GetProperty()->SetAmbient(myProperty->GetAmbient());
+      GetProperty()->SetDiffuse(myProperty->GetDiffuse());
+      GetProperty()->SetSpecular(myProperty->GetSpecular());
+      break;
+    default:
+      GetProperty()->SetAmbient(1.0);
+      GetProperty()->SetDiffuse(0.0);
+      GetProperty()->SetSpecular(0.0);
+    }
+  }
+
+  switch(theMode){
+  case Insideframe : 
+    myGeomFilter->SetInside(true);
+    myGeomFilter->SetWireframeMode(true);
+    GetProperty()->SetRepresentation(VTK_WIREFRAME);
+    break;
+  case Points : 
+    GetProperty()->SetPointSize(GetDefaultPointSize());  
+    GetProperty()->SetRepresentation(VTK_POINTS);
+    myGeomFilter->SetWireframeMode(false);
+    myGeomFilter->SetInside(false);
+    break;
+  case Wireframe : 
+    GetProperty()->SetRepresentation(VTK_WIREFRAME);
+    myGeomFilter->SetWireframeMode(true);
+    myGeomFilter->SetInside(false);
+    break;
+  case Surface : 
+    GetProperty()->SetRepresentation(VTK_SURFACE);
+    myGeomFilter->SetWireframeMode(false);
+    myGeomFilter->SetInside(false);
+    break;
+  }
+
+  myRepresentation = theMode;
+}
+
+/*!
+  \return current representation mode
+*/
+SVTK::Representation::Type 
+SVTK_DeviceActor
+::GetRepresentation()
+{
+  return myRepresentation;
+}
+
+/*!
+  \return default point size
+*/
+vtkFloatingPointType
+SVTK_DeviceActor
+::GetDefaultPointSize()
+{
+  return 5;
+}
+
+/*!
+  \return default line width
+*/
+vtkFloatingPointType
+SVTK_DeviceActor
+::GetDefaultLineWidth()
+{
+  return 3;
+}
+
+/*!
+  \return true if actor is shaded
+*/
+bool
+SVTK_DeviceActor
+::IsShaded()
+{
+  return myIsShaded;
+}
+
+/*!
+  Sets shaded state of actor
+  \param theShaded - new shaded state
+*/
+void
+SVTK_DeviceActor
+::SetShaded(bool theShaded)
+{
+  myIsShaded = theShaded;
+}
+
+/*!
+  Maps VTK index of a node to corresponding object index
+*/
+int
+SVTK_DeviceActor
+::GetNodeObjId(int theVtkID)
+{
+  return theVtkID;
+}
+
+/*!
+  Get coordinates of a node for given object index
+*/
+vtkFloatingPointType* 
+SVTK_DeviceActor
+::GetNodeCoord(int theObjID)
+{
+  return GetInput()->GetPoint(theObjID);
+}
+
+
+/*!
+  Get corresponding #vtkCell for given object index
+*/
+vtkCell* 
+SVTK_DeviceActor
+::GetElemCell(int theObjID)
+{
+  return GetInput()->GetCell(theObjID);
+}
+
+/*!
+  Maps VTK index of a cell to corresponding object index
+*/
+int
+SVTK_DeviceActor
+::GetElemObjId(int theVtkID) 
+{ 
+  return theVtkID;
+}
+
+/*!
+  Renders actor
+*/
+void
+SVTK_DeviceActor
+::Render(vtkRenderer *ren, vtkMapper* m)
+{
+  if(myIsResolveCoincidentTopology){
+    int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
+    vtkFloatingPointType aFactor, aUnit; 
+    vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
+    
+    vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
+    vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
+                                                                  myPolygonOffsetUnits);
+    Superclass::Render(ren,m);
+    
+    vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
+    vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology);
+  }else{
+    Superclass::Render(ren,m);
+  }
+}
+
+/*!
+  Set polygon offset parameters
+  \param factor, units  - Opengl polygon offset parameters
+*/
+void
+SVTK_DeviceActor
+::SetPolygonOffsetParameters(vtkFloatingPointType factor, 
+                            vtkFloatingPointType units)
+{
+  myPolygonOffsetFactor = factor;
+  myPolygonOffsetUnits = units;
+}
+
+/*!
+  Get polygon offset parameters
+  \param factor, units  - Opengl polygon offset parameters
+*/
+void
+SVTK_DeviceActor
+::GetPolygonOffsetParameters(vtkFloatingPointType& factor, 
+                            vtkFloatingPointType& units)
+{
+  factor = myPolygonOffsetFactor;
+  units = myPolygonOffsetUnits;
+}
+
+vtkDataSetMapper* SVTK_DeviceActor::GetDataSetMapper()
+{
+  return myMapper;
+}
diff --git a/src/SVTK/SVTK_DeviceActor.h b/src/SVTK/SVTK_DeviceActor.h
new file mode 100644 (file)
index 0000000..47fc3e1
--- /dev/null
@@ -0,0 +1,220 @@
+//  SVTK OBJECT : interactive object for SVTK visualization
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_DeviceActor.h
+//  Author : 
+//  Module : 
+//  $Header$
+
+#ifndef SVTK_DEVICE_ACTOR_H
+#define SVTK_DEVICE_ACTOR_H
+
+#include "SVTK.h"
+#include "VTKViewer.h"
+
+#include <vector>
+
+#include <vtkLODActor.h>
+#include <vtkProperty.h>
+
+class VTKViewer_Transform;
+class VTKViewer_TransformFilter;
+class VTKViewer_GeometryFilter;
+
+class vtkCell;
+class vtkDataSet;
+class vtkShrinkFilter;
+class vtkDataSetMapper;
+class vtkPassThroughFilter;
+
+namespace SVTK
+{
+  namespace Representation
+  {
+    typedef int Type;
+    const Type Points = VTK_POINTS;
+    const Type Wireframe = VTK_WIREFRAME;
+    const Type Surface = VTK_SURFACE;
+    const Type Insideframe = Surface + 1;
+  }
+}
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+class SVTK_EXPORT SVTK_DeviceActor: public vtkLODActor
+{
+ public:
+  vtkTypeMacro(SVTK_DeviceActor,vtkLODActor);
+
+  static
+  SVTK_DeviceActor* 
+  New();
+
+  //! Apply a view transformation
+  virtual
+  void
+  SetTransform(VTKViewer_Transform* theTransform); 
+
+  //! To insert some additional filters and then sets the given #vtkMapper
+  virtual
+  void
+  SetMapper(vtkMapper* theMapper); 
+
+  //! Allows to get initial #vtkDataSet
+  virtual
+  vtkDataSet* 
+  GetInput(); 
+
+  //! Allows to set initial #vtkDataSet
+  virtual
+  void
+  SetInput(vtkDataSet* theDataSet); 
+
+  /** @name For selection mapping purpose */
+  //@{
+  virtual
+  int
+  GetNodeObjId(int theVtkID);
+
+  virtual
+  vtkFloatingPointType* 
+  GetNodeCoord(int theObjID);
+
+  virtual
+  int
+  GetElemObjId(int theVtkID);
+
+  virtual
+  vtkCell* 
+  GetElemCell(int theObjID);
+
+  //! To provide VTK to Object and backward mapping
+  virtual 
+  void
+  SetStoreMapping(bool theStoreMapping);
+  //@}
+
+  virtual 
+  unsigned long int 
+  GetMTime();
+
+  /** @name For shrink mamnagement purpose */
+  //@{
+  vtkFloatingPointType
+  GetShrinkFactor();
+
+  virtual 
+  void  
+  SetShrinkFactor(vtkFloatingPointType value);
+
+  virtual
+  void
+  SetShrinkable(bool theIsShrinkable);
+
+  bool
+  IsShrunkable();
+
+  bool
+  IsShrunk();
+
+  virtual
+  void
+  SetShrink(); 
+
+  virtual
+  void
+  UnShrink(); 
+  //@}
+
+  /** @name For representation mamnagement purpose */
+  virtual
+  void 
+  SetRepresentation(SVTK::Representation::Type theMode);
+
+  SVTK::Representation::Type 
+  GetRepresentation();
+
+  virtual
+  vtkFloatingPointType
+  GetDefaultPointSize();
+
+  virtual
+  vtkFloatingPointType
+  GetDefaultLineWidth();
+
+  bool
+  IsShaded();
+
+  void
+  SetShaded(bool theShaded);
+  //@}
+
+  virtual
+  void
+  Render(vtkRenderer *, vtkMapper *);
+
+  vtkDataSetMapper* GetDataSetMapper();
+
+ protected:
+  SVTK::Representation::Type myRepresentation;
+  vtkProperty *myProperty;
+  bool myIsShaded;
+
+  //! To initialize internal pipeline
+  void
+  InitPipeLine(vtkMapper* theMapper); 
+
+  VTKViewer_GeometryFilter *myGeomFilter;
+  VTKViewer_TransformFilter *myTransformFilter;
+  std::vector<vtkPassThroughFilter*> myPassFilter;
+  vtkShrinkFilter* myShrinkFilter;
+  vtkDataSetMapper* myMapper;
+
+  bool myIsShrinkable;
+  bool myIsShrunk;
+  
+  bool myIsResolveCoincidentTopology;
+  vtkFloatingPointType myPolygonOffsetFactor;
+  vtkFloatingPointType myPolygonOffsetUnits;
+
+  void SetPolygonOffsetParameters(vtkFloatingPointType factor, 
+                                 vtkFloatingPointType units);
+  void GetPolygonOffsetParameters(vtkFloatingPointType& factor, 
+                                 vtkFloatingPointType& units);
+
+  SVTK_DeviceActor();
+  ~SVTK_DeviceActor();
+
+ private:
+  SVTK_DeviceActor(const SVTK_DeviceActor&); // Not implemented
+  void operator=(const SVTK_DeviceActor&); // Not implemented
+
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif //SVTK_DEVICE_ACTOR_H
diff --git a/src/SVTK/SVTK_DialogBase.cxx b/src/SVTK/SVTK_DialogBase.cxx
new file mode 100644 (file)
index 0000000..7aeedd1
--- /dev/null
@@ -0,0 +1,85 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#include "SVTK_DialogBase.h"
+
+#include "QtxAction.h"
+
+/*!
+  Constructor
+*/
+SVTK_DialogBase
+::SVTK_DialogBase(QtxAction* theAction,
+                 QWidget* theParent,
+                 const char* theName, 
+                 bool theModal, 
+                 Qt::WindowFlags theWFalgs):
+  QDialog(theParent, 
+         theWFalgs | Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
+  myAction(theAction)
+{
+  setObjectName(theName);
+  setModal(theModal);
+
+  connect(theParent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow()));
+  connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide()));
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+SVTK_DialogBase
+::~SVTK_DialogBase()
+{
+  // no need to delete child widgets, Qt does it all for us
+}
+
+void 
+SVTK_DialogBase
+::onParentShow()
+{
+  if(myAction->isChecked())
+    show();
+  else
+    hide();
+}
+
+void 
+SVTK_DialogBase
+::onParentHide()
+{
+  hide();
+}
+
+void 
+SVTK_DialogBase
+::done( int r )
+{
+  myAction->setChecked( false );
+  QDialog::done( r );
+}
diff --git a/src/SVTK/SVTK_DialogBase.h b/src/SVTK/SVTK_DialogBase.h
new file mode 100644 (file)
index 0000000..8d3ae0f
--- /dev/null
@@ -0,0 +1,60 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_DIALOGBASE_H
+#define SVTK_DIALOGBASE_H
+
+#include "SVTK.h"
+
+#include <QDialog>
+
+class QtxAction;
+
+class SVTK_EXPORT SVTK_DialogBase : public QDialog
+{
+  Q_OBJECT;
+
+public:
+  SVTK_DialogBase(QtxAction* theAction,
+                 QWidget* theParent,
+                 const char* theName = "", 
+                 bool theModal = FALSE, 
+                 Qt::WindowFlags theWFalgs = 0);
+
+  ~SVTK_DialogBase();
+
+protected slots:
+  void onParentShow();
+  void onParentHide();
+  virtual void done( int );
+
+protected:
+  QtxAction* myAction;
+};
+
+#endif // SVTK_DIALOGBASE_H
diff --git a/src/SVTK/SVTK_Event.h b/src/SVTK/SVTK_Event.h
new file mode 100644 (file)
index 0000000..00a9e2c
--- /dev/null
@@ -0,0 +1,76 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : Alexander SLADKOV
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_Event_h
+#define SVTK_Event_h
+
+#include <vtkCommand.h>
+
+namespace SVTK
+{
+  enum Event 
+  {
+    SpaceMouseMoveEvent = vtkCommand::UserEvent + 1000, 
+    SpaceMouseButtonEvent,
+    PanLeftEvent,
+    PanRightEvent,
+    PanUpEvent,
+    PanDownEvent,
+    ZoomInEvent,
+    ZoomOutEvent,
+    RotateLeftEvent,
+    RotateRightEvent,
+    RotateUpEvent,
+    RotateDownEvent,
+    PlusSpeedIncrementEvent,
+    MinusSpeedIncrementEvent,
+    SetSpeedIncrementEvent,
+
+    SetSMDecreaseSpeedEvent,
+    SetSMIncreaseSpeedEvent,
+    SetSMDominantCombinedSwitchEvent,
+
+    StartZoom,
+    StartPan,
+    StartRotate,
+    StartGlobalPan,
+    StartFitArea,
+
+    SetRotateGravity,
+    StartPointSelection,
+    SetRotateSelected,
+    
+    BBCenterChanged,
+    RotationPointChanged,
+    ChangeRotationPoint,
+        
+    LastEvent
+  };
+}
+  
+#endif
diff --git a/src/SVTK/SVTK_Extension.cxx b/src/SVTK/SVTK_Extension.cxx
new file mode 100755 (executable)
index 0000000..a26dac1
--- /dev/null
@@ -0,0 +1,44 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2004  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.org 
+//
+//
+//
+//  File   : SVTK_Extension.cxx
+//  Author : Sergey ANIKIN
+//  Module : SALOME
+
+#include "SVTK_Extension.h"
+
+#ifdef WIN32
+#include <windows.h>
+#else
+#include <dlfcn.h>
+#endif
+
+void* SVTK::getOpenGLExtension( const char* theExtension )
+{
+#ifdef WIN32
+  return wglGetProcAddress( theExtension );
+#else
+  void* OpenGLLibrary = dlopen( "libGL.so", RTLD_LAZY );
+  return dlsym( OpenGLLibrary, theExtension );
+#endif
+}
diff --git a/src/SVTK/SVTK_Extension.h b/src/SVTK/SVTK_Extension.h
new file mode 100755 (executable)
index 0000000..0b39e59
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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/
+//
+#ifndef SVTK_Extension_H
+#define SVTK_Extension_H
+
+/*!
+  \file SVTK_Extension.h
+  Functions of loading OpenGL extensions.
+*/
+
+#include <SVTK.h>
+
+namespace SVTK
+{
+  SVTK_EXPORT void* getOpenGLExtension( const char* theExtension );
+}
+
+
+#endif
diff --git a/src/SVTK/SVTK_FontWidget.cxx b/src/SVTK/SVTK_FontWidget.cxx
new file mode 100644 (file)
index 0000000..b32f7ab
--- /dev/null
@@ -0,0 +1,138 @@
+//  VISU VISUGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : Sergey LITONIN
+//  Module : 
+
+#include "SVTK_FontWidget.h"
+
+#include <QToolButton>
+#include <QComboBox>
+#include <QColorDialog>
+#include <QCheckBox>
+#include <QHBoxLayout>
+
+#include <vtkTextProperty.h>
+
+/*!
+ * Class       : SVTK_FontWidget
+ * Description : Dialog for specifynig font
+ */
+
+/*!
+  Constructor
+*/
+SVTK_FontWidget::SVTK_FontWidget( QWidget* theParent )
+: QWidget( theParent )
+{
+  myColorBtn = new QToolButton( this );
+  myColorBtn->setMinimumWidth( 20 );
+
+  myFamily = new QComboBox( this );
+  myFamily->insertItem( myFamily->count(), tr( "ARIAL" ) );
+  myFamily->insertItem( myFamily->count(), tr( "COURIER" ) );
+  myFamily->insertItem( myFamily->count(), tr( "TIMES" ) );
+
+  myBold = new QCheckBox( tr( "BOLD" ), this );
+  myItalic = new QCheckBox( tr( "ITALIC" ), this );
+  myShadow = new QCheckBox( tr( "SHADOW" ), this );
+
+  QHBoxLayout* aHBLayout = new QHBoxLayout;
+  aHBLayout->setSpacing( 5 );
+  aHBLayout->addWidget(myColorBtn);
+  aHBLayout->addWidget(myFamily);
+  aHBLayout->addWidget(myBold);
+  aHBLayout->addWidget(myItalic);
+  aHBLayout->addWidget(myShadow);
+  this->setLayout(aHBLayout);
+
+  connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) );
+}
+
+/*!
+  Destructor
+*/
+SVTK_FontWidget::~SVTK_FontWidget()
+{
+}
+
+void SVTK_FontWidget::SetColor( const QColor& theColor )
+{
+  QPalette palette;
+  palette.setColor(myColorBtn->backgroundRole(), theColor);
+  myColorBtn->setPalette(palette);
+}
+
+QColor SVTK_FontWidget::GetColor() const
+{
+  return myColorBtn->palette().color( myColorBtn->backgroundRole() );
+}
+
+void SVTK_FontWidget::onColor()
+{
+  QColor aColor = QColorDialog::getColor( GetColor(), this );
+  if ( aColor.isValid() )
+    SetColor( aColor );
+}
+
+void SVTK_FontWidget::SetData( const QColor& theColor,
+                              const int theFamily,
+                              const bool theBold,
+                              const bool theItalic,
+                              const bool theShadow )
+{
+  SetColor( theColor );
+
+  if ( theFamily == VTK_ARIAL )
+    myFamily->setCurrentIndex( 0 );
+  else if ( theFamily == VTK_COURIER )
+    myFamily->setCurrentIndex( 1 );
+  else
+    myFamily->setCurrentIndex( 2 );
+
+  myBold->setChecked( theBold );
+  myItalic->setChecked( theItalic );
+  myShadow->setChecked( theShadow );
+}
+
+void SVTK_FontWidget::GetData( QColor& theColor,
+                              int& theFamily,
+                              bool& theBold,
+                              bool& theItalic,
+                              bool& theShadow ) const
+{
+  theColor = GetColor();
+
+  int anItem =myFamily->currentIndex();
+  if ( anItem == 0 )
+    theFamily = VTK_ARIAL;
+  else if ( anItem == 1 )
+    theFamily = VTK_COURIER;
+  else
+    theFamily = VTK_TIMES;
+
+  theBold = myBold->isChecked();
+  theItalic = myItalic->isChecked();
+  theShadow = myShadow->isChecked();
+}
diff --git a/src/SVTK/SVTK_FontWidget.h b/src/SVTK/SVTK_FontWidget.h
new file mode 100644 (file)
index 0000000..3c10e1a
--- /dev/null
@@ -0,0 +1,70 @@
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : Sergey LITONIN
+//  Module : 
+
+
+#ifndef SVTK_FontWidget_H
+#define SVTK_FontWidget_H
+
+#include "SVTK.h"
+
+#include <QWidget>
+
+class QToolButton;
+class QComboBox;
+class QCheckBox;
+class QColor;
+
+
+/*!
+ * Class       : SVTK_FontWidget
+ * Description : Dialog for specifynig font
+ */
+class SVTK_EXPORT SVTK_FontWidget : public QWidget
+{
+  Q_OBJECT
+
+public:
+                SVTK_FontWidget( QWidget* );
+  virtual       ~SVTK_FontWidget();
+
+  void          SetColor( const QColor& );
+  QColor        GetColor() const;
+
+  void          SetData( const QColor&, const int, const bool, const bool, const bool );
+
+  void          GetData( QColor&, int&, bool&, bool&, bool& ) const;
+
+private slots:
+  void          onColor();
+
+private:
+  QToolButton*  myColorBtn;
+  QComboBox*    myFamily;
+  QCheckBox*    myBold;
+  QCheckBox*    myItalic;
+  QCheckBox*    myShadow;
+};
+
+#endif
diff --git a/src/SVTK/SVTK_Functor.h b/src/SVTK/SVTK_Functor.h
new file mode 100644 (file)
index 0000000..d76a935
--- /dev/null
@@ -0,0 +1,109 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 SVTK_Functor_H
+#define SVTK_Functor_H
+
+#include <functional>
+
+#include <string>
+
+#include <VTKViewer_Functor.h>
+
+#include "SALOME_InteractiveObject.hxx"
+
+/*!
+  \file SVTK_Functor.h
+  This file contains numbers of functors that allows user to perform corresponding operations with existing presentations.
+  Combination with algorithms it gives powerful, flexible and simple to extend way to introduce new type of operation.
+*/
+
+namespace SVTK
+{
+  using namespace VTK;
+
+  //! This functor check, if the actor have pointed entry
+  template<class TActor> 
+  struct TIsSameEntry
+  {
+    std::string myEntry;
+    //! To construct the functor
+    TIsSameEntry(const char* theEntry): 
+      myEntry(theEntry) 
+    {}
+    //! To calculate the functor
+    bool operator()(TActor* theActor)
+    {
+      if ( theActor->hasIO() )
+      {
+       Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
+       if ( anIO->hasEntry() )
+         return myEntry == anIO->getEntry();
+      }
+      return false;
+    }
+  };
+
+
+  //----------------------------------------------------------------
+  //! This functor check, if the actor point to the same #SALOME_InteractiveObject
+  template<class TActor> 
+  struct TIsSameIObject
+  {
+    Handle(SALOME_InteractiveObject) myIObject;
+    //! To construct the functor
+    TIsSameIObject(const Handle(SALOME_InteractiveObject)& theIObject):
+      myIObject(theIObject)
+    {}
+    //! To calculate the functor
+    bool operator()(TActor* theActor)
+    {
+      if(theActor->hasIO())
+      {
+       Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
+       return myIObject->isSame(anIO);
+      }
+      return false;
+    }
+  };
+
+
+  //----------------------------------------------------------------
+  /*!
+    This highlight every input actor
+  */
+  template<class TActor> 
+  struct THighlight
+  {
+    bool myIsHighlight;
+    //! To construct the functor
+    THighlight(bool theIsHighlight):
+      myIsHighlight( theIsHighlight ) 
+    {}
+    //! To calculate the functor
+    void operator()(TActor* theActor) 
+    {
+      if(theActor->GetVisibility() && theActor->GetMapper())
+       theActor->highlight( myIsHighlight );
+    }
+  };
+
+}
+
+
+#endif
diff --git a/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx b/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx
new file mode 100644 (file)
index 0000000..3dffbae
--- /dev/null
@@ -0,0 +1,169 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#include "SVTK_GenericRenderWindowInteractor.h"
+#include "SVTK_Selector.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkCommand.h>
+
+#include <QTimer>
+
+using namespace std;
+
+vtkStandardNewMacro(QVTK_GenericRenderWindowInteractor);
+
+/*!
+  Constructor
+*/
+QVTK_GenericRenderWindowInteractor
+::QVTK_GenericRenderWindowInteractor()
+{
+  myTimer = new QTimer( ) ;
+  connect(myTimer, SIGNAL(timeout()), this, SLOT(OnTimeOut())) ;
+}
+
+/*!
+  Destructor
+*/
+QVTK_GenericRenderWindowInteractor
+::~QVTK_GenericRenderWindowInteractor()
+{
+  delete myTimer;
+}
+
+/*!
+  The slot connects to QTimer::timeout signal to invoke vtkCommand::TimerEvent
+*/
+void
+QVTK_GenericRenderWindowInteractor
+::OnTimeOut() 
+{
+  if( GetEnabled() ) {
+    this->InvokeEvent(vtkCommand::TimerEvent,NULL);
+  }
+}
+
+/*!
+  Starts the QTimer instance on defined microseconds
+*/
+int
+QVTK_GenericRenderWindowInteractor
+::CreateTimer(int vtkNotUsed(timertype)) 
+{
+  //
+  // Start a one-shot timer for <DELAY> ms. 
+  //
+  static int DELAY = 1;
+  myTimer->setSingleShot(TRUE);
+  myTimer->start(DELAY);
+  return 1;
+}
+
+/*!
+  Stops the QTimer instance
+*/
+int
+QVTK_GenericRenderWindowInteractor
+::DestroyTimer(void) 
+{
+  //
+  // :TRICKY: Tue May  2 00:17:32 2000 Pagey
+  //
+  // QTimer will automatically expire after 10ms. So 
+  // we do not need to do anything here. In fact, we 
+  // should not even Stop() the QTimer here because doing 
+  // this will skip some of the processing that the TimerFunc()
+  // does and will result in undesirable effects. For 
+  // example, this will result in vtkLODActor to leave
+  // the models in low-res mode after the mouse stops
+  // moving. 
+  //
+  return 1;
+}
+
+
+vtkStandardNewMacro(SVTK_GenericRenderWindowInteractor);
+
+/*!
+  Constructor
+*/
+SVTK_GenericRenderWindowInteractor
+::SVTK_GenericRenderWindowInteractor():
+  myRenderWidget(NULL)
+{
+}
+
+/*!
+  Destructor
+*/
+SVTK_GenericRenderWindowInteractor
+::~SVTK_GenericRenderWindowInteractor()
+{
+}
+
+/*!
+  To get access to SVTK_Selector
+*/
+SVTK_Selector*
+SVTK_GenericRenderWindowInteractor
+::GetSelector()
+{
+  return mySelector.GetPointer();
+}
+
+/*!
+  To initialize mySelector field
+  \param theSelector - new selector
+*/
+void
+SVTK_GenericRenderWindowInteractor
+::SetSelector(SVTK_Selector* theSelector)
+{
+  mySelector = theSelector;
+}
+
+/*!
+  To get access to QWidget, where vtkRenderWindow maps to.
+*/
+QWidget*
+SVTK_GenericRenderWindowInteractor
+::GetRenderWidget()
+{
+  return myRenderWidget;
+}
+
+/*!
+  To initialize myRenderWidget field.
+*/
+void
+SVTK_GenericRenderWindowInteractor
+::SetRenderWidget(QWidget* theRenderWidget)
+{
+  myRenderWidget = theRenderWidget;
+}
diff --git a/src/SVTK/SVTK_GenericRenderWindowInteractor.h b/src/SVTK/SVTK_GenericRenderWindowInteractor.h
new file mode 100644 (file)
index 0000000..9bb7cbf
--- /dev/null
@@ -0,0 +1,133 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_GenericRenderWindowInteractor_h
+#define SVTK_GenericRenderWindowInteractor_h
+
+#include "SVTK.h"
+
+#include <QObject>
+#include <vtkGenericRenderWindowInteractor.h>
+#include <vtkSmartPointer.h>
+
+class QTimer;
+class QWidget;
+
+class SVTK_Selector;
+//class SVTK_Renderer;
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+/*!
+  \class QVTK_GenericRenderWindowInteractor
+  Introduction of the class is intended to implement Qt based #CreateTimer and #DestroyTimer functionality.
+  The class intendes to implement platform indepenedant subclass of vtkRenderWindowInteractor.
+  This is done by usage of Qt library.
+  \note
+  The Signal/Slot mechanism used by Qt requires that QObject 
+  appear as the first class when using multiple inheritance. 
+  Hence the order of the two classes QObject and vtkRenderWindowInteractor
+  matters here. So, be careful, not to change the sequence of the inheritance by accident. 
+*/
+class SVTK_EXPORT QVTK_GenericRenderWindowInteractor: 
+ public QObject,
+ public vtkGenericRenderWindowInteractor
+{
+  Q_OBJECT;
+
+ public:
+  static QVTK_GenericRenderWindowInteractor* New();
+  vtkTypeMacro(QVTK_GenericRenderWindowInteractor,vtkGenericRenderWindowInteractor);
+
+  //! Starts the QTimer instance on defined microseconds
+  virtual
+  int
+  CreateTimer( int ) ; 
+
+  //! Stops the QTimer instance
+  virtual
+  int
+  DestroyTimer() ; 
+
+ protected slots:
+  //! The slot connects to QTimer::timeout signal to invoke vtkCommand::TimerEvent
+  void
+  OnTimeOut();
+
+ protected:
+  QVTK_GenericRenderWindowInteractor(); //!< Instatiate QTimer
+  ~QVTK_GenericRenderWindowInteractor(); //!< Destroy the instance of QTimer
+
+  QTimer* myTimer; //!< Qt timer device
+};
+
+
+/*!
+  \class SVTK_GenericRenderWindowInteractor
+  This class introduce SALOME specific to the base one
+  In this class new members is added (#mySelector and #myRenderWidget).
+  They are used for initialization of #SVTK_InteractorStyle by redefinition of
+  #SVTK_InteractorStyle::SetInteractor method
+*/
+class SVTK_EXPORT SVTK_GenericRenderWindowInteractor: public QVTK_GenericRenderWindowInteractor
+{
+ public:
+  static SVTK_GenericRenderWindowInteractor* New();
+  vtkTypeMacro(SVTK_GenericRenderWindowInteractor,QVTK_GenericRenderWindowInteractor);
+
+  //! To get access to SVTK_Selector
+  SVTK_Selector* 
+  GetSelector(); 
+
+  //! To initialize mySelector field
+  void
+  SetSelector(SVTK_Selector* theSelector);
+
+  //! To get access to QWidget, where vtkRenderWindow maps to.
+  QWidget*
+  GetRenderWidget();
+
+  //! To initialize myRenderWidget field.
+  void
+  SetRenderWidget(QWidget* theRenderWidget);
+
+ protected:
+  SVTK_GenericRenderWindowInteractor();
+  ~SVTK_GenericRenderWindowInteractor();
+
+  vtkSmartPointer<SVTK_Selector> mySelector; //!< Keeps a pointer to SVTK_Selector
+  QWidget* myRenderWidget; //!< Keeps a pointer to QWidget, where vtkRenderWindow maps to.
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx
new file mode 100644 (file)
index 0000000..e9032bd
--- /dev/null
@@ -0,0 +1,1769 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+
+#include "SVTK_InteractorStyle.h"
+
+#include "VTKViewer_Utilities.h"
+#include "SVTK_GenericRenderWindowInteractor.h"
+
+#include "SVTK_Selection.h"
+#include "SVTK_Event.h" 
+#include "SVTK_Selector.h"
+#include "SVTK_Functor.h"
+#include "SVTK_Actor.h"
+
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+
+#include "SUIT_Tools.h"
+#include "SALOME_Actor.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkMath.h>
+#include <vtkCommand.h>
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkPicker.h>
+#include <vtkPointPicker.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkCallbackCommand.h>
+#include <vtkRendererCollection.h>
+#include <vtkDataSet.h>
+#include <vtkPerspectiveTransform.h> 
+#include <vtkMatrix4x4.h>
+
+#include <QPixmap>
+#include <QWidget>
+#include <QRubberBand>
+
+#include <algorithm>
+#include <iostream>
+
+using namespace std;
+
+namespace
+{
+  inline 
+  void
+  GetEventPosition(vtkRenderWindowInteractor* theInteractor,
+                  int& theX, 
+                  int& theY)
+  {
+    theInteractor->GetEventPosition(theX,theY);
+    theY = theInteractor->GetSize()[1] - theY - 1;
+  }
+
+  //==================================================================
+  // function : GetFirstSALOMEActor
+  // purpose  :
+  //==================================================================
+  struct THaveIO
+  {
+    bool
+    operator()(SALOME_Actor* theActor)
+    {
+      return theActor->hasIO();
+    }
+  };
+
+  inline
+  SALOME_Actor* 
+  GetFirstSALOMEActor(vtkPicker *thePicker)
+  {
+    return VTK::Find<SALOME_Actor>(thePicker->GetActors(),THaveIO());
+  }
+}
+
+
+vtkStandardNewMacro(SVTK_InteractorStyle);
+
+/*!
+  Constructor
+*/
+SVTK_InteractorStyle
+::SVTK_InteractorStyle():
+  mySelectionEvent(new SVTK_SelectionEvent()),
+  myPicker(vtkPicker::New()),
+  myPointPicker(vtkPointPicker::New()),
+  myLastHighlitedActor(NULL),
+  myLastPreHighlitedActor(NULL),
+  myControllerIncrement(SVTK_ControllerIncrement::New()),
+  myControllerOnKeyDown(SVTK_ControllerOnKeyDown::New()),
+  myHighlightRotationPointActor(SVTK_Actor::New()),
+  myRectBand(0)
+{
+  myPicker->Delete();
+  myPointPicker->Delete();
+
+  myPointPicker->SetTolerance(0.025);
+
+  this->MotionFactor = 10.0;
+  this->State = VTK_INTERACTOR_STYLE_CAMERA_NONE;
+  this->RadianToDegree = 180.0 / vtkMath::Pi();
+  this->ForcedState = VTK_INTERACTOR_STYLE_CAMERA_NONE;
+
+  loadCursors();
+
+  // set custom event handling function (to handle 3d space mouse events)
+  EventCallbackCommand->SetCallback( SVTK_InteractorStyle::ProcessEvents );
+
+  // set default values of properties.  user may edit them in preferences.
+  mySMDecreaseSpeedBtn = 1;
+  mySMIncreaseSpeedBtn = 2;
+  mySMDominantCombinedSwitchBtn = 9;
+  //
+  myControllerIncrement->Delete();
+  myControllerOnKeyDown->Delete();
+
+  myCurrRotationPointType = SVTK::SetRotateGravity;
+  myPrevRotationPointType = myCurrRotationPointType;
+
+  myHighlightRotationPointActor->Delete();
+  myHighlightRotationPointActor->Initialize();
+  myHighlightRotationPointActor->PickableOff();
+  myHighlightRotationPointActor->SetVisibility( false );
+  
+  myHighlightRotationPointActor->GetProperty()->SetPointSize(SALOME_POINT_SIZE+2);
+  myHighlightRotationPointActor->GetProperty()->SetLineWidth(SALOME_LINE_WIDTH+2);
+  myHighlightRotationPointActor->GetProperty()->SetRepresentationToPoints();
+
+  myBBFirstCheck = true;
+}
+
+/*!
+  Destructor
+*/
+SVTK_InteractorStyle
+::~SVTK_InteractorStyle() 
+{
+  endDrawRect();
+}
+
+/*!
+  \return widget for rendering
+*/
+QWidget*
+SVTK_InteractorStyle
+::GetRenderWidget()
+{
+  return myInteractor->GetRenderWidget();
+}
+
+/*!
+  \return selector
+*/
+SVTK_Selector*
+SVTK_InteractorStyle
+::GetSelector() 
+{
+  return myInteractor->GetSelector();
+}
+
+/*!
+  Generate special SVTK_SelectionEvent
+*/
+SVTK_SelectionEvent*
+SVTK_InteractorStyle
+::GetSelectionEvent()
+{
+  mySelectionEvent->mySelectionMode = GetSelector()->SelectionMode();
+
+  mySelectionEvent->myIsCtrl = Interactor->GetControlKey();
+  mySelectionEvent->myIsShift = Interactor->GetShiftKey();
+
+  mySelectionEvent->myLastX = mySelectionEvent->myX;
+  mySelectionEvent->myLastY = mySelectionEvent->myY;
+
+  GetEventPosition( this->Interactor, mySelectionEvent->myX, mySelectionEvent->myY );
+
+  return mySelectionEvent.get();
+}
+
+/*!
+  Generate special SVTK_SelectionEvent with flipped Y coordinate
+*/
+SVTK_SelectionEvent*
+SVTK_InteractorStyle
+::GetSelectionEventFlipY()
+{
+  mySelectionEvent->mySelectionMode = GetSelector()->SelectionMode();
+
+  mySelectionEvent->myIsCtrl = Interactor->GetControlKey();
+  mySelectionEvent->myIsShift = Interactor->GetShiftKey();
+
+  mySelectionEvent->myLastX = mySelectionEvent->myX;
+  mySelectionEvent->myLastY = mySelectionEvent->myY;
+
+  this->Interactor->GetEventPosition(mySelectionEvent->myX, mySelectionEvent->myY);
+
+  return mySelectionEvent.get();
+}
+
+void
+SVTK_InteractorStyle
+::RotateXY(int dx, int dy)
+{
+  /*   if(GetCurrentRenderer() == NULL)
+    return;
+  
+  int *size = GetCurrentRenderer()->GetRenderWindow()->GetSize();
+  double aDeltaElevation = -20.0 / size[1];
+  double aDeltaAzimuth = -20.0 / size[0];
+  
+  double rxf = double(dx) * aDeltaAzimuth * this->MotionFactor;
+  double ryf = double(dy) * aDeltaElevation * this->MotionFactor;
+  
+  vtkCamera *cam = GetCurrentRenderer()->GetActiveCamera();
+  cam->Azimuth(rxf);
+  cam->Elevation(ryf);
+  cam->OrthogonalizeViewUp();
+
+  GetCurrentRenderer()->ResetCameraClippingRange(); 
+
+  this->Render();*/
+
+  if(GetCurrentRenderer() == NULL)
+    return;
+  
+  vtkCamera *cam = GetCurrentRenderer()->GetActiveCamera();
+
+  double viewFP[3], viewPos[3];
+  cam->GetFocalPoint(viewFP);
+  cam->GetPosition(viewPos);
+
+  if ( myCurrRotationPointType == SVTK::SetRotateGravity )
+  {
+    vtkFloatingPointType aCenter[3];
+    if ( ComputeBBCenter(GetCurrentRenderer(),aCenter) ) 
+    {
+      myRotationPointX = aCenter[0];
+      myRotationPointY = aCenter[1];
+      myRotationPointZ = aCenter[2];
+    }
+  }
+
+  // Calculate corresponding transformation
+  vtkPerspectiveTransform* aTransform = vtkPerspectiveTransform::New();
+  aTransform->Identity();
+  aTransform->Translate(+myRotationPointX, +myRotationPointY, +myRotationPointZ);
+
+  // Azimuth transformation
+  int *size = GetCurrentRenderer()->GetRenderWindow()->GetSize();
+  double aDeltaAzimuth = -20.0 / size[0];
+  
+  double rxf = double(dx) * aDeltaAzimuth * this->MotionFactor;
+  aTransform->RotateWXYZ(rxf, cam->GetViewUp());
+
+  // Elevation transformation
+  double aDeltaElevation = -20.0 / size[1];
+
+  double ryf = double(dy) * aDeltaElevation * this->MotionFactor;
+  vtkMatrix4x4* aMatrix = cam->GetViewTransformMatrix();
+  const double anAxis[3] = {-aMatrix->GetElement(0,0), // mkr : 27.11.2006 : PAL14011 - Strange behaviour in rotation in VTK Viewer.
+                           -aMatrix->GetElement(0,1), 
+                           -aMatrix->GetElement(0,2)};
+  
+  aTransform->RotateWXYZ(ryf, anAxis);
+            
+  aTransform->Translate(-myRotationPointX, -myRotationPointY, -myRotationPointZ);
+
+  // To apply the transformation
+  cam->SetPosition(aTransform->TransformPoint(viewPos));
+  cam->SetFocalPoint(aTransform->TransformPoint(viewFP));
+
+  cam->OrthogonalizeViewUp();
+
+  GetCurrentRenderer()->ResetCameraClippingRange(); 
+
+  this->Render();
+}
+
+void
+SVTK_InteractorStyle
+::PanXY(int x, int y, int oldX, int oldY)
+{
+  TranslateView(x, y, oldX, oldY);   
+  this->Render();
+}
+
+
+void 
+SVTK_InteractorStyle
+::DollyXY(int dx, int dy)
+{
+  if (GetCurrentRenderer() == NULL) 
+    return;
+
+  double dxf = this->MotionFactor * (double)(dx) / (double)(GetCurrentRenderer()->GetCenter()[1]);
+  double dyf = this->MotionFactor * (double)(dy) / (double)(GetCurrentRenderer()->GetCenter()[1]);
+
+  double zoomFactor = pow((double)1.1, dxf + dyf);
+  
+  vtkCamera *aCam = GetCurrentRenderer()->GetActiveCamera();
+  if (aCam->GetParallelProjection())
+    aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor);
+  else{
+    aCam->Dolly(zoomFactor);
+    GetCurrentRenderer()->ResetCameraClippingRange(); 
+  }
+
+  this->Render();
+}
+
+void 
+SVTK_InteractorStyle
+::SpinXY(int x, int y, int oldX, int oldY)
+{
+  vtkCamera *cam;
+
+  if (GetCurrentRenderer() == NULL)
+    return;
+
+  double newAngle = atan2((double)(y - GetCurrentRenderer()->GetCenter()[1]),
+                         (double)(x - GetCurrentRenderer()->GetCenter()[0]));
+  double oldAngle = atan2((double)(oldY -GetCurrentRenderer()->GetCenter()[1]),
+                         (double)(oldX - GetCurrentRenderer()->GetCenter()[0]));
+  
+  newAngle *= this->RadianToDegree;
+  oldAngle *= this->RadianToDegree;
+
+  cam = GetCurrentRenderer()->GetActiveCamera();
+  cam->Roll(newAngle - oldAngle);
+  cam->OrthogonalizeViewUp();
+      
+  this->Render();
+}
+
+
+/*!
+  To reset reset view
+*/
+void
+SVTK_InteractorStyle
+::OnConfigure() 
+{
+  this->FindPokedRenderer(0,0);
+  this->GetCurrentRenderer()->InvokeEvent(vtkCommand::ConfigureEvent,NULL);
+}
+
+/*!
+  To handle mouse move event
+*/
+void
+SVTK_InteractorStyle
+::OnMouseMove() 
+{
+  int x, y;
+  GetEventPosition( this->Interactor, x, y );
+  this->OnMouseMove( this->Interactor->GetControlKey(),
+                    this->Interactor->GetShiftKey(),
+                    x, y );
+}
+
+/*!
+  To handle left mouse button down event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnLeftButtonDown()
+{
+  int x, y;
+  GetEventPosition( this->Interactor, x, y );
+  this->OnLeftButtonDown( this->Interactor->GetControlKey(),
+                         this->Interactor->GetShiftKey(),
+                         x, y );
+}
+
+/*!
+  To handle left mouse button up event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnLeftButtonUp()
+{
+  int x, y;
+  GetEventPosition( this->Interactor, x, y );
+  this->OnLeftButtonUp( this->Interactor->GetControlKey(),
+                       this->Interactor->GetShiftKey(),
+                       x, y );
+}
+
+/*!
+  To handle middle mouse button down event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnMiddleButtonDown() 
+{
+  int x, y;
+  GetEventPosition( this->Interactor, x, y );
+  this->OnMiddleButtonDown( this->Interactor->GetControlKey(),
+                           this->Interactor->GetShiftKey(),
+                           x, y );
+}
+
+/*!
+  To handle middle mouse button up event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnMiddleButtonUp()
+{
+  int x, y;
+  GetEventPosition( this->Interactor, x, y );
+  this->OnMiddleButtonUp( this->Interactor->GetControlKey(),
+                         this->Interactor->GetShiftKey(),
+                         x, y );
+}
+
+/*!
+  To handle right mouse button down event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnRightButtonDown() 
+{
+  int x, y;
+  GetEventPosition( this->Interactor, x, y );
+  this->OnRightButtonDown( this->Interactor->GetControlKey(),
+                          this->Interactor->GetShiftKey(),
+                          x, y );
+}
+
+/*!
+  To handle right mouse button up event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnRightButtonUp()
+{
+  int x, y;
+  GetEventPosition( this->Interactor, x, y );
+  this->OnRightButtonUp( this->Interactor->GetControlKey(),
+                        this->Interactor->GetShiftKey(),
+                        x, y );
+}
+
+/*!
+  To handle mouse move event
+*/
+void
+SVTK_InteractorStyle
+::OnMouseMove(int vtkNotUsed(ctrl), 
+             int shift,
+             int x, int y) 
+{
+  myShiftState = shift;
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+    onOperation(QPoint(x, y));
+  else if (ForcedState == VTK_INTERACTOR_STYLE_CAMERA_NONE)
+    onCursorMove(QPoint(x, y));
+}
+
+/*!
+  To handle left mouse button down event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnLeftButtonDown(int ctrl, int shift, 
+                  int x, int y) 
+{
+  this->FindPokedRenderer(x, y);
+  if(GetCurrentRenderer() == NULL)
+    return;
+
+  myShiftState = shift;
+  // finishing current viewer operation
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+  myOtherPoint = myPoint = QPoint(x, y);
+  if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    startOperation(ForcedState);
+  } else {
+    if (ctrl)
+      startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
+    else if ( myCurrRotationPointType == SVTK::StartPointSelection )
+    {
+      SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY();
+      myPicker->Pick(aSelectionEvent->myX, 
+                    aSelectionEvent->myY, 
+                    0.0, 
+                    GetCurrentRenderer());
+      if ( SALOME_Actor* anActor = GetFirstSALOMEActor(myPicker.GetPointer()) )
+      {
+       myPointPicker->Pick( aSelectionEvent->myX,
+                            aSelectionEvent->myY, 
+                            0.0, 
+                            GetCurrentRenderer() );
+       int aVtkId = myPointPicker->GetPointId();
+       if ( aVtkId >= 0 )
+       {
+         int anObjId = anActor->GetNodeObjId( aVtkId );
+         vtkFloatingPointType* aCoords = anActor->GetNodeCoord(anObjId);
+         
+         myCurrRotationPointType = SVTK::SetRotateSelected;
+         
+         // invoke event for update coordinates in SVTK_SetRotationPointDlg
+         InvokeEvent(SVTK::RotationPointChanged,(void*)aCoords);
+       }
+       else
+       {
+         // invoke event with no data (for SVTK_SetRotationPointDlg)
+         InvokeEvent(SVTK::RotationPointChanged,0);
+         myCurrRotationPointType = myPrevRotationPointType;
+       }
+      }
+      else
+      {
+       // invoke event with no data (for SVTK_SetRotationPointDlg)
+       InvokeEvent(SVTK::RotationPointChanged,0);
+       myCurrRotationPointType = myPrevRotationPointType;
+      }
+    
+      myHighlightRotationPointActor->SetVisibility( false );
+      if(GetCurrentRenderer() != NULL)
+       GetCurrentRenderer()->RemoveActor( myHighlightRotationPointActor.GetPointer() );
+
+      GetRenderWidget()->setCursor(myDefCursor); 
+    }
+    else
+      startOperation(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
+  }
+  
+  return;
+}
+
+/*!
+  To handle left mouse button up event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnLeftButtonUp(int vtkNotUsed(ctrl),
+                int shift, 
+                int vtkNotUsed(x),
+                int vtkNotUsed(y))
+{
+  myShiftState = shift;
+  // finishing current viewer operation
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+}
+
+/*!
+  To handle middle mouse button down event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnMiddleButtonDown(int ctrl,
+                    int shift, 
+                    int x, int y) 
+{
+  this->FindPokedRenderer(x, y);
+  if(GetCurrentRenderer() == NULL)
+    return;
+
+  myShiftState = shift;
+  // finishing current viewer operation
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+  myOtherPoint = myPoint = QPoint(x, y);
+  if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    startOperation(ForcedState);
+  }
+  else {
+    if (ctrl)
+      startOperation(VTK_INTERACTOR_STYLE_CAMERA_PAN);
+  }
+}
+
+
+/*!
+  To handle middle mouse button up event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnMiddleButtonUp(int vtkNotUsed(ctrl),
+                  int shift, 
+                  int vtkNotUsed(x),
+                  int vtkNotUsed(y))
+{
+  myShiftState = shift;
+  // finishing current viewer operation
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+}
+
+
+/*!
+  To handle right mouse button down event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnRightButtonDown(int ctrl,
+                   int shift, 
+                   int x, int y) 
+{
+  this->FindPokedRenderer(x, y);
+  if(GetCurrentRenderer() == NULL)
+    return;
+
+  myShiftState = shift;
+  // finishing current viewer operation
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+  myOtherPoint = myPoint = QPoint(x, y);
+  if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    startOperation(ForcedState);
+  }
+  else {
+    if (ctrl)
+      startOperation(VTK_INTERACTOR_STYLE_CAMERA_ROTATE);  
+  }
+}
+
+/*!
+  To handle right mouse button up event (reimplemented from vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::OnRightButtonUp(int vtkNotUsed(ctrl),
+                 int shift, 
+                 int vtkNotUsed(x),
+                 int vtkNotUsed(y))
+{
+  myShiftState = shift;
+  // finishing current viewer operation
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+}
+
+/* XPM */
+const char* imageZoomCursor[] = { 
+"32 32 3 1",
+". c None",
+"a c #000000",
+"# c #ffffff",
+"................................",
+"................................",
+".#######........................",
+"..aaaaaaa.......................",
+"................................",
+".............#####..............",
+"...........##.aaaa##............",
+"..........#.aa.....a#...........",
+".........#.a.........#..........",
+".........#a..........#a.........",
+"........#.a...........#.........",
+"........#a............#a........",
+"........#a............#a........",
+"........#a............#a........",
+"........#a............#a........",
+".........#...........#.a........",
+".........#a..........#a.........",
+".........##.........#.a.........",
+"........#####.....##.a..........",
+".......###aaa#####.aa...........",
+"......###aa...aaaaa.......#.....",
+".....###aa................#a....",
+"....###aa.................#a....",
+"...###aa...............#######..",
+"....#aa.................aa#aaaa.",
+".....a....................#a....",
+"..........................#a....",
+"...........................a....",
+"................................",
+"................................",
+"................................",
+"................................"};
+
+const char* imageRotateCursor[] = { 
+"32 32 3 1",
+". c None",
+"a c #000000",
+"# c #ffffff",
+"................................",
+"................................",
+"................................",
+"................................",
+"........#.......................",
+".......#.a......................",
+"......#######...................",
+".......#aaaaa#####..............",
+"........#..##.a#aa##........##..",
+".........a#.aa..#..a#.....##.aa.",
+".........#.a.....#...#..##.aa...",
+".........#a.......#..###.aa.....",
+"........#.a.......#a..#aa.......",
+"........#a.........#..#a........",
+"........#a.........#a.#a........",
+"........#a.........#a.#a........",
+"........#a.........#a.#a........",
+".........#.........#a#.a........",
+"........##a........#a#a.........",
+"......##.a#.......#.#.a.........",
+"....##.aa..##.....##.a..........",
+"..##.aa.....a#####.aa...........",
+"...aa.........aaa#a.............",
+"................#.a.............",
+"...............#.a..............",
+"..............#.a...............",
+"...............a................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................"};
+
+
+/*!
+  loads cursors for viewer operations - zoom, pan, etc...
+*/
+void
+SVTK_InteractorStyle
+::loadCursors()
+{
+  myDefCursor       = QCursor(Qt::ArrowCursor);
+  myHandCursor      = QCursor(Qt::PointingHandCursor);
+  myPanCursor       = QCursor(Qt::SizeAllCursor);
+  myZoomCursor      = QCursor(QPixmap(imageZoomCursor));
+  myRotateCursor    = QCursor(QPixmap(imageRotateCursor));
+  mySpinCursor      = QCursor(QPixmap(imageRotateCursor)); // temporarly !!!!!!
+  myGlobalPanCursor = QCursor(Qt::CrossCursor);
+  myCursorState     = false;
+}
+
+
+/*!
+  Starts Zoom operation (e.g. through menu command)
+*/
+void
+SVTK_InteractorStyle
+::startZoom()
+{
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+  {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+  setCursor(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
+  ForcedState = VTK_INTERACTOR_STYLE_CAMERA_ZOOM;
+}
+
+
+/*!
+  Starts Pan operation (e.g. through menu command)
+*/
+void
+SVTK_InteractorStyle
+::startPan()
+{
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+  {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+  setCursor(VTK_INTERACTOR_STYLE_CAMERA_PAN);
+  ForcedState = VTK_INTERACTOR_STYLE_CAMERA_PAN;
+}
+
+/*!
+  Starts Rotate operation (e.g. through menu command)
+*/
+void 
+SVTK_InteractorStyle
+::startRotate()
+{
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+  {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+  setCursor(VTK_INTERACTOR_STYLE_CAMERA_ROTATE);
+  ForcedState = VTK_INTERACTOR_STYLE_CAMERA_ROTATE;
+}
+
+/*!
+  Set rotation point selected by user
+*/
+void 
+SVTK_InteractorStyle
+::startPointSelection()
+{
+  myCurrRotationPointType = SVTK::StartPointSelection;
+
+  if(GetCurrentRenderer() != NULL) {
+    GetCurrentRenderer()->AddActor( myHighlightRotationPointActor.GetPointer() );
+    vtkFloatingPointType aColor[3];
+    GetCurrentRenderer()->GetBackground( aColor );
+    myHighlightRotationPointActor->GetProperty()->SetColor(1. - aColor[0],
+                                                          1. - aColor[1],
+                                                          1. - aColor[2]);
+  }
+
+  setCursor(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+}
+
+/*! 
+  Starts Spin operation (e.g. through menu command)
+*/
+void
+SVTK_InteractorStyle
+::startSpin()
+{
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+  {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+  setCursor(VTK_INTERACTOR_STYLE_CAMERA_SPIN);
+  ForcedState = VTK_INTERACTOR_STYLE_CAMERA_SPIN;
+}
+
+
+
+/*!
+  Starts Fit Area operation (e.g. through menu command)
+*/
+void
+SVTK_InteractorStyle
+::startFitArea()
+{
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+  {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+  setCursor(VTK_INTERACTOR_STYLE_CAMERA_FIT);
+  ForcedState = VTK_INTERACTOR_STYLE_CAMERA_FIT;
+}
+
+
+/*!
+  Starts Global Panning operation (e.g. through menu command)
+*/
+void
+SVTK_InteractorStyle
+::startGlobalPan()
+{
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+  {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+  setCursor(VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN);
+  ForcedState = VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN;
+
+  // store current zoom scale
+  myScale = GetCurrentRenderer()->GetActiveCamera()->GetParallelScale();
+
+  GetCurrentRenderer()->ResetCamera();
+
+  this->Render();
+}
+
+
+/*!
+  Fits viewer contents to rect
+*/
+void
+SVTK_InteractorStyle
+::fitRect(const int left, 
+         const int top, 
+         const int right, 
+         const int bottom)
+{
+  if (GetCurrentRenderer() == NULL) 
+    return;
+  // move camera
+  int x = (left + right)/2;
+  int y = (top + bottom)/2;
+  int *aSize = GetCurrentRenderer()->GetRenderWindow()->GetSize();
+  int oldX = aSize[0]/2;
+  int oldY = aSize[1]/2;
+  TranslateView(oldX, oldY, x, y);
+
+  // zoom camera
+  double dxf = right == left ? 1.0 : (double)(aSize[0]) / (double)(abs(right - left));
+  double dyf = bottom == top ? 1.0 : (double)(aSize[1]) / (double)(abs(bottom - top));
+  double zoomFactor = (dxf + dyf)/2 ;
+
+  vtkCamera *aCam = GetCurrentRenderer()->GetActiveCamera();
+  if(aCam->GetParallelProjection())
+    aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor);
+  else{
+    aCam->Dolly(zoomFactor);
+    GetCurrentRenderer()->ResetCameraClippingRange();
+  }
+  
+  this->Render();
+}
+
+
+/*!
+  Starts viewer operation (!internal usage!)
+*/
+void
+SVTK_InteractorStyle
+::startOperation(int operation)
+{
+  switch(operation)
+  { 
+  case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
+  case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
+  case VTK_INTERACTOR_STYLE_CAMERA_PAN:
+  case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
+  case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
+  case VTK_INTERACTOR_STYLE_CAMERA_FIT:
+  case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
+    if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
+      startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+    State = operation;
+    if (State != VTK_INTERACTOR_STYLE_CAMERA_SELECT)
+      setCursor(operation);
+    onStartOperation();
+    break;
+  case VTK_INTERACTOR_STYLE_CAMERA_NONE:
+  default:
+    setCursor(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+    State = ForcedState = VTK_INTERACTOR_STYLE_CAMERA_NONE;
+    break;
+  }
+}
+
+
+/*!
+  Sets proper cursor for window when viewer operation is activated
+*/
+void
+SVTK_InteractorStyle
+::setCursor(const int operation)
+{
+  if (!GetRenderWidget()) return;
+  switch (operation)
+  {
+    case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
+      GetRenderWidget()->setCursor(myZoomCursor); 
+      myCursorState = true;
+      break;
+    case VTK_INTERACTOR_STYLE_CAMERA_PAN:
+      GetRenderWidget()->setCursor(myPanCursor); 
+      myCursorState = true;
+      break;
+    case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
+      GetRenderWidget()->setCursor(myRotateCursor); 
+      myCursorState = true;
+      break;
+    case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
+      GetRenderWidget()->setCursor(mySpinCursor); 
+      myCursorState = true;
+      break;
+    case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
+      GetRenderWidget()->setCursor(myGlobalPanCursor); 
+      myCursorState = true;
+      break;
+    case VTK_INTERACTOR_STYLE_CAMERA_FIT:
+    case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
+      GetRenderWidget()->setCursor(myHandCursor); 
+      myCursorState = true;
+      break;
+    case VTK_INTERACTOR_STYLE_CAMERA_NONE:
+    default:
+      if ( myCurrRotationPointType == SVTK::StartPointSelection )
+       GetRenderWidget()->setCursor(myHandCursor);
+      else
+       GetRenderWidget()->setCursor(myDefCursor); 
+      myCursorState = false;
+      break;
+  }
+}
+
+
+/*!
+  Called when viewer operation started (!put necessary initialization here!)
+*/
+void
+SVTK_InteractorStyle
+::onStartOperation()
+{
+  if (!GetRenderWidget()) 
+    return;
+
+  vtkRenderWindowInteractor *aRWI = this->Interactor;
+  vtkRenderWindow *aRenWin = aRWI->GetRenderWindow();
+  aRenWin->SetDesiredUpdateRate(aRWI->GetDesiredUpdateRate());
+
+  switch (State) {
+    case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
+    case VTK_INTERACTOR_STYLE_CAMERA_FIT:
+    {
+      drawRect();
+      break;
+    }
+    case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
+    case VTK_INTERACTOR_STYLE_CAMERA_PAN:
+    case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
+    case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
+    case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
+      break;
+  }
+}
+
+
+/*!
+  Called when viewer operation finished (!put necessary post-processing here!)
+*/
+void
+SVTK_InteractorStyle
+::onFinishOperation() 
+{
+  if (!GetRenderWidget()) 
+    return;
+
+  vtkRenderWindowInteractor *aRWI = this->Interactor;
+  vtkRenderWindow *aRenWin = aRWI->GetRenderWindow();
+  aRenWin->SetDesiredUpdateRate(aRWI->GetStillUpdateRate());
+
+  SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY();
+
+  switch (State) {
+    case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
+    case VTK_INTERACTOR_STYLE_CAMERA_FIT:
+    {
+      endDrawRect();
+      QRect aRect(myPoint, myOtherPoint);
+      aRect = aRect.normalized();
+
+      if (State == VTK_INTERACTOR_STYLE_CAMERA_FIT) {
+        // making fit rect opeation 
+        int w, h;
+        Interactor->GetSize(w, h);
+        int x1 = aRect.left(); 
+        int y1 = h - aRect.top() - 1;
+        int x2 = aRect.right(); 
+        int y2 = h - aRect.bottom() - 1;
+        fitRect(x1, y1, x2, y2);
+      }
+      else {
+        if (myPoint == myOtherPoint)
+         {
+           // process point selection
+           this->FindPokedRenderer(aSelectionEvent->myX, aSelectionEvent->myY);
+           Interactor->StartPickCallback();
+           
+           myPicker->Pick(aSelectionEvent->myX, 
+                          aSelectionEvent->myY, 
+                          0.0, 
+                          GetCurrentRenderer());
+           //
+           SALOME_Actor* anActor = GetFirstSALOMEActor(myPicker.GetPointer());
+           aSelectionEvent->myIsRectangle = false;
+
+           if(!myShiftState)
+             GetSelector()->ClearIObjects();
+
+           if(anActor)
+             {
+               anActor->Highlight( this, aSelectionEvent, true );
+             }
+           else
+             {
+               if(myLastHighlitedActor.GetPointer() && myLastHighlitedActor.GetPointer() != anActor)
+                 myLastHighlitedActor->Highlight( this, aSelectionEvent, false );
+               myLastHighlitedActor = anActor;
+             }
+         } 
+       else 
+         {
+           //processing rectangle selection
+           Interactor->StartPickCallback();
+           GetSelector()->StartPickCallback();
+           aSelectionEvent->myIsRectangle = true;
+
+           if(!myShiftState)
+             GetSelector()->ClearIObjects();
+
+           vtkActorCollection* aListActors = GetCurrentRenderer()->GetActors();
+           aListActors->InitTraversal();
+           while(vtkActor* aActor = aListActors->GetNextActor())
+             {
+               if(aActor->GetVisibility())
+                 {
+                   if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor))
+                     {
+                       if(aSActor->hasIO())
+                         aSActor->Highlight( this, aSelectionEvent, true );
+                     }
+                 }
+             }
+         }
+       Interactor->EndPickCallback();
+       GetSelector()->EndPickCallback();
+      } 
+    } 
+    break;
+  case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
+  case VTK_INTERACTOR_STYLE_CAMERA_PAN:
+  case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
+  case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
+    break;
+  case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN: 
+    {
+      int w, h, x, y;
+      Interactor->GetSize(w, h);
+      x = myPoint.x(); 
+      y = h - myPoint.y() - 1;
+      Place(x, y);
+    }
+    break;
+  }
+
+  this->Render();
+}
+
+
+/*!
+  Called during viewer operation when user moves mouse (!put necessary processing here!)
+*/
+void
+SVTK_InteractorStyle
+::onOperation(QPoint mousePos) 
+{
+  if (!GetRenderWidget()) 
+    return;
+
+  switch (State) {
+  case VTK_INTERACTOR_STYLE_CAMERA_PAN: 
+    {
+      this->PanXY(mousePos.x(), myPoint.y(), myPoint.x(), mousePos.y());
+      myPoint = mousePos;
+      break;
+    }
+  case VTK_INTERACTOR_STYLE_CAMERA_ZOOM: 
+    {    
+      this->DollyXY(mousePos.x() - myPoint.x(), mousePos.y() - myPoint.y());
+      myPoint = mousePos;
+      break;
+    }
+  case VTK_INTERACTOR_STYLE_CAMERA_ROTATE: 
+    {
+      this->RotateXY(mousePos.x() - myPoint.x(), myPoint.y() - mousePos.y());
+      myPoint = mousePos;
+      break;
+    }
+  case VTK_INTERACTOR_STYLE_CAMERA_SPIN: 
+    {
+      this->SpinXY(mousePos.x(), mousePos.y(), myPoint.x(), myPoint.y());
+      myPoint = mousePos;
+      break;
+    }
+  case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN: 
+    {    
+      break;
+    }
+  case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
+    {
+      if (!myCursorState)
+        setCursor(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
+    }
+  case VTK_INTERACTOR_STYLE_CAMERA_FIT:
+    {
+      myOtherPoint = mousePos;
+      drawRect();
+      break;
+    }
+  }
+}
+
+/*!
+  Called when user moves mouse inside viewer window and there is no active viewer operation 
+  (!put necessary processing here!)
+*/
+void
+SVTK_InteractorStyle
+::onCursorMove(QPoint mousePos) 
+{
+  // processing highlighting
+  SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY();
+  this->FindPokedRenderer(aSelectionEvent->myX,aSelectionEvent->myY);
+
+  bool anIsChanged = false;
+
+  myPicker->Pick(aSelectionEvent->myX, 
+                aSelectionEvent->myY, 
+                0.0, 
+                GetCurrentRenderer());
+  
+  SALOME_Actor *anActor = GetFirstSALOMEActor(myPicker.GetPointer());
+
+  if ( myCurrRotationPointType == SVTK::StartPointSelection )
+  {
+    myHighlightRotationPointActor->SetVisibility( false );
+
+    SALOME_Actor *anCurrActor;
+    if ( anActor ) anCurrActor = anActor;
+    else if ( myLastPreHighlitedActor.GetPointer() 
+             && 
+             myLastPreHighlitedActor.GetPointer() != anActor )
+      anCurrActor = myLastPreHighlitedActor.GetPointer();
+    if ( anCurrActor )
+    {
+      myPointPicker->Pick( aSelectionEvent->myX, aSelectionEvent->myY, 0.0, GetCurrentRenderer() );
+      int aVtkId = myPointPicker->GetPointId();
+      if ( aVtkId >= 0 ) {
+       int anObjId = anActor->GetNodeObjId( aVtkId );
+
+       TColStd_IndexedMapOfInteger aMapIndex;
+       aMapIndex.Add( anObjId );
+       myHighlightRotationPointActor->MapPoints( anActor, aMapIndex );
+
+       myHighlightRotationPointActor->SetVisibility( true );
+       anIsChanged = true;
+      }
+    }
+  }
+  else {
+    if (anActor){
+      anIsChanged |= anActor->PreHighlight( this, aSelectionEvent, true );
+    }
+
+    if(myLastPreHighlitedActor.GetPointer() && myLastPreHighlitedActor.GetPointer() != anActor)
+      anIsChanged |= myLastPreHighlitedActor->PreHighlight( this, aSelectionEvent, false );   
+
+  }
+  
+  myLastPreHighlitedActor = anActor;
+
+  if(anIsChanged)
+    this->Render();
+}
+
+/*!
+  Called on finsh GlobalPan operation 
+*/
+void
+SVTK_InteractorStyle
+::Place(const int theX, const int theY) 
+{
+  if (GetCurrentRenderer() == NULL)
+    return;
+
+  //translate view
+  int *aSize = GetCurrentRenderer()->GetRenderWindow()->GetSize();
+  int centerX = aSize[0]/2;
+  int centerY = aSize[1]/2;
+
+  TranslateView(centerX, centerY, theX, theY);
+
+  // restore zoom scale
+  vtkCamera *cam = GetCurrentRenderer()->GetActiveCamera();
+  cam->SetParallelScale(myScale);
+  GetCurrentRenderer()->ResetCameraClippingRange();
+
+  this->Render();
+}
+
+
+
+/*!
+  Translates view from Point to Point
+*/
+void
+SVTK_InteractorStyle
+::TranslateView(int toX, int toY, int fromX, int fromY)
+{
+  vtkCamera *cam = GetCurrentRenderer()->GetActiveCamera();
+  double viewFocus[4], focalDepth, viewPoint[3];
+  vtkFloatingPointType newPickPoint[4], oldPickPoint[4], motionVector[3];
+  cam->GetFocalPoint(viewFocus);
+
+  this->ComputeWorldToDisplay(viewFocus[0], viewFocus[1],
+                             viewFocus[2], viewFocus);
+  focalDepth = viewFocus[2];
+
+  this->ComputeDisplayToWorld(double(toX), double(toY),
+                             focalDepth, newPickPoint);
+  this->ComputeDisplayToWorld(double(fromX),double(fromY),
+                             focalDepth, oldPickPoint);
+  
+  // camera motion is reversed
+  motionVector[0] = oldPickPoint[0] - newPickPoint[0];
+  motionVector[1] = oldPickPoint[1] - newPickPoint[1];
+  motionVector[2] = oldPickPoint[2] - newPickPoint[2];
+  
+  cam->GetFocalPoint(viewFocus);
+  cam->GetPosition(viewPoint);
+  cam->SetFocalPoint(motionVector[0] + viewFocus[0],
+                    motionVector[1] + viewFocus[1],
+                    motionVector[2] + viewFocus[2]);
+  cam->SetPosition(motionVector[0] + viewPoint[0],
+                  motionVector[1] + viewPoint[1],
+                  motionVector[2] + viewPoint[2]);
+}
+
+void
+SVTK_InteractorStyle
+::IncrementalPan( const int incrX, const int incrY )
+{
+  this->PanXY( incrX, incrY, 0, 0 );
+}
+
+void
+SVTK_InteractorStyle
+::IncrementalZoom( const int incr )
+{
+  this->DollyXY( incr, incr );
+}
+
+void
+SVTK_InteractorStyle
+::IncrementalRotate( const int incrX, const int incrY )
+{
+  this->RotateXY( incrX, -incrY );
+}
+
+/*!
+  Redefined in order to add an observer (callback) for custorm event (space mouse event)
+*/
+void
+SVTK_InteractorStyle
+::SetInteractor( vtkRenderWindowInteractor* theInteractor )
+{
+  // register EventCallbackCommand as observer of standard events (keypress, mousemove, etc)
+  Superclass::SetInteractor( theInteractor );
+  myInteractor = dynamic_cast<SVTK_GenericRenderWindowInteractor*>(theInteractor);
+
+  if(theInteractor) { 
+    // register EventCallbackCommand as observer of custorm event (3d space mouse event)
+    theInteractor->AddObserver( SVTK::SpaceMouseMoveEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::SpaceMouseButtonEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::PanLeftEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::PanRightEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::PanUpEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::PanDownEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::ZoomInEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::ZoomOutEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::RotateLeftEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::RotateRightEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::RotateUpEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::RotateDownEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::PlusSpeedIncrementEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::MinusSpeedIncrementEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::SetSpeedIncrementEvent, EventCallbackCommand, Priority );
+
+    theInteractor->AddObserver( SVTK::SetSMDecreaseSpeedEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::SetSMIncreaseSpeedEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::SetSMDominantCombinedSwitchEvent, EventCallbackCommand, Priority );
+
+    theInteractor->AddObserver( SVTK::StartZoom, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::StartPan, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::StartRotate, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::StartGlobalPan, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::StartFitArea, EventCallbackCommand, Priority );
+
+    theInteractor->AddObserver( SVTK::SetRotateGravity, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( SVTK::StartPointSelection, EventCallbackCommand, Priority );
+
+    theInteractor->AddObserver( SVTK::ChangeRotationPoint, EventCallbackCommand, Priority );
+  }
+}
+
+/*!
+  To implement cached rendering
+*/
+void
+SVTK_InteractorStyle
+::OnTimer() 
+{
+  //vtkInteractorStyle::OnTimer();
+  this->Interactor->Render();
+  // check if bounding box was changed
+  if ( GetCurrentRenderer() )
+  {
+    vtkFloatingPointType aCurrBBCenter[3];
+    if ( ComputeBBCenter(GetCurrentRenderer(),aCurrBBCenter) )
+    {
+      if ( !myBBFirstCheck )
+      {
+       if ( fabs(aCurrBBCenter[0]-myBBCenter[0]) > 1e-38 ||
+            fabs(aCurrBBCenter[1]-myBBCenter[1]) > 1e-38 ||
+            fabs(aCurrBBCenter[2]-myBBCenter[2]) > 1e-38 ) {
+         // bounding box was changed => send SVTK::RotationPointChanged event
+         // invoke event for update coordinates in SVTK_SetRotationPointDlg
+         InvokeEvent(SVTK::BBCenterChanged,(void*)aCurrBBCenter);
+         for ( int i =0; i < 3; i++) myBBCenter[i] = aCurrBBCenter[i];
+       }
+      }
+      else 
+      {
+       for ( int i =0; i < 3; i++) myBBCenter[i] = aCurrBBCenter[i];
+       myBBFirstCheck = false;
+      }
+    }
+  }
+}
+
+/*!
+  To invoke #vtkRenderWindowInteractor::CreateTimer
+*/
+void
+SVTK_InteractorStyle
+::Render() 
+{
+  this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
+}
+
+void
+SVTK_InteractorStyle
+::onSpaceMouseMove( double* data )
+{
+  // general things, do SetCurrentRenderer() within FindPokedRenderer() 
+  int x, y;
+  GetEventPosition( this->Interactor, x, y ); // current mouse position (from last mouse move event or any other event)
+  FindPokedRenderer( x, y ); // calls SetCurrentRenderer
+  
+  IncrementalZoom( (int)data[2] );        // 1. push toward / pull backward = zoom out / zoom in
+  IncrementalPan(  (int)data[0],  (int)data[1] );// 2. pull up / push down = pan up / down, 3. move left / right = pan left / right
+  IncrementalRotate( 0,  (int)data[4] );   // 4. twist the control = rotate around Y axis
+  IncrementalRotate( (int)data[3], 0  );   // 5. tilt the control forward/backward = rotate around X axis (Z axis of local coordinate system of space mouse)
+}
+
+void
+SVTK_InteractorStyle
+::onSpaceMouseButton( int button )
+{
+  if( mySMDecreaseSpeedBtn == button ) {   
+    ControllerIncrement()->Decrease();
+  }
+  if( mySMIncreaseSpeedBtn == button ) {    
+    ControllerIncrement()->Increase();
+  }
+  if( mySMDominantCombinedSwitchBtn == button )    
+    DominantCombinedSwitch();
+}
+
+void
+SVTK_InteractorStyle
+::DominantCombinedSwitch()
+{
+  printf( "\n--DominantCombinedSwitch() NOT IMPLEMENTED--\n" );
+}
+
+/*!
+  Draws rectangle by starting and current points
+*/
+void
+SVTK_InteractorStyle
+::drawRect()
+{
+  if ( !myRectBand ) {
+    myRectBand = new QRubberBand( QRubberBand::Rectangle, GetRenderWidget() );
+    QPalette palette;
+    palette.setColor(myRectBand->foregroundRole(), Qt::white);
+    myRectBand->setPalette(palette);
+  }
+  myRectBand->hide();
+
+  QRect aRect = SUIT_Tools::makeRect(myPoint.x(), myPoint.y(), myOtherPoint.x(), myOtherPoint.y());
+  myRectBand->setGeometry( aRect );
+  myRectBand->setVisible( aRect.isValid() );
+}
+
+/*!
+  \brief Delete rubber band on the end on the dragging operation.
+*/
+void
+SVTK_InteractorStyle
+::endDrawRect()
+{
+  if ( myRectBand ) myRectBand->hide();
+
+  delete myRectBand;
+  myRectBand = 0;
+}
+
+/*!
+  Main process event method (reimplemented from #vtkInteractorStyle)
+*/
+void
+SVTK_InteractorStyle
+::ProcessEvents( vtkObject* object,
+                unsigned long event,
+                void* clientData, 
+                void* callData )
+{
+  if ( clientData ) {
+    vtkObject* anObject = reinterpret_cast<vtkObject*>( clientData );
+    SVTK_InteractorStyle* self = dynamic_cast<SVTK_InteractorStyle*>( anObject );
+    int aSpeedIncrement=self->ControllerIncrement()->Current();
+    vtkFloatingPointType aCenter[3];
+    vtkFloatingPointType* aSelectedPoint;
+    if ( self ) {
+      switch ( event ) {
+      case SVTK::SpaceMouseMoveEvent : 
+       self->onSpaceMouseMove( (double*)callData ); 
+       return;
+      case SVTK::SpaceMouseButtonEvent : 
+       self->onSpaceMouseButton( *((int*)callData) ); 
+       return;
+      case SVTK::PanLeftEvent: 
+       self->IncrementalPan(-aSpeedIncrement, 0);
+       return;
+      case SVTK::PanRightEvent:
+       self->IncrementalPan(aSpeedIncrement, 0);
+       return;
+      case SVTK::PanUpEvent:
+       self->IncrementalPan(0, aSpeedIncrement);
+       return;
+      case SVTK::PanDownEvent:
+       self->IncrementalPan(0, -aSpeedIncrement);
+       return;
+      case SVTK::ZoomInEvent:
+       self->IncrementalZoom(aSpeedIncrement);
+       return;
+      case SVTK::ZoomOutEvent:
+       self->IncrementalZoom(-aSpeedIncrement);
+       return;
+      case SVTK::RotateLeftEvent: 
+       self->IncrementalRotate(-aSpeedIncrement, 0);
+       return;
+      case SVTK::RotateRightEvent:
+       self->IncrementalRotate(aSpeedIncrement, 0);
+       return;
+      case SVTK::RotateUpEvent:
+       self->IncrementalRotate(0, -aSpeedIncrement);
+       return;
+      case SVTK::RotateDownEvent:
+       self->IncrementalRotate(0, aSpeedIncrement);
+       return;
+      case SVTK::PlusSpeedIncrementEvent:
+       self->ControllerIncrement()->Increase();
+       return;
+      case SVTK::MinusSpeedIncrementEvent:
+       self->ControllerIncrement()->Decrease();
+       return;
+      case SVTK::SetSpeedIncrementEvent:
+       self->ControllerIncrement()->SetStartValue(*((int*)callData));
+       return;
+
+      case SVTK::SetSMDecreaseSpeedEvent:
+       self->mySMDecreaseSpeedBtn = *((int*)callData);
+       return;
+      case SVTK::SetSMIncreaseSpeedEvent:
+       self->mySMIncreaseSpeedBtn = *((int*)callData);
+       return;
+      case SVTK::SetSMDominantCombinedSwitchEvent:
+       self->mySMDominantCombinedSwitchBtn = *((int*)callData);
+       return;
+
+      case SVTK::StartZoom:
+       self->startZoom();
+       return;
+      case SVTK::StartPan:
+       self->startPan();
+       return;
+      case SVTK::StartRotate:
+       self->startRotate();
+       return;
+      case SVTK::StartGlobalPan:
+       self->startGlobalPan();
+       return;
+      case SVTK::StartFitArea:
+       self->startFitArea();
+       return;
+
+      case SVTK::SetRotateGravity:
+       if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
+       {
+         self->myHighlightRotationPointActor->SetVisibility( false );
+         if( self->GetCurrentRenderer() != NULL )
+           self->GetCurrentRenderer()->RemoveActor( self->myHighlightRotationPointActor.GetPointer() );
+         self->GetRenderWidget()->setCursor(self->myDefCursor); 
+       }
+       self->myPrevRotationPointType = self->myCurrRotationPointType;
+       self->myCurrRotationPointType = SVTK::SetRotateGravity;
+       if ( ComputeBBCenter(self->GetCurrentRenderer(),aCenter) ) 
+         // invoke event for update coordinates in SVTK_SetRotationPointDlg
+         self->InvokeEvent(SVTK::BBCenterChanged,(void*)aCenter);
+       return;
+      case SVTK::StartPointSelection:
+       self->startPointSelection();
+       return;
+
+      case SVTK::ChangeRotationPoint:
+       if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
+       {
+         self->myHighlightRotationPointActor->SetVisibility( false );
+         if( self->GetCurrentRenderer() != NULL )
+           self->GetCurrentRenderer()->RemoveActor( self->myHighlightRotationPointActor.GetPointer() );
+         self->GetRenderWidget()->setCursor(self->myDefCursor); 
+       }
+       self->myPrevRotationPointType = self->myCurrRotationPointType;
+       self->myCurrRotationPointType = SVTK::SetRotateSelected;
+       aSelectedPoint = (vtkFloatingPointType*)callData;
+       self->myRotationPointX = aSelectedPoint[0];
+       self->myRotationPointY = aSelectedPoint[1];
+       self->myRotationPointZ = aSelectedPoint[2];
+       return;
+      }
+    }
+  }
+
+  Superclass::ProcessEvents( object, event, clientData, callData );
+}
+
+/*!
+  To handle keyboard event (reimplemented from #vtkInteractorStyle)
+*/
+void SVTK_InteractorStyle::OnChar()
+{
+}
+
+/*!
+  Redefined vtkInteractorStyle::OnKeyDown
+*/
+void SVTK_InteractorStyle::OnKeyDown()
+{
+  bool bInvokeSuperclass=myControllerOnKeyDown->OnKeyDown(this);
+  if (bInvokeSuperclass){
+    Superclass::OnKeyDown();
+  }
+}
+
+/*!
+  Provide instructions for Picking
+*/
+void SVTK_InteractorStyle::ActionPicking()
+{
+  int x, y;
+  Interactor->GetEventPosition( x, y ); 
+  FindPokedRenderer( x, y ); 
+  
+  myOtherPoint = myPoint = QPoint(x, y);
+  
+  startOperation(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
+  onFinishOperation();
+  startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+}
+
+/*!
+  To set current increment controller 
+*/
+void SVTK_InteractorStyle::SetControllerOnKeyDown(SVTK_ControllerOnKeyDown* theController)
+{
+  myControllerOnKeyDown=theController;
+}
+
+/*!
+  To get current OnKeyDown controller 
+*/
+SVTK_ControllerOnKeyDown* SVTK_InteractorStyle::ControllerOnKeyDown()
+{
+  return myControllerOnKeyDown.GetPointer();
+}
+
+/*!
+  To get current increment controller
+*/
+void SVTK_InteractorStyle::SetControllerIncrement(SVTK_ControllerIncrement* theController)
+{
+  myControllerIncrement=theController;
+}
+
+/*!
+  To get current increment controller 
+*/
+SVTK_ControllerIncrement* SVTK_InteractorStyle::ControllerIncrement()
+{
+  return myControllerIncrement.GetPointer();
+}
+
+vtkStandardNewMacro(SVTK_ControllerIncrement);
+SVTK_ControllerIncrement::SVTK_ControllerIncrement()
+{
+  myIncrement=10;
+}
+SVTK_ControllerIncrement::~SVTK_ControllerIncrement()
+{
+}
+void SVTK_ControllerIncrement::SetStartValue(const int theValue)
+{
+  myIncrement=theValue;
+}
+int SVTK_ControllerIncrement::Current()const
+{
+  return myIncrement;
+}
+int SVTK_ControllerIncrement::Increase()
+{
+  ++myIncrement;
+  return myIncrement;
+}
+int SVTK_ControllerIncrement::Decrease()
+{
+  if (myIncrement>1){
+    --myIncrement;
+  }
+  return myIncrement;
+}
+
+vtkStandardNewMacro(SVTK_ControllerOnKeyDown);
+
+/*!
+  Constructor
+*/
+SVTK_ControllerOnKeyDown::SVTK_ControllerOnKeyDown()
+{
+}
+
+/*!
+  Destructor
+*/
+SVTK_ControllerOnKeyDown::~SVTK_ControllerOnKeyDown()
+{
+}
+
+bool SVTK_ControllerOnKeyDown::OnKeyDown(vtkInteractorStyle* theIS)
+{
+  return true;
+}
diff --git a/src/SVTK/SVTK_InteractorStyle.h b/src/SVTK/SVTK_InteractorStyle.h
new file mode 100644 (file)
index 0000000..60dbf4f
--- /dev/null
@@ -0,0 +1,359 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_InteractorStyle.h
+//  Author : Christophe ATTANASIO
+//  Module : SALOME
+//  $Header$
+
+#ifndef __SVTK_InteractorStyle_h
+#define __SVTK_InteractorStyle_h
+
+#include "SVTK.h"
+
+#include "SVTK_SelectionEvent.h"
+
+#include <boost/shared_ptr.hpp>
+
+#include <vtkInteractorStyle.h>
+#include <vtkSmartPointer.h>
+
+#include <QCursor>
+
+#include <map>
+
+#include <vtkObject.h>
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+//
+//! Control the value of increment  in SALOME way.
+/*!
+  This class controls of value of increment,
+  for pan/rotate/zoom operations in SALOME way
+*/
+class SVTK_EXPORT SVTK_ControllerIncrement : public vtkObject{
+ public:
+  vtkTypeMacro(SVTK_ControllerIncrement, vtkObject);
+  static SVTK_ControllerIncrement* New();
+
+  //! Set start value of increment
+  void SetStartValue(const int );
+
+  //! Get current value of increment
+  int Current()const;
+
+  //! Increace the increment value by add 1
+  virtual int Increase();
+
+  //! Decreace the increment value by subtract 1
+  virtual int Decrease();
+ protected:
+  SVTK_ControllerIncrement();
+  virtual ~SVTK_ControllerIncrement();
+ protected:
+  int  myIncrement;
+ private:
+  SVTK_ControllerIncrement(const SVTK_ControllerIncrement&);//Not implemented
+  void operator=(const SVTK_ControllerIncrement&);          //Not implemented
+};
+//
+//! Control the behaviour of KeyDown event in SALOME way.
+/*!
+  This class controls the behaviour of KeyDown event
+  in SALOME way
+*/
+class SVTK_EXPORT SVTK_ControllerOnKeyDown : public vtkObject{
+ public:
+  vtkTypeMacro(SVTK_ControllerOnKeyDown, vtkObject);
+  static SVTK_ControllerOnKeyDown* New();
+
+  //! Provides the action on event 
+  virtual bool OnKeyDown(vtkInteractorStyle* );
+
+ protected:
+  SVTK_ControllerOnKeyDown();
+  virtual ~SVTK_ControllerOnKeyDown();
+  
+ private:
+  SVTK_ControllerOnKeyDown(const SVTK_ControllerOnKeyDown&);//Not implemented
+  void operator=(const SVTK_ControllerOnKeyDown&);          //Not implemented
+};
+
+class vtkPicker;
+class vtkPointPicker;
+
+class SALOME_Actor;
+
+class SVTK_Selector;
+class SVTK_GenericRenderWindowInteractor;
+class SVTK_Actor;
+
+class QRubberBand;
+
+#define VTK_INTERACTOR_STYLE_CAMERA_NONE    0
+#define VTK_INTERACTOR_STYLE_CAMERA_ROTATE  1
+#define VTK_INTERACTOR_STYLE_CAMERA_PAN     2
+#define VTK_INTERACTOR_STYLE_CAMERA_ZOOM    3
+#define VTK_INTERACTOR_STYLE_CAMERA_SPIN    4
+#define VTK_INTERACTOR_STYLE_CAMERA_FIT        5
+#define VTK_INTERACTOR_STYLE_CAMERA_SELECT     6
+#define VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN 7
+#define VTK_INTERACTOR_STYLE_CAMERA_SELECT_ROTATION_POINT 8
+
+//! Introduce SALOME way of user interaction
+/*!
+  This class defines SALOME way of user interaction for VTK viewer, as well, 
+  as introduce a new selection mechanism
+*/
+class SVTK_EXPORT SVTK_InteractorStyle: public vtkInteractorStyle
+{
+ public:
+  static SVTK_InteractorStyle *New();
+  vtkTypeMacro(SVTK_InteractorStyle, vtkInteractorStyle);
+
+  typedef boost::shared_ptr<SVTK_SelectionEvent> PSelectionEvent;
+
+  
+
+  //! Generate special #SVTK_SelectionEvent
+  virtual
+  SVTK_SelectionEvent*
+  GetSelectionEvent();
+
+  //! Generate special #SVTK_SelectionEvent with flipped Y coordinate
+  virtual
+  SVTK_SelectionEvent*
+  GetSelectionEventFlipY();
+
+  //! Redefined in order to add an observer (callback) for custom event (space mouse event)
+  virtual
+  void
+  SetInteractor( vtkRenderWindowInteractor* );
+
+  //! To invoke #vtkRenderWindowInteractor::CreateTimer
+  virtual 
+  void
+  Render();
+
+  //! To implement cached rendering
+  virtual
+  void
+  OnTimer();
+
+  //! To reset reset view
+  virtual
+  void
+  OnConfigure();
+
+  //! To handle mouse move event
+  virtual 
+  void
+  OnMouseMove();
+
+  //! To handle left mouse button down event (reimplemented from #vtkInteractorStyle)
+  virtual
+  void
+  OnLeftButtonDown();
+
+  //! To handle left mouse button up event (reimplemented from #vtkInteractorStyle)
+  virtual
+  void
+  OnLeftButtonUp();
+
+  //! To handle middle mouse button down event (reimplemented from #vtkInteractorStyle)
+  virtual
+  void
+  OnMiddleButtonDown();
+
+  //! To handle middle mouse button up event (reimplemented from #vtkInteractorStyle)
+  virtual
+  void
+  OnMiddleButtonUp();
+
+  //! To handle right mouse button down event (reimplemented from #vtkInteractorStyle)
+  virtual
+  void
+  OnRightButtonDown();
+
+  //! To handle right mouse button up event (reimplemented from #vtkInteractorStyle)
+  virtual
+  void
+  OnRightButtonUp();
+
+  //! To handle keyboard event (reimplemented from #vtkInteractorStyle)
+  virtual
+  void
+  OnChar();
+
+  //! To set current increment controller 
+  void SetControllerIncrement(SVTK_ControllerIncrement*);
+
+  //! To get current increment controller 
+  SVTK_ControllerIncrement* ControllerIncrement();
+  //! Redefine vtkInteractorStyle::OnKeyDown
+  virtual void OnKeyDown();
+
+  //! Provide instructions for Picking
+  void ActionPicking();
+
+  //! To set current OnKeyDown controller 
+  void SetControllerOnKeyDown(SVTK_ControllerOnKeyDown*);
+
+  //! To get current OnKeyDown controller 
+  SVTK_ControllerOnKeyDown* ControllerOnKeyDown();
+  
+  SVTK_Selector* GetSelector();
+
+  int   CurrentState() const { return State; }
+
+  protected:
+  SVTK_InteractorStyle();
+  ~SVTK_InteractorStyle();
+
+  QWidget*
+  GetRenderWidget();
+  
+  // Generic event bindings must be overridden in subclasses
+  virtual void OnMouseMove  (int ctrl, int shift, int x, int y);
+  virtual void OnLeftButtonDown(int ctrl, int shift, int x, int y);
+  virtual void OnLeftButtonUp  (int ctrl, int shift, int x, int y);
+  virtual void OnMiddleButtonDown(int ctrl, int shift, int x, int y);
+  virtual void OnMiddleButtonUp  (int ctrl, int shift, int x, int y);
+  virtual void OnRightButtonDown(int ctrl, int shift, int x, int y);
+  virtual void OnRightButtonUp  (int ctrl, int shift, int x, int y);
+
+  void RotateXY(int dx, int dy);
+  void PanXY(int x, int y, int oldX, int oldY);
+  void DollyXY(int dx, int dy);
+  void SpinXY(int dx, int dy, int oldX, int oldY);
+  void fitRect(const int left, const int top, const int right, const int bottom);
+  void Place(const int theX, const int theY);
+  void TranslateView(int toX, int toY, int fromX, int fromY);
+
+  void
+  IncrementalPan( const int incrX, const int incrY );
+
+  void
+  IncrementalZoom( const int incr );
+
+  void
+  IncrementalRotate( const int incrX, const int incrY );
+
+  // Main process event method (reimplemented from #vtkInteractorStyle)
+  static 
+  void
+  ProcessEvents(vtkObject* object, 
+               unsigned long event,
+               void* clientData, 
+               void* callData );
+
+  float MotionFactor;
+  float RadianToDegree;                 // constant: for conv from deg to rad
+  double myScale;
+
+ protected:
+  void startZoom();
+  void startPan();
+  void startGlobalPan();
+  void startRotate();
+  void startFitArea();
+  void startSpin();
+
+  void startPointSelection();
+
+ protected:
+  void loadCursors();
+  void startOperation(int operation);
+  void onStartOperation();
+  virtual void onFinishOperation();
+  void onOperation(QPoint mousePos);
+  void onCursorMove(QPoint mousePos);
+  void setCursor(const int operation);
+
+  void onSpaceMouseMove( double* data );
+  virtual void onSpaceMouseButton( int button );
+
+  void DominantCombinedSwitch();
+  
+  void drawRect();
+  void endDrawRect();
+
+ protected:
+  QCursor                   myDefCursor;
+  QCursor                   myPanCursor;
+  QCursor                   myZoomCursor;
+  QCursor                   myRotateCursor;
+  QCursor                   mySpinCursor;
+  QCursor                   myHandCursor;
+  QCursor                   myGlobalPanCursor;
+  QPoint                    myPoint;
+  QPoint                    myOtherPoint;
+  bool                      myCursorState;
+  bool                      myShiftState;
+  int                       ForcedState;
+
+  vtkSmartPointer<SALOME_Actor> myLastHighlitedActor;
+  vtkSmartPointer<SALOME_Actor> myLastPreHighlitedActor;
+
+  //! "Increment" controller for pan/rotate/zoom operations
+  vtkSmartPointer<SVTK_ControllerIncrement> myControllerIncrement;
+
+  //!controls the behaviour of KeyDown event in SALOME way
+  vtkSmartPointer<SVTK_ControllerOnKeyDown> myControllerOnKeyDown;
+
+  // SpaceMouse short cuts
+  int                       mySMDecreaseSpeedBtn;
+  int                       mySMIncreaseSpeedBtn;
+  int                       mySMDominantCombinedSwitchBtn;
+  
+  vtkSmartPointer<SVTK_GenericRenderWindowInteractor> myInteractor;
+
+  PSelectionEvent mySelectionEvent;
+
+  vtkSmartPointer<vtkPicker> myPicker;
+
+  unsigned long                   myCurrRotationPointType;
+  unsigned long                   myPrevRotationPointType;
+
+  double                          myRotationPointX;
+  double                          myRotationPointY;
+  double                          myRotationPointZ;
+
+  vtkSmartPointer<SVTK_Actor>     myHighlightRotationPointActor;
+  vtkSmartPointer<vtkPointPicker> myPointPicker;
+  
+  vtkFloatingPointType            myBBCenter[3];
+  bool                            myBBFirstCheck;
+
+  QRubberBand*                    myRectBand; //!< selection rectangle rubber band
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
diff --git a/src/SVTK/SVTK_MainWindow.cxx b/src/SVTK/SVTK_MainWindow.cxx
new file mode 100644 (file)
index 0000000..d543444
--- /dev/null
@@ -0,0 +1,903 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#include "SALOME_Actor.h"
+
+#include <QImage>
+
+#include <vtkGenericRenderWindowInteractor.h>
+#include <vtkRenderer.h>
+
+#include <QtxAction.h>
+#include <QtxMultiAction.h>
+#include <QtxToolBar.h>
+
+#include <SUIT_MessageBox.h>
+#include <SUIT_ViewWindow.h>
+#include <SUIT_Tools.h>
+#include <SUIT_ResourceMgr.h>
+
+#include "SVTK_NonIsometricDlg.h"
+#include "SVTK_UpdateRateDlg.h"
+#include "SVTK_CubeAxesDlg.h"
+#include "SVTK_SetRotationPointDlg.h"
+#include "SVTK_MainWindow.h"
+#include "SVTK_Event.h"
+#include "SVTK_Renderer.h"
+#include "SVTK_RenderWindowInteractor.h"
+#include "SVTK_InteractorStyle.h"
+#include "SVTK_Selector.h"
+
+/*!
+  Constructor
+*/
+SVTK_MainWindow
+::SVTK_MainWindow(QWidget* theParent, 
+                 const char* theName,
+                 SUIT_ResourceMgr* theResourceMgr,
+                 SUIT_ViewWindow* theViewWindow) :
+  QMainWindow(theParent),
+  myViewWindow(theViewWindow)
+{
+  setObjectName(theName);
+  setWindowFlags( windowFlags() & ~Qt::Window );
+
+  myToolBar = new QtxToolBar( true, tr("LBL_TOOLBAR_LABEL"), this );
+
+  createActions(theResourceMgr);
+  createToolBar();
+}
+
+/*!
+  To initialize the class
+*/
+void
+SVTK_MainWindow
+::Initialize(SVTK_RenderWindowInteractor* theInteractor)
+{
+  myInteractor = theInteractor;
+  SetEventDispatcher(myInteractor->GetDevice());
+
+  setCentralWidget(myInteractor);
+  myInteractor->setBackgroundRole( QPalette::NoRole );//NoBackground
+
+  myInteractor->setFocusPolicy(Qt::StrongFocus);
+  myInteractor->setFocus();
+  setFocusProxy(myInteractor);
+
+  myUpdateRateDlg = new SVTK_UpdateRateDlg(myActionsMap[UpdateRate],this,"SVTK_UpdateRateDlg");
+  myNonIsometricDlg = new SVTK_NonIsometricDlg(myActionsMap[NonIsometric],this,"SVTK_NonIsometricDlg");
+  myCubeAxesDlg = new SVTK_CubeAxesDlg(myActionsMap[GraduatedAxes],this,"SVTK_CubeAxesDlg");
+  mySetRotationPointDlg = new SVTK_SetRotationPointDlg(myActionsMap[ChangeRotationPointId],this,"SVTK_SetRotationPointDlg");
+}
+
+/*!
+  Destructor
+*/
+SVTK_MainWindow
+::~SVTK_MainWindow()
+{
+}
+
+/*!
+  \return used SVTK_RenderWindowInteractor
+*/
+SVTK_RenderWindowInteractor*
+SVTK_MainWindow
+::GetInteractor()
+{
+  return myInteractor;
+}
+
+/*!
+  \return used #vtkRenderWindowInteractor (obsolete)
+*/
+vtkRenderWindowInteractor*
+SVTK_MainWindow
+::getInteractor()
+{
+  return GetInteractor()->GetDevice();
+}
+
+/*!
+  \return used vtkRenderWindow (obsolete)
+*/
+vtkRenderWindow*
+SVTK_MainWindow
+::getRenderWindow()
+{
+  return GetInteractor()->getRenderWindow();
+}
+
+/*!
+  To repaint the view
+  \param theUpdateTrihedron - adjust trihedron
+*/
+void
+SVTK_MainWindow
+::Repaint(bool theUpdateTrihedron)
+{
+  if(theUpdateTrihedron) 
+    GetRenderer()->OnAdjustTrihedron();
+
+  GetInteractor()->update();
+
+  if ( (SVTK_InteractorStyle*)GetInteractorStyle() )
+    ((SVTK_InteractorStyle*)GetInteractorStyle())->OnTimer();
+}
+
+/*!
+  To invoke a VTK event on SVTK_RenderWindowInteractor instance
+*/
+void
+SVTK_MainWindow
+::InvokeEvent(unsigned long theEvent, void* theCallData)
+{
+  GetInteractor()->InvokeEvent(theEvent,theCallData);
+}
+
+/*!
+  Redirect the request to SVTK_RenderWindowInteractor::GetInteractorStyle
+*/
+vtkInteractorStyle*
+SVTK_MainWindow
+::GetInteractorStyle()
+{
+  return GetInteractor()->GetInteractorStyle();
+}
+
+/*!
+  Redirect the request to SVTK_RenderWindowInteractor::PushInteractorStyle
+*/
+void
+SVTK_MainWindow
+::PushInteractorStyle(vtkInteractorStyle* theStyle)
+{
+  GetInteractor()->PushInteractorStyle(theStyle);
+}
+
+/*!
+  Redirect the request to SVTK_RenderWindowInteractor::PopInteractorStyle
+*/
+void
+SVTK_MainWindow
+::PopInteractorStyle()
+{
+  GetInteractor()->PopInteractorStyle();
+}
+
+/*!
+  Redirect the request to SVTK_RenderWindowInteractor::GetSelector
+*/
+SVTK_Selector*
+SVTK_MainWindow
+::GetSelector()
+{
+  return GetInteractor()->GetSelector();
+}
+
+/*!
+  Redirect the request to SVTK_RenderWindowInteractor::SelectionMode
+*/
+Selection_Mode
+SVTK_MainWindow
+::SelectionMode()
+{
+  return GetSelector()->SelectionMode();
+}
+
+/*!
+  Redirect the request to SVTK_RenderWindowInteractor::SetSelectionMode
+*/
+void
+SVTK_MainWindow
+::SetSelectionMode(Selection_Mode theMode)
+{
+  GetSelector()->SetSelectionMode(theMode);
+}
+
+/*!
+  Redirect the request to SVTK_RenderWindowInteractor::GetRenderer
+*/
+SVTK_Renderer* 
+SVTK_MainWindow
+::GetRenderer()
+{
+  return GetInteractor()->GetRenderer();
+}
+
+/*!
+  Redirect the request to SVTK_RenderWindowInteractor::getRenderer
+*/
+vtkRenderer* 
+SVTK_MainWindow
+::getRenderer()
+{
+  return GetInteractor()->getRenderer();
+}
+
+/*!
+  Sets background color of the view
+  \param theColor - new background color
+*/
+void
+SVTK_MainWindow
+::SetBackgroundColor(const QColor& theColor)
+{
+  getRenderer()->SetBackground(theColor.red()/255.0, 
+                              theColor.green()/255.0,
+                              theColor.blue()/255.0);
+}
+
+/*!
+  \return background color of the view
+*/
+QColor
+SVTK_MainWindow
+::BackgroundColor()
+{
+  vtkFloatingPointType aBackgroundColor[3];
+  getRenderer()->GetBackground(aBackgroundColor);
+  return QColor(int(aBackgroundColor[0]*255), 
+               int(aBackgroundColor[1]*255), 
+               int(aBackgroundColor[2]*255));
+}
+
+/*!
+  Redirect the request to SVTK_Renderer::GetScale
+*/
+void
+SVTK_MainWindow
+::GetScale( double theScale[3] ) 
+{
+  GetRenderer()->GetScale( theScale );
+}
+
+/*!
+  Redirect the request to SVTK_Renderer::SetScale
+*/
+void
+SVTK_MainWindow
+::SetScale( double theScale[3] ) 
+{
+  GetRenderer()->SetScale( theScale );
+  Repaint();
+}
+
+/*!
+  Redirect the request to SVTK_Renderer::AddActor
+*/
+void
+SVTK_MainWindow
+::AddActor(VTKViewer_Actor* theActor, 
+          bool theIsUpdate)
+{
+  GetRenderer()->AddActor(theActor);
+  if(theIsUpdate) 
+    Repaint();
+}
+
+/*!
+  Redirect the request to SVTK_Renderer::RemoveActor
+*/
+void
+SVTK_MainWindow
+::RemoveActor(VTKViewer_Actor* theActor, 
+             bool theIsUpdate)
+{
+  GetRenderer()->RemoveActor(theActor);
+  if(theIsUpdate) 
+    Repaint();
+}
+
+/*!
+  Redirect the request to SVTK_Renderer::GetTrihedronSize
+*/
+vtkFloatingPointType
+SVTK_MainWindow
+::GetTrihedronSize()
+{
+  return GetRenderer()->GetTrihedronSize();
+}
+
+/*!
+  Redirect the request to SVTK_Renderer::SetTrihedronSize
+*/
+void 
+SVTK_MainWindow
+::SetTrihedronSize( const vtkFloatingPointType theSize, const bool theRelative )
+{
+  GetRenderer()->SetTrihedronSize(theSize, theRelative);
+  Repaint();
+}
+
+
+/*! If parameter theIsForcedUpdate is true, recalculate parameters for
+ *  trihedron and cube axes, even if trihedron and cube axes is invisible.
+ */
+void
+SVTK_MainWindow
+::AdjustActors()
+{
+  GetRenderer()->AdjustActors();
+  Repaint();
+}
+
+/*!
+  Redirect the request to SVTK_Renderer::IsTrihedronDisplayed
+*/
+bool
+SVTK_MainWindow
+::IsTrihedronDisplayed()
+{
+  return GetRenderer()->IsTrihedronDisplayed();
+}
+
+/*!
+  Redirect the request to SVTK_Renderer::IsCubeAxesDisplayed
+*/
+bool
+SVTK_MainWindow
+::IsCubeAxesDisplayed()
+{
+  return GetRenderer()->IsCubeAxesDisplayed();
+}
+
+/*!
+  Redirect the request to SVTK_Renderer::GetTrihedron
+*/
+VTKViewer_Trihedron*  
+SVTK_MainWindow
+::GetTrihedron() 
+{ 
+  return GetRenderer()->GetTrihedron(); 
+}
+
+/*!
+  Redirect the request to SVTK_Renderer::GetCubeAxes
+*/
+SVTK_CubeAxesActor2D* 
+SVTK_MainWindow
+::GetCubeAxes() 
+{ 
+  return GetRenderer()->GetCubeAxes(); 
+}
+
+/*!
+  \return toolbar of svtk main window
+*/
+QToolBar* 
+SVTK_MainWindow
+::getToolBar()
+{
+  return myToolBar;
+}
+
+void
+SVTK_MainWindow
+::SetEventDispatcher(vtkObject* theDispatcher)
+{
+  myEventDispatcher = theDispatcher;
+}
+
+#if defined(WIN32) && !defined(_DEBUG)
+#pragma optimize( "", off )
+#endif
+
+/*!
+  Creates all actions of svtk main window
+*/
+void
+SVTK_MainWindow
+::createActions(SUIT_ResourceMgr* theResourceMgr)
+{
+  if(!myActionsMap.isEmpty()) 
+    return;
+  
+  QtxAction* anAction;
+
+  // Dump view
+  anAction = new QtxAction(tr("MNU_DUMP_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_DUMP" ) ),
+                          tr( "MNU_DUMP_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_DUMP_VIEW"));
+  connect(anAction, SIGNAL(activated()), myViewWindow, SLOT(onDumpView()));
+  myActionsMap[ DumpId ] = anAction;
+
+  // FitAll
+  anAction = new QtxAction(tr("MNU_FITALL"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITALL" ) ),
+                          tr( "MNU_FITALL" ), 0, this);
+  anAction->setStatusTip(tr("DSC_FITALL"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(onFitAll()));
+  myActionsMap[ FitAllId ] = anAction;
+
+  // FitRect
+  anAction = new QtxAction(tr("MNU_FITRECT"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITAREA" ) ),
+                          tr( "MNU_FITRECT" ), 0, this);
+  anAction->setStatusTip(tr("DSC_FITRECT"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(activateWindowFit()));
+  myActionsMap[ FitRectId ] = anAction;
+
+  // Zoom
+  anAction = new QtxAction(tr("MNU_ZOOM_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ZOOM" ) ),
+                          tr( "MNU_ZOOM_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(activateZoom()));
+  myActionsMap[ ZoomId ] = anAction;
+
+  // Panning
+  anAction = new QtxAction(tr("MNU_PAN_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_PAN" ) ),
+                          tr( "MNU_PAN_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_PAN_VIEW"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(activatePanning()));
+  myActionsMap[ PanId ] = anAction;
+
+  // Global Panning
+  anAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_GLOBALPAN" ) ),
+                          tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning()));
+  myActionsMap[ GlobalPanId ] = anAction;
+
+  // Change rotation point
+  anAction = new QtxAction(tr("MNU_CHANGINGROTATIONPOINT_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATION_POINT" ) ),
+                          tr( "MNU_CHANGINGROTATIONPOINT_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_CHANGINGROTATIONPOINT_VIEW"));
+  anAction->setCheckable(true);
+  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onChangeRotationPoint(bool)));
+  myActionsMap[ ChangeRotationPointId ] = anAction;
+
+  // Rotation
+  anAction = new QtxAction(tr("MNU_ROTATE_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATE" ) ),
+                          tr( "MNU_ROTATE_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_ROTATE_VIEW"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(activateRotation()));
+  myActionsMap[ RotationId ] = anAction;
+
+  // Projections
+  anAction = new QtxAction(tr("MNU_FRONT_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FRONT" ) ),
+                          tr( "MNU_FRONT_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_FRONT_VIEW"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(onFrontView()));
+  myActionsMap[ FrontId ] = anAction;
+
+  anAction = new QtxAction(tr("MNU_BACK_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ),
+                          tr( "MNU_BACK_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_BACK_VIEW"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(onBackView()));
+  myActionsMap[ BackId ] = anAction;
+
+  anAction = new QtxAction(tr("MNU_TOP_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ),
+                          tr( "MNU_TOP_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_TOP_VIEW"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(onTopView()));
+  myActionsMap[ TopId ] = anAction;
+
+  anAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ),
+                          tr( "MNU_BOTTOM_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_BOTTOM_VIEW"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(onBottomView()));
+  myActionsMap[ BottomId ] = anAction;
+
+  anAction = new QtxAction(tr("MNU_LEFT_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ),
+                          tr( "MNU_LEFT_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_LEFT_VIEW"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(onLeftView()));
+  myActionsMap[ LeftId ] = anAction;
+
+  anAction = new QtxAction(tr("MNU_RIGHT_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ),
+                          tr( "MNU_RIGHT_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_RIGHT_VIEW"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(onRightView()));
+  myActionsMap[ RightId ] = anAction;
+
+  // Reset
+  anAction = new QtxAction(tr("MNU_RESET_VIEW"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ),
+                          tr( "MNU_RESET_VIEW" ), 0, this);
+  anAction->setStatusTip(tr("DSC_RESET_VIEW"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(onResetView()));
+  myActionsMap[ ResetId ] = anAction;
+
+  // onViewTrihedron: Shows - Hides Trihedron
+  anAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TRIHEDRON" ) ),
+                          tr( "MNU_SHOW_TRIHEDRON" ), 0, this);
+  anAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(onViewTrihedron()));
+  myActionsMap[ ViewTrihedronId ] = anAction;
+
+  // onNonIsometric: Manage non-isometric params
+  anAction = new QtxAction(tr("MNU_SVTK_SCALING"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_SCALING" ) ),
+                          tr( "MNU_SVTK_SCALING" ), 0, this);
+  anAction->setStatusTip(tr("DSC_SVTK_SCALING"));
+  anAction->setCheckable(true);
+  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onNonIsometric(bool)));
+  myActionsMap[ NonIsometric ] = anAction;
+
+  // onGraduatedAxes: Manage graduated axes params
+  anAction = new QtxAction(tr("MNU_SVTK_GRADUATED_AXES"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_GRADUATED_AXES" ) ),
+                          tr( "MNU_SVTK_GRADUATED_AXES" ), 0, this);
+  anAction->setStatusTip(tr("DSC_SVTK_GRADUATED_AXES"));
+  anAction->setCheckable(true);
+  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onGraduatedAxes(bool)));
+  myActionsMap[ GraduatedAxes ] = anAction;
+
+  // onGraduatedAxes: Manage graduated axes params
+  anAction = new QtxAction(tr("MNU_SVTK_UPDATE_RATE"), 
+                          theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_UPDATE_RATE" ) ),
+                          tr( "MNU_SVTK_UPDATE_RATE" ), 0, this);
+  anAction->setStatusTip(tr("DSC_SVTK_UPDATE_RATE"));
+  anAction->setCheckable(true);
+  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onUpdateRate(bool)));
+  myActionsMap[ UpdateRate ] = anAction;
+}
+
+#if defined(WIN32) && !defined(_DEBUG)
+#pragma optimize( "", on )
+#endif
+
+/*!
+  Creates toolbar of svtk main window
+*/
+void
+SVTK_MainWindow
+::createToolBar()
+{
+  myToolBar->addAction( myActionsMap[DumpId] );
+  myToolBar->addAction( myActionsMap[ViewTrihedronId] );
+
+  QtxMultiAction* aScaleAction = new QtxMultiAction( this );
+  aScaleAction->insertAction( myActionsMap[FitAllId] );
+  aScaleAction->insertAction( myActionsMap[FitRectId] );
+  aScaleAction->insertAction( myActionsMap[ZoomId] );
+  myToolBar->addAction( aScaleAction );
+
+  QtxMultiAction* aPanningAction = new QtxMultiAction( this );
+  aPanningAction->insertAction( myActionsMap[PanId] );
+  aPanningAction->insertAction( myActionsMap[GlobalPanId] );
+  myToolBar->addAction( aPanningAction );
+
+  myToolBar->addAction( myActionsMap[ChangeRotationPointId] );
+
+  myToolBar->addAction( myActionsMap[RotationId] );
+
+  QtxMultiAction* aViewsAction = new QtxMultiAction( this );
+  aViewsAction->insertAction( myActionsMap[FrontId] );
+  aViewsAction->insertAction( myActionsMap[BackId] );
+  aViewsAction->insertAction( myActionsMap[TopId] );
+  aViewsAction->insertAction( myActionsMap[BottomId] );
+  aViewsAction->insertAction( myActionsMap[LeftId] );
+  aViewsAction->insertAction( myActionsMap[RightId] );
+  myToolBar->addAction( aViewsAction );
+
+  myToolBar->addAction( myActionsMap[ResetId] );
+
+  myToolBar->addAction( myActionsMap[UpdateRate] );
+  myToolBar->addAction( myActionsMap[NonIsometric] );
+  myToolBar->addAction( myActionsMap[GraduatedAxes] );
+}
+
+/*!
+  Custom show event handler
+*/
+void
+SVTK_MainWindow
+::showEvent( QShowEvent * theEvent ) 
+{
+  emit Show( theEvent );
+}
+
+/*!
+  Custom hide event handler
+*/
+void
+SVTK_MainWindow
+::hideEvent( QHideEvent * theEvent ) 
+{
+  emit Hide( theEvent );
+}
+
+/*!
+  Starts zoom transformation
+*/
+void
+SVTK_MainWindow
+::activateZoom()
+{
+  myEventDispatcher->InvokeEvent(SVTK::StartZoom,0);
+}
+
+/*!
+  Starts panning transformation
+*/
+void
+SVTK_MainWindow
+::activatePanning()
+{
+  myEventDispatcher->InvokeEvent(SVTK::StartPan,0);
+}
+
+/*!
+  Starts rotation transformation
+*/
+void
+SVTK_MainWindow
+::activateRotation()
+{
+  myEventDispatcher->InvokeEvent(SVTK::StartRotate,0);
+}
+
+/*!
+  Change rotation point
+*/
+void
+SVTK_MainWindow
+::onChangeRotationPoint(bool theIsActivate)
+{
+  if(theIsActivate){
+    mySetRotationPointDlg->addObserver();
+    if ( mySetRotationPointDlg->IsFirstShown() )
+      activateSetRotationGravity();
+    mySetRotationPointDlg->show();
+  }else
+    mySetRotationPointDlg->hide();
+}
+
+/*!
+  Set the gravity center as a rotation point
+*/
+void
+SVTK_MainWindow
+::activateSetRotationGravity()
+{
+  myEventDispatcher->InvokeEvent(SVTK::SetRotateGravity,0);
+}
+
+/*!
+  Set the selected point as a rotation point
+*/
+void
+SVTK_MainWindow
+::activateSetRotationSelected(void* theData)
+{
+  myEventDispatcher->InvokeEvent(SVTK::ChangeRotationPoint,theData);
+}
+
+/*!
+  Set the point selected by user as a rotation point
+*/
+void
+SVTK_MainWindow
+::activateStartPointSelection()
+{
+  myEventDispatcher->InvokeEvent(SVTK::StartPointSelection,0);
+}
+
+/*!
+  Starts global panning transformation
+*/
+void
+SVTK_MainWindow
+::activateGlobalPanning()
+{
+  myEventDispatcher->InvokeEvent(SVTK::StartGlobalPan,0);
+}
+
+/*!
+  Starts window fit transformation
+*/
+void
+SVTK_MainWindow
+::activateWindowFit()
+{
+  myEventDispatcher->InvokeEvent(SVTK::StartFitArea,0);
+}
+
+/*!
+  Processes transformation "front view"
+*/
+void
+SVTK_MainWindow
+::onFrontView()
+{
+  GetRenderer()->OnFrontView();
+  Repaint();
+}
+
+/*!
+  Processes transformation "back view"
+*/
+void
+SVTK_MainWindow
+::onBackView()
+{
+  GetRenderer()->OnBackView();
+  Repaint();
+}
+
+/*!
+  Processes transformation "top view"
+*/
+void
+SVTK_MainWindow
+::onTopView()
+{
+  GetRenderer()->OnTopView();
+  Repaint();
+}
+
+/*!
+  Processes transformation "bottom view"
+*/
+void
+SVTK_MainWindow
+::onBottomView()
+{
+  GetRenderer()->OnBottomView();
+  Repaint();
+}
+
+/*!
+  Processes transformation "left view"
+*/
+void
+SVTK_MainWindow
+::onLeftView()
+{
+  GetRenderer()->OnLeftView();
+  Repaint();
+}
+
+/*!
+  Processes transformation "right view"
+*/
+void
+SVTK_MainWindow
+::onRightView()
+{
+  GetRenderer()->OnRightView();
+  Repaint();
+}
+
+/*!
+  Processes transformation "reset view": sets default orientation of viewport camera
+*/
+void
+SVTK_MainWindow
+::onResetView()
+{
+  GetRenderer()->OnResetView();
+  Repaint();
+}
+
+/*!
+  Processes transformation "fit all"
+*/
+void
+SVTK_MainWindow
+::onFitAll()
+{
+  GetRenderer()->OnFitAll();
+  Repaint();
+}
+
+/*!
+  Shows trihedron
+*/
+void 
+SVTK_MainWindow
+::onViewTrihedron()
+{
+  GetRenderer()->OnViewTrihedron();
+  Repaint();
+}
+
+/*!
+  Shows cube axes
+*/
+void
+SVTK_MainWindow
+::onViewCubeAxes()
+{
+  GetRenderer()->OnViewCubeAxes();
+  Repaint();
+}
+
+void
+SVTK_MainWindow
+::onUpdateRate(bool theIsActivate)
+{
+  if(theIsActivate){
+    myUpdateRateDlg->Update();
+    myUpdateRateDlg->show();
+  }else
+    myUpdateRateDlg->hide();
+}
+
+void
+SVTK_MainWindow
+::onNonIsometric(bool theIsActivate)
+{
+  if(theIsActivate){
+    myNonIsometricDlg->Update();
+    myNonIsometricDlg->show();
+  }else
+    myNonIsometricDlg->hide();
+}
+
+void
+SVTK_MainWindow
+::onGraduatedAxes(bool theIsActivate)
+{
+  if(theIsActivate){
+    myCubeAxesDlg->Update();
+    myCubeAxesDlg->show();
+  }else
+    myCubeAxesDlg->hide();
+}
+
+void
+SVTK_MainWindow
+::onAdjustTrihedron()
+{   
+  GetRenderer()->OnAdjustTrihedron();
+}
+
+void
+SVTK_MainWindow
+::onAdjustCubeAxes()
+{   
+  GetRenderer()->OnAdjustCubeAxes();
+}
+
+/*!
+  \return QImage, containing all scene rendering in window
+*/
+QImage
+SVTK_MainWindow
+::dumpView()
+{
+  QPixmap px = QPixmap::grabWindow( GetInteractor()->winId() );
+  return px.toImage();
+}
diff --git a/src/SVTK/SVTK_MainWindow.h b/src/SVTK/SVTK_MainWindow.h
new file mode 100644 (file)
index 0000000..77157c0
--- /dev/null
@@ -0,0 +1,274 @@
+// Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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 SVTK_MAINWINDOW_H
+#define SVTK_MAINWINDOW_H
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+#include "SVTK.h"
+#include "SVTK_Selection.h"
+
+#include <vtkSmartPointer.h>
+
+#include <QMainWindow>
+#include <QMap>
+
+class QtxAction;
+
+class vtkObject;
+class vtkRenderer;
+class vtkRenderWindow;
+class vtkInteractorStyle;
+class vtkRenderWindowInteractor;
+
+class SUIT_ResourceMgr;
+class SUIT_ViewWindow;
+
+class SVTK_RenderWindowInteractor;
+class SVTK_NonIsometricDlg;
+class SVTK_UpdateRateDlg;
+class SVTK_CubeAxesActor2D;
+class SVTK_CubeAxesDlg;
+class SVTK_SetRotationPointDlg;
+
+class VTKViewer_Trihedron;
+class VTKViewer_Actor;
+
+class SVTK_Renderer;
+class SVTK_Selector;
+
+
+//! The class is a container for #SVTK_RenderWindowInteractor.
+/*!
+  The class contains #SVTK_RenderWindowInteractor instance and
+  adds predefined viewer actions and toolbar for user interaction.
+*/
+class SVTK_EXPORT SVTK_MainWindow: public QMainWindow
+{
+  Q_OBJECT;
+
+public:
+  SVTK_MainWindow(QWidget* theParent, 
+                 const char* theName,
+                 SUIT_ResourceMgr* theResourceMgr,
+                 SUIT_ViewWindow* theViewWindow);
+  
+  //! To initialize the class
+  virtual
+  void
+  Initialize(SVTK_RenderWindowInteractor* theInteractor);
+
+  virtual
+  ~SVTK_MainWindow();
+
+  //----------------------------------------------------------------------------
+  //! Get used #SVTK_RenderWindowInteractor
+  SVTK_RenderWindowInteractor*
+  GetInteractor();
+
+  //! Get used #vtkRenderWindowInteractor (obsolete)
+  vtkRenderWindowInteractor*
+  getInteractor();
+
+  //! Get used #vtkRenderWindow (obsolete)
+  vtkRenderWindow*
+  getRenderWindow();
+
+  //! To repaint the view
+  void
+  Repaint(bool theUpdateTrihedron = true);
+
+  //! To invoke a VTK event on #SVTK_RenderWindowInteractor instance
+  void
+  InvokeEvent(unsigned long theEvent, void* theCallData);
+
+  //----------------------------------------------------------------------------
+  //! Redirect the request to #SVTK_RenderWindowInteractor::GetInteractorStyle
+  vtkInteractorStyle* 
+  GetInteractorStyle();
+
+  //! Redirect the request to #SVTK_RenderWindowInteractor::PushInteractorStyle
+  void
+  PushInteractorStyle(vtkInteractorStyle* theStyle);
+
+  //! Redirect the request to #SVTK_RenderWindowInteractor::PopInteractorStyle
+  void
+  PopInteractorStyle();
+
+  //----------------------------------------------------------------------------
+  //! Redirect the request to #SVTK_RenderWindowInteractor::GetSelector
+  SVTK_Selector* 
+  GetSelector();
+
+  //! Redirect the request to #SVTK_RenderWindowInteractor::SelectionMode
+  Selection_Mode
+  SelectionMode();
+
+  //! Redirect the request to #SVTK_RenderWindowInteractor::SetSelectionMode
+  void 
+  SetSelectionMode(Selection_Mode theMode);
+
+  //----------------------------------------------------------------------------
+  //! Redirect the request to #SVTK_RenderWindowInteractor::GetRenderer
+  SVTK_Renderer* 
+  GetRenderer();
+
+  //! Redirect the request to #SVTK_RenderWindowInteractor::getRenderer
+  vtkRenderer* 
+  getRenderer();
+
+  //! Set background color to the view
+  void
+  SetBackgroundColor(const QColor& theColor);
+
+  //! Get background color of the view
+  QColor 
+  BackgroundColor();
+
+  //! Redirect the request to #SVTK_Renderer::SetScale
+  void
+  SetScale(double theScale[3]);
+
+  //! Redirect the request to #SVTK_Renderer::GetScale
+  void
+  GetScale(double theScale[3]);
+
+  //! Redirect the request to #SVTK_Renderer::AddActor
+  virtual
+  void 
+  AddActor(VTKViewer_Actor* theActor, 
+          bool theIsUpdate = false);
+
+  //! Redirect the request to #SVTK_Renderer::RemoveActor
+  virtual
+  void 
+  RemoveActor(VTKViewer_Actor* theActor, 
+             bool theIsUpdate = false);
+
+  //! Redirect the request to #SVTK_Renderer::GetTrihedronSize
+  vtkFloatingPointType  
+  GetTrihedronSize();
+
+  //! Redirect the request to #SVTK_Renderer::SetTrihedronSize
+  void
+  SetTrihedronSize(const vtkFloatingPointType theSize, const bool theRelative = true);
+
+  //! Redirect the request to #SVTK_Renderer::AdjustActors
+  void 
+  AdjustActors();
+
+  //! Redirect the request to #SVTK_Renderer::IsTrihedronDisplayed
+  bool
+  IsTrihedronDisplayed();
+  //! Redirect the request to #SVTK_Renderer::IsCubeAxesDisplayed
+  bool
+  IsCubeAxesDisplayed();
+
+  //! Redirect the request to #SVTK_Renderer::GetTrihedron
+  VTKViewer_Trihedron* 
+  GetTrihedron();
+
+  //! Redirect the request to #SVTK_Renderer::GetCubeAxes
+  SVTK_CubeAxesActor2D*
+  GetCubeAxes();
+
+  //----------------------------------------------------------------------------
+  QToolBar* getToolBar();
+
+ signals:
+  void Show( QShowEvent * );
+  void Hide( QHideEvent * );
+  
+ public slots:
+  virtual void showEvent( QShowEvent * );
+  virtual void hideEvent( QHideEvent * );
+
+  void activateZoom();
+  void activateWindowFit();
+  void activateRotation();
+  void activatePanning(); 
+  void activateGlobalPanning(); 
+
+  void onChangeRotationPoint(bool theIsActivate);
+
+  void activateSetRotationGravity();
+  void activateSetRotationSelected(void* theData);
+  void activateStartPointSelection();
+
+  void onFrontView(); 
+  void onBackView(); 
+  void onTopView();
+  void onBottomView();
+  void onRightView(); 
+  void onLeftView();     
+
+  void onResetView();     
+  void onFitAll();
+
+  void onViewTrihedron(); 
+  void onViewCubeAxes();
+
+  void onUpdateRate(bool theIsActivate);
+  void onNonIsometric(bool theIsActivate);
+  void onGraduatedAxes(bool theIsActivate);
+
+  void onAdjustTrihedron();
+  void onAdjustCubeAxes();
+
+ public:
+  QImage dumpView();
+
+ protected:  
+  void
+  createActions(SUIT_ResourceMgr* theResourceMgr);
+
+  void
+  createToolBar();
+
+  void
+  SetEventDispatcher(vtkObject* theDispatcher);
+
+  enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, 
+        ChangeRotationPointId, RotationId,
+         FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, 
+        ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate};
+  typedef QMap<int, QtxAction*> TActionsMap;
+
+  SUIT_ViewWindow* myViewWindow;
+
+  SVTK_NonIsometricDlg* myNonIsometricDlg;
+  SVTK_UpdateRateDlg* myUpdateRateDlg;
+  SVTK_CubeAxesDlg* myCubeAxesDlg;
+  SVTK_SetRotationPointDlg* mySetRotationPointDlg;
+
+  vtkSmartPointer<vtkObject> myEventDispatcher;
+  TActionsMap myActionsMap;  
+  QToolBar* myToolBar;
+
+  SVTK_RenderWindowInteractor* myInteractor;
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif
diff --git a/src/SVTK/SVTK_NonIsometricDlg.cxx b/src/SVTK/SVTK_NonIsometricDlg.cxx
new file mode 100644 (file)
index 0000000..a3a2044
--- /dev/null
@@ -0,0 +1,200 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#include "SVTK_NonIsometricDlg.h"
+#include "SVTK_MainWindow.h"
+#include "SVTK_Renderer.h"
+
+#include "QtxDoubleSpinBox.h"
+#include "QtxAction.h"
+
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QGridLayout>
+
+using namespace std;
+
+/*!
+  Constructor
+*/
+SVTK_NonIsometricDlg
+::SVTK_NonIsometricDlg(QtxAction* theAction,
+                      SVTK_MainWindow* theParent,
+                      const char* theName):
+  SVTK_DialogBase(theAction,
+                 theParent, 
+                 theName),
+  m_MainWindow(theParent)
+{
+  setWindowTitle(tr("DLG_TITLE"));
+  setSizeGripEnabled(TRUE);
+
+  // Create layout for this dialog
+  QGridLayout* layoutDlg = new QGridLayout (this);
+  layoutDlg->setSpacing(6);
+  layoutDlg->setMargin(11);
+
+  // Create croup box with grid layout
+  QGroupBox* aGroupBox = new QGroupBox(this);
+  aGroupBox->setObjectName("GroupBox");
+  QHBoxLayout* aHBoxLayout = new QHBoxLayout(aGroupBox);
+  aHBoxLayout->setMargin(11);
+  aHBoxLayout->setSpacing(6);
+
+  // "X" scaling
+  QLabel* TextLabelX = new QLabel (tr("LBL_X"), aGroupBox);
+  TextLabelX->setObjectName("TextLabelX");
+  TextLabelX->setFixedWidth(15);
+  m_sbXcoeff = new QtxDoubleSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox);
+  m_sbXcoeff->setMinimumWidth(80);
+  m_sbXcoeff->setValue(1.0);
+
+  // "Y" scaling
+  QLabel* TextLabelY = new QLabel (tr("LBL_Y"), aGroupBox);
+  TextLabelY->setObjectName("TextLabelY");
+  TextLabelY->setFixedWidth(15);
+  m_sbYcoeff = new QtxDoubleSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox);
+  m_sbYcoeff->setMinimumWidth(80);
+  m_sbYcoeff->setValue(1.0);
+
+  // "Z" scaling
+  QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), aGroupBox);
+  TextLabelZ->setObjectName("TextLabelZ");
+  TextLabelZ->setFixedWidth(15);
+  m_sbZcoeff = new QtxDoubleSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox);
+  m_sbZcoeff->setMinimumWidth(80);
+  m_sbZcoeff->setValue(1.0);
+
+  // Create <Reset> button
+  m_bReset = new QPushButton(tr("&Reset"), aGroupBox);
+  m_bReset->setObjectName("m_bReset");
+
+  // Layout widgets in the group box
+  aHBoxLayout->addWidget(TextLabelX);
+  aHBoxLayout->addWidget(m_sbXcoeff);
+  aHBoxLayout->addWidget(TextLabelY);
+  aHBoxLayout->addWidget(m_sbYcoeff);
+  aHBoxLayout->addWidget(TextLabelZ);
+  aHBoxLayout->addWidget(m_sbZcoeff);
+  //aHBoxLayout->addStretch();
+  aHBoxLayout->addWidget(m_bReset);
+
+  // OK, CANCEL, Apply button
+  QGroupBox* aGroupBox2 = new QGroupBox(this);
+  QHBoxLayout* aHBoxLayout2 = new QHBoxLayout(aGroupBox2);
+  aHBoxLayout2->setMargin(11);
+  aHBoxLayout2->setSpacing(6);
+  // Create <OK> button
+  QPushButton* m_bOk = new QPushButton(tr("O&K"), aGroupBox2);
+  m_bOk->setObjectName("m_bOk");
+  m_bOk->setDefault(TRUE);
+  m_bOk->setAutoDefault(TRUE);
+  // Create <Apply> button
+  QPushButton* m_bApply = new QPushButton(tr("&Apply"), aGroupBox2);
+  m_bApply->setObjectName("m_bApply");
+  m_bApply->setAutoDefault(TRUE);
+  // Create <Cancel> button
+  QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aGroupBox2);
+  m_bCancel->setObjectName("m_bCancel");
+  m_bCancel->setAutoDefault(TRUE);
+
+  // Layout buttons
+  aHBoxLayout2->addWidget(m_bOk);
+  aHBoxLayout2->addWidget(m_bApply);
+  aHBoxLayout2->addStretch();
+  aHBoxLayout2->addWidget(m_bCancel);
+
+  // Layout top level widgets
+  layoutDlg->addWidget(aGroupBox,0,0);
+  layoutDlg->addWidget(aGroupBox2,1,0);
+
+  // signals and slots connections
+  connect(m_bCancel, SIGNAL(clicked()), this, SLOT(onClickClose()));
+  connect(m_bOk,     SIGNAL(clicked()), this, SLOT(onClickOk()));
+  connect(m_bApply,  SIGNAL(clicked()), this, SLOT(onClickApply()));
+  connect(m_bReset,  SIGNAL(clicked()), this, SLOT(onClickReset()));
+
+  this->resize(100, this->sizeHint().height());
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+SVTK_NonIsometricDlg
+::~SVTK_NonIsometricDlg()
+{
+  // no need to delete child widgets, Qt does it all for us
+}
+
+void 
+SVTK_NonIsometricDlg
+::Update()
+{
+  // Get values from the VTK view
+  double aScaleFactor[3];
+  m_MainWindow->GetScale(aScaleFactor);
+  m_sbXcoeff->setValue(aScaleFactor[0]);
+  m_sbYcoeff->setValue(aScaleFactor[1]);
+  m_sbZcoeff->setValue(aScaleFactor[2]);
+}
+
+void 
+SVTK_NonIsometricDlg
+::onClickOk()
+{
+  //apply changes
+  onClickApply();
+  //Close dialog
+  accept();
+}
+
+void
+SVTK_NonIsometricDlg
+::onClickApply()
+{
+  double aScale[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()};
+  m_MainWindow->SetScale(aScale);
+}
+
+void
+SVTK_NonIsometricDlg
+::onClickReset()
+{
+  m_bReset->setFocus();
+  m_sbXcoeff->setValue(1.0);
+  m_sbYcoeff->setValue(1.0);
+  m_sbZcoeff->setValue(1.0);
+}
+
+void 
+SVTK_NonIsometricDlg
+::onClickClose()
+{
+  reject();
+}
diff --git a/src/SVTK/SVTK_NonIsometricDlg.h b/src/SVTK/SVTK_NonIsometricDlg.h
new file mode 100644 (file)
index 0000000..bcb730d
--- /dev/null
@@ -0,0 +1,70 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_NONISOMETRICDLG_H
+#define SVTK_NONISOMETRICDLG_H
+
+#include "SVTK_DialogBase.h"
+
+class SVTK_MainWindow;
+
+class QtxDoubleSpinBox;
+class QtxAction;
+
+class QPushButton;
+
+
+class SVTK_NonIsometricDlg : public SVTK_DialogBase
+{
+  Q_OBJECT;
+
+public:
+  SVTK_NonIsometricDlg(QtxAction* theAction,
+                      SVTK_MainWindow* theParent,
+                      const char* theName);
+
+  ~SVTK_NonIsometricDlg();
+
+  void Update();
+
+protected:
+  SVTK_MainWindow *m_MainWindow;
+
+  QtxDoubleSpinBox* m_sbXcoeff;
+  QtxDoubleSpinBox* m_sbYcoeff;
+  QtxDoubleSpinBox* m_sbZcoeff;
+  QPushButton* m_bReset;
+
+protected slots:
+  void onClickApply();
+  void onClickReset();
+  void onClickOk();
+  void onClickClose();
+};
+
+#endif // SVTK_NONISOMETRICDLG_H
diff --git a/src/SVTK/SVTK_Prs.cxx b/src/SVTK/SVTK_Prs.cxx
new file mode 100644 (file)
index 0000000..3e017e8
--- /dev/null
@@ -0,0 +1,82 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2004  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
+//
+//
+//
+//  File   : SVTK_Prs.cxx
+//  Author : Sergey ANIKIN
+//  Module : SALOME
+//  $Header$
+
+#include "SVTK_Prs.h"
+
+#include <vtkActorCollection.h>
+
+using namespace std;
+
+/*!
+  Default constructor
+*/
+SVTK_Prs::SVTK_Prs() : myObjects( 0 )
+{
+}
+/*!
+  Standard constructor
+*/
+SVTK_Prs::SVTK_Prs( const vtkActor* obj ) 
+{ 
+  AddObject( obj ); 
+}
+
+/*!
+  Destructor
+*/
+SVTK_Prs:: ~SVTK_Prs() 
+{ 
+  if ( myObjects ) myObjects->Delete(); 
+}
+
+/*!
+  \return actors list
+*/
+vtkActorCollection* SVTK_Prs::GetObjects() const 
+{ 
+  return myObjects; 
+}
+
+/*!
+  Add actor
+*/
+void SVTK_Prs::AddObject( const vtkActor* obj ) 
+{ 
+  if ( !myObjects) 
+    myObjects = vtkActorCollection::New(); 
+  myObjects->AddItem( (vtkActor*)obj ); 
+}
+  
+/*!
+  \return 0 if list of the actors is empty [ Reimplemented from SALOME_Prs ]
+*/
+bool SVTK_Prs::IsNull() const 
+{ 
+  return !myObjects || myObjects->GetNumberOfItems() <= 0; 
+}
diff --git a/src/SVTK/SVTK_Prs.h b/src/SVTK/SVTK_Prs.h
new file mode 100644 (file)
index 0000000..7931972
--- /dev/null
@@ -0,0 +1,60 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2004  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
+//
+//
+//
+//  File   : SVTK_Prs.h
+//  Author : Sergey ANIKIN
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_Prs_H
+#define SVTK_Prs_H
+
+#include <SVTK.h>
+#include "SALOME_Prs.h"
+
+class vtkActorCollection;
+class vtkActor;
+
+class SVTK_EXPORT SVTK_Prs : public SALOME_VTKPrs
+{
+public:
+  SVTK_Prs();
+  // Default constructor
+  SVTK_Prs( const vtkActor* obj );
+  // Standard constructor
+  ~SVTK_Prs();
+  // Destructor
+
+  vtkActorCollection* GetObjects() const;
+  // Get actors list
+  void AddObject( const vtkActor* obj );
+  // Add actor
+  
+  bool IsNull() const;
+  // Reimplemented from SALOME_Prs
+
+private:
+  vtkActorCollection* myObjects;    // list of actors
+};
+
+#endif
diff --git a/src/SVTK/SVTK_RectPicker.cxx b/src/SVTK/SVTK_RectPicker.cxx
new file mode 100644 (file)
index 0000000..9aaad40
--- /dev/null
@@ -0,0 +1,492 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_RectPicker.cxx
+//  Author : 
+//  Module : SALOME
+
+#include "SVTK_RectPicker.h"
+
+#include <set>
+
+#include <vtkObjectFactory.h>
+#include <vtkCommand.h>
+
+#include <vtkAbstractMapper3D.h>
+#include <vtkMapper.h>
+#include <vtkProperty.h>
+
+#include <vtkAssemblyPath.h>
+#include <vtkAssemblyNode.h>
+
+#include <vtkRenderWindow.h>
+#include <vtkMatrix4x4.h>
+#include <vtkRenderer.h>
+#include <vtkDataSet.h>
+#include <vtkPoints.h>
+#include <vtkCamera.h>
+#include <vtkCell.h>
+
+namespace
+{
+  //----------------------------------------------------------------------------
+  inline
+  vtkFloatingPointType
+  GetZ(float* theZPtr,
+       int theSelection[4],
+       int theDX,
+       int theDY)
+  {
+    return theZPtr[theDX - theSelection[0] + (theDY - theSelection[1])*(theSelection[2] - theSelection[0] + 1)];
+  }
+
+
+  //----------------------------------------------------------------------------
+  inline
+  int
+  Check(float* theZPtr,
+       int theSelection[4],
+       vtkFloatingPointType theTolerance,
+       vtkFloatingPointType theDZ,
+       int theDX,
+       int theDY)
+  {
+    int aRet = 0;
+    vtkFloatingPointType aZ = -1.0;
+    if(theDX >= theSelection[0] && theDX <= theSelection[2] &&
+       theDY >= theSelection[1] && theDY <= theSelection[3])
+    {
+      // Access the value from the captured zbuffer.  Note, we only
+      // captured a portion of the zbuffer, so we need to offset dx by
+      // the selection window.
+      aZ = GetZ(theZPtr,theSelection,theDX,theDY);
+      if(aZ > theTolerance && aZ < 1.0 - theTolerance){
+       aRet = fabs(aZ - theDZ) <= theTolerance;
+      }
+    }
+
+    //cout<<"\tCheck = {"<<theDX<<", "<<theDY<<", "<<theDZ<<", "<<aZ<<"} = "<<aRet<<"\n";
+    return aRet;
+  }
+
+
+  //----------------------------------------------------------------------------
+  void
+  SelectVisiblePoints(int theSelection[4],
+                     vtkRenderer *theRenderer,
+                     vtkDataSet *theInput,
+                     SVTK_RectPicker::TVectorIds& theVisibleIds,
+                     SVTK_RectPicker::TVectorIds& theInVisibleIds,
+                     vtkFloatingPointType theTolerance)
+  {
+    theVisibleIds.clear();
+    theInVisibleIds.clear();
+
+    vtkIdType aNumPts = theInput->GetNumberOfPoints();
+    if(aNumPts < 1)
+      return;
+    
+    theVisibleIds.reserve(aNumPts/2 + 1);
+    theInVisibleIds.reserve(aNumPts/2 + 1);
+
+    // Grab the composite perspective transform.  This matrix is used to convert
+    // each point to view coordinates.  vtkRenderer provides a WorldToView()
+    // method but it computes the composite perspective transform each time
+    // WorldToView() is called.  This is expensive, so we get the matrix once
+    // and handle the transformation ourselves.
+    vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
+    aMatrix->DeepCopy(theRenderer->GetActiveCamera()->
+                     GetCompositePerspectiveTransformMatrix(1,0,1));
+
+    // We grab the z-buffer for the selection region all at once and probe the resulting array.
+    float *aZPtr = theRenderer->GetRenderWindow()->
+      GetZbufferData(theSelection[0], theSelection[1], theSelection[2], theSelection[3]);
+
+    //cout<<"theSelection = {"<<theSelection[0]<<", "<<theSelection[1]<<", "<<theSelection[2]<<", "<<theSelection[3]<<"}\n";
+    /*
+    for(int iY = theSelection[1]; iY <= theSelection[3];  iY++){
+      for(int iX = theSelection[0]; iX <= theSelection[2];  iX++){
+       cout<<GetZ(aZPtr,theSelection,iX,iY)<<" ";
+      }
+      cout<<endl;
+    }
+    */
+    for(vtkIdType aPntId = 0; aPntId < aNumPts; aPntId++){
+      // perform conversion
+      vtkFloatingPointType aX[4] = {1.0, 1.0, 1.0, 1.0};
+      theInput->GetPoint(aPntId,aX);
+
+      vtkFloatingPointType aView[4];
+      aMatrix->MultiplyPoint(aX,aView);
+      if(aView[3] == 0.0)
+       continue;
+      theRenderer->SetViewPoint(aView[0]/aView[3], 
+                               aView[1]/aView[3],
+                               aView[2]/aView[3]);
+      theRenderer->ViewToDisplay();
+
+      vtkFloatingPointType aDX[3];
+      theRenderer->GetDisplayPoint(aDX);
+      
+      // check whether visible and in selection window 
+      if(aDX[0] >= theSelection[0] && aDX[0] <= theSelection[2] &&
+         aDX[1] >= theSelection[1] && aDX[1] <= theSelection[3])
+      {
+       //cout<<"aPntId "<<aPntId<<"; aDX = {"<<aDX[0]<<", "<<aDX[1]<<", "<<aDX[2]<<"}\n";
+       int aDX0 = int(aDX[0]);
+       int aDX1 = int(aDX[1]);
+
+       int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aDX0,aDX1);
+       if(aRet > 0)
+         goto ADD_VISIBLE;
+       if(aRet < 0)
+         goto ADD_INVISIBLE;
+
+       static int aMaxRadius = 5;
+       for(int aRadius = 1; aRadius < aMaxRadius; aRadius++){
+         int aStartDX[2] = {aDX0 - aRadius, aDX1 - aRadius};
+         for(int i = 0; i <= aRadius; i++){
+           int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0]++,aStartDX[1]);
+           if(aRet > 0)
+             goto ADD_VISIBLE;
+           if(aRet < 0)
+             goto ADD_INVISIBLE;
+         }
+         for(int i = 0; i <= aRadius; i++){
+           int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0],aStartDX[1]++);
+           if(aRet > 0)
+             goto ADD_VISIBLE;
+           if(aRet < 0)
+             goto ADD_INVISIBLE;
+         }
+         for(int i = 0; i <= aRadius; i++){
+           int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0]--,aStartDX[1]);
+           if(aRet > 0)
+             goto ADD_VISIBLE;
+           if(aRet < 0)
+             goto ADD_INVISIBLE;
+         }
+         for(int i = 0; i <= aRadius; i++){
+           int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0],aStartDX[1]--);
+           if(aRet > 0)
+             goto ADD_VISIBLE;
+           if(aRet < 0)
+             goto ADD_INVISIBLE;
+         }
+       }
+       if(false)
+         ADD_VISIBLE : theVisibleIds.push_back(aPntId);
+       if(false)
+         ADD_INVISIBLE : theInVisibleIds.push_back(aPntId);
+      }
+    }//for all points
+
+    aMatrix->Delete();
+
+    if(aZPtr)
+      delete [] aZPtr;
+  }
+
+
+  //----------------------------------------------------------------------------
+  inline
+  void
+  GetCenter(const vtkFloatingPointType theBounds[6],
+           vtkFloatingPointType theCenter[3])
+  {
+    theCenter[0] = (theBounds[1] + theBounds[0]) / 2.0;
+    theCenter[1] = (theBounds[3] + theBounds[2]) / 2.0;
+    theCenter[2] = (theBounds[5] + theBounds[4]) / 2.0;
+  }
+
+  void
+  SelectVisibleCells(int theSelection[4],
+                    vtkRenderer *theRenderer,
+                    vtkDataSet *theInput,
+                    SVTK_RectPicker::TVectorIds& theVectorIds,
+                    vtkFloatingPointType theTolerance)
+  {
+    theVectorIds.clear();
+
+    vtkIdType aNumCells = theInput->GetNumberOfCells();
+    if(aNumCells < 1)
+      return;
+    
+    theVectorIds.reserve(aNumCells/2 + 1);
+
+    SVTK_RectPicker::TVectorIds aVisiblePntIds;
+    SVTK_RectPicker::TVectorIds anInVisiblePntIds;
+    SelectVisiblePoints(theSelection,
+                       theRenderer,
+                       theInput,
+                       aVisiblePntIds,
+                       anInVisiblePntIds,
+                       theTolerance);
+
+    typedef std::set<vtkIdType> TIdsSet;
+    TIdsSet aVisibleIds(aVisiblePntIds.begin(),aVisiblePntIds.end());
+    TIdsSet anInVisibleIds(anInVisiblePntIds.begin(),anInVisiblePntIds.end());
+
+    // Grab the composite perspective transform.  This matrix is used to convert
+    // each point to view coordinates.  vtkRenderer provides a WorldToView()
+    // method but it computes the composite perspective transform each time
+    // WorldToView() is called.  This is expensive, so we get the matrix once
+    // and handle the transformation ourselves.
+    vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
+    aMatrix->DeepCopy(theRenderer->GetActiveCamera()->
+                     GetCompositePerspectiveTransformMatrix(1,0,1));
+
+    for(vtkIdType aCellId = 0; aCellId < aNumCells; aCellId++){
+      vtkCell* aCell = theInput->GetCell(aCellId);
+
+      vtkFloatingPointType aBounds[6];
+      aCell->GetBounds(aBounds);
+
+      vtkFloatingPointType aCenter[3];
+      GetCenter(aBounds,aCenter);
+
+      vtkFloatingPointType aView[4];
+      vtkFloatingPointType aX[4] = {aCenter[0], aCenter[1], aCenter[2], 1.0};
+      aMatrix->MultiplyPoint(aX,aView);
+
+      if(aView[3] == 0.0)
+       continue;
+
+      theRenderer->SetViewPoint(aView[0]/aView[3], 
+                               aView[1]/aView[3],
+                               aView[2]/aView[3]);
+      theRenderer->ViewToDisplay();
+
+      vtkFloatingPointType aDX[3];
+      theRenderer->GetDisplayPoint(aDX);
+      
+      // check whether visible and in selection window 
+      if(aDX[0] >= theSelection[0] && aDX[0] <= theSelection[2] &&
+         aDX[1] >= theSelection[1] && aDX[1] <= theSelection[3])
+      {
+
+       //cout<<"aCellId = "<<aCellId<<": ";
+       vtkIdType aNumPts = aCell->GetNumberOfPoints();
+       bool anIsVisible = true;
+       for(vtkIdType anId = 0; anId < aNumPts; anId++){
+         vtkIdType aPntId = aCell->GetPointId(anId);
+         //cout<<aPntId<<"; ";
+         anIsVisible = aVisibleIds.find(aPntId) != aVisibleIds.end();
+         if(!anIsVisible)
+           break;
+       }
+       //cout<<"\t"<<anIsVisible<<"\n";
+       if(anIsVisible)
+         theVectorIds.push_back(aCellId);
+      }
+    }//for all parts
+  }
+
+  //----------------------------------------------------------------------------
+  void
+  CalculatePickPosition(vtkRenderer *theRenderer,
+                       vtkFloatingPointType theSelectionX, 
+                       vtkFloatingPointType theSelectionY, 
+                       vtkFloatingPointType theSelectionZ,
+                       vtkFloatingPointType thePickPosition[3])
+  {
+    // Convert the selection point into world coordinates.
+    //
+    theRenderer->SetDisplayPoint(theSelectionX, theSelectionY, theSelectionZ);
+    theRenderer->DisplayToWorld();
+    vtkFloatingPointType* aWorldCoords = theRenderer->GetWorldPoint();
+    if ( aWorldCoords[3] != 0.0 ) {
+      for (int i=0; i < 3; i++) {
+       thePickPosition[i] = aWorldCoords[i] / aWorldCoords[3];
+      }
+    }
+  }
+}
+
+vtkStandardNewMacro(SVTK_RectPicker);
+
+SVTK_RectPicker
+::SVTK_RectPicker()
+{
+  this->Tolerance = 0.005;
+  this->PickPoints = 1;
+}
+
+SVTK_RectPicker
+::~SVTK_RectPicker()
+{}
+
+int
+SVTK_RectPicker
+::Pick(vtkFloatingPointType, 
+       vtkFloatingPointType, 
+       vtkFloatingPointType, 
+       vtkRenderer*)
+{
+  return 0;
+}
+
+int
+SVTK_RectPicker
+::Pick(vtkFloatingPointType theSelection[3], 
+       vtkFloatingPointType theSelection2[3], 
+       vtkRenderer *theRenderer)
+{
+  return Pick(theSelection[0], theSelection[1], theSelection[2], 
+             theSelection2[0], theSelection2[1], theSelection2[2],
+             theRenderer);
+}
+
+int 
+SVTK_RectPicker
+::Pick(vtkFloatingPointType theSelectionX, 
+       vtkFloatingPointType theSelectionY, 
+       vtkFloatingPointType theSelectionZ, 
+       vtkFloatingPointType theSelectionX2, 
+       vtkFloatingPointType theSelectionY2, 
+       vtkFloatingPointType theSelectionZ2,
+       vtkRenderer *theRenderer)
+{
+  //  Initialize picking process
+  this->Initialize();
+  myCellIdsMap.clear();
+  myPointIdsMap.clear();
+  this->Renderer = theRenderer;
+
+  // Get camera focal point and position. Convert to display (screen) 
+  // coordinates. We need a depth value for z-buffer.
+  //
+  vtkCamera* aCamera = theRenderer->GetActiveCamera();
+
+  vtkFloatingPointType aCameraFP[4];
+  aCamera->GetFocalPoint(aCameraFP); 
+  aCameraFP[3] = 1.0;
+
+  theRenderer->SetWorldPoint(aCameraFP);
+  theRenderer->WorldToDisplay();
+  vtkFloatingPointType* aDisplayCoords = theRenderer->GetDisplayPoint();
+  vtkFloatingPointType aSelectionZ = aDisplayCoords[2];
+
+  this->SelectionPoint[0] = theSelectionX;
+  this->SelectionPoint[1] = theSelectionY;
+  this->SelectionPoint[2] = theSelectionZ;
+
+  // Convert the selection point into world coordinates.
+  //
+  CalculatePickPosition(theRenderer,
+                       theSelectionX,
+                       theSelectionY,
+                       aSelectionZ,
+                       this->PickPosition);
+
+  this->SelectionPoint2[0] = theSelectionX2;
+  this->SelectionPoint2[1] = theSelectionY2;
+  this->SelectionPoint2[2] = theSelectionZ2;
+
+  // Convert the selection point into world coordinates.
+  //
+  CalculatePickPosition(theRenderer,
+                       theSelectionX2,
+                       theSelectionY2,
+                       aSelectionZ,
+                       this->PickPosition2);
+
+  // Invoke start pick method if defined
+  this->InvokeEvent(vtkCommand::StartPickEvent,NULL);
+
+  vtkPropCollection *aProps;
+  if ( this->PickFromList ) 
+    aProps = this->GetPickList();
+  else 
+    aProps = theRenderer->GetProps();
+
+  aProps->InitTraversal();
+  while ( vtkProp* aProp = aProps->GetNextProp() ) {
+    aProp->InitPathTraversal();
+    while ( vtkAssemblyPath* aPath = aProp->GetNextPath() ) {
+      vtkMapper *aMapper = NULL;
+      bool anIsPickable = false;
+      vtkActor* anActor = NULL;
+      vtkProp *aPropCandidate = aPath->GetLastNode()->GetProp();
+      if ( aPropCandidate->GetPickable() && aPropCandidate->GetVisibility() ) {
+        anIsPickable = true;
+       anActor = vtkActor::SafeDownCast(aPropCandidate);
+       if ( anActor ) {
+          aMapper = anActor->GetMapper();
+          if ( anActor->GetProperty()->GetOpacity() <= 0.0 )
+           anIsPickable = false;
+       }
+      }
+      if ( anIsPickable  &&  aMapper && aMapper->GetInput()) {
+       int aSelectionPoint[4] = {int(theSelectionX),
+                                 int(theSelectionY),
+                                 int(theSelectionX2),
+                                 int(theSelectionY2)};
+       if ( this->PickPoints ) {
+         TVectorIds& aVisibleIds = myPointIdsMap[anActor];
+         TVectorIds anInVisibleIds;
+         SelectVisiblePoints(aSelectionPoint,
+                             theRenderer,
+                             aMapper->GetInput(),
+                             aVisibleIds,
+                             anInVisibleIds,
+                             this->Tolerance);
+         if ( aVisibleIds.empty() ) {
+           myPointIdsMap.erase(myPointIdsMap.find(anActor));
+         }
+       } else {
+         TVectorIds& aVectorIds = myCellIdsMap[anActor];
+         SelectVisibleCells(aSelectionPoint,
+                            theRenderer,
+                            aMapper->GetInput(),
+                            aVectorIds,
+                            this->Tolerance);
+         if ( aVectorIds.empty() ) {
+           myCellIdsMap.erase(myCellIdsMap.find(anActor));
+         }
+       }
+      }
+    }
+  }
+
+  // Invoke end pick method if defined
+  this->InvokeEvent(vtkCommand::EndPickEvent,NULL);
+
+  return myPointIdsMap.empty() || myCellIdsMap.empty();
+}
+
+
+const SVTK_RectPicker::TVectorIdsMap& 
+SVTK_RectPicker
+::GetPointIdsMap() const
+{
+  return myPointIdsMap;
+}
+
+const SVTK_RectPicker::TVectorIdsMap& 
+SVTK_RectPicker
+::GetCellIdsMap() const
+{
+  return myCellIdsMap;
+}
+
diff --git a/src/SVTK/SVTK_RectPicker.h b/src/SVTK/SVTK_RectPicker.h
new file mode 100644 (file)
index 0000000..3a6576e
--- /dev/null
@@ -0,0 +1,130 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_RectPicker.h
+//  Author : 
+//  Module : SALOME
+
+#ifndef __SVTK_RectPicker_h
+#define __SVTK_RectPicker_h
+
+#include "SVTK.h"
+#include "VTKViewer.h"
+
+#include <map>
+#include <vector>
+
+#include <vtkAbstractPropPicker.h>
+
+class vtkRenderer;
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+/*! \class vtkAbstractPropPicker
+ * \brief For more information see <a href="http://www.vtk.org/">VTK documentation
+ */
+/*! \class SVTK_RectPicker
+ * \brief Rectangular picker class.
+ */
+class SVTK_EXPORT SVTK_RectPicker : public vtkAbstractPropPicker
+{
+ public:
+  static
+  SVTK_RectPicker *New();
+
+  vtkTypeMacro(SVTK_RectPicker,vtkAbstractPropPicker);
+  
+  /*! 
+    Specify tolerance for performing pick operation. Tolerance is specified
+    as fraction of rendering window size. (Rendering window size is measured
+    across diagonal.)
+  */
+  vtkSetMacro(Tolerance,vtkFloatingPointType);
+  vtkGetMacro(Tolerance,vtkFloatingPointType);
+
+  //! Use these methods to pick points or points and cells
+  vtkSetMacro(PickPoints,int);
+  vtkGetMacro(PickPoints,int);
+  vtkBooleanMacro(PickPoints,int);
+
+  virtual 
+  int
+  Pick(vtkFloatingPointType theSelectionX, 
+       vtkFloatingPointType theSelectionY, 
+       vtkFloatingPointType theSelectionZ, 
+       vtkFloatingPointType theSelectionX2, 
+       vtkFloatingPointType theSelectionY2, 
+       vtkFloatingPointType theSelectionZ2,
+       vtkRenderer *theRenderer);  
+
+  int
+  Pick(vtkFloatingPointType theSelection[3], 
+       vtkFloatingPointType theSelection2[3], 
+       vtkRenderer *theRenderer);
+
+  typedef std::vector<vtkIdType> TVectorIds;
+  typedef std::map<vtkActor*,TVectorIds> TVectorIdsMap;
+
+  const TVectorIdsMap& 
+  GetPointIdsMap() const;
+
+  const TVectorIdsMap& 
+  GetCellIdsMap() const;
+
+ protected:
+  SVTK_RectPicker();
+  ~SVTK_RectPicker();
+
+  //! tolerance for computation (% of window)
+  vtkFloatingPointType Tolerance;
+
+  //! use the following to control picking mode
+  int PickPoints;
+
+  //! second rectangle selection point in window (pixel) coordinates
+  vtkFloatingPointType SelectionPoint2[3]; 
+
+  //! second rectangle selection point in world coordinates
+  vtkFloatingPointType PickPosition2[3]; 
+
+  TVectorIdsMap myPointIdsMap;
+  TVectorIdsMap myCellIdsMap;
+
+ private:
+  virtual 
+  int
+  Pick(vtkFloatingPointType, 
+       vtkFloatingPointType, 
+       vtkFloatingPointType, 
+       vtkRenderer*);
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
+
+
diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx
new file mode 100644 (file)
index 0000000..be0ea28
--- /dev/null
@@ -0,0 +1,792 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#include "SVTK_RenderWindowInteractor.h"
+//#include "SVTK_GenericRenderWindowInteractor.h"
+
+#include "SVTK_InteractorStyle.h"
+#include "SVTK_Renderer.h"
+#include "SVTK_Functor.h"
+#include "SALOME_Actor.h"
+
+// QT Includes
+// Put Qt includes before the X11 includes which #define the symbol None
+// (see SVTK_SpaceMouse.h) to avoid the compilation error.
+#include <QX11Info>
+#include <QMouseEvent>
+
+#include "SVTK_SpaceMouse.h" 
+#include "SVTK_Event.h" 
+
+#include "VTKViewer_Algorithm.h"
+
+// VTK Includes
+#include <vtkObjectFactory.h>
+#include <vtkRendererCollection.h>
+#include <vtkRenderWindow.h>
+#include <vtkGenericRenderWindowInteractor.h>
+#include <vtkCallbackCommand.h>
+#include <vtkCommand.h>
+#include <vtkPicker.h>
+#include <vtkCamera.h>
+
+using namespace std;
+
+static bool GENERATE_SUIT_EVENTS = false;
+static bool FOCUS_UNDER_MOUSE = false;
+
+
+/*!
+  Constructor
+*/
+QVTK_RenderWindowInteractor
+::QVTK_RenderWindowInteractor(QWidget* theParent, 
+                             const char* theName):
+  QWidget(theParent),
+  myRenderWindow(vtkRenderWindow::New())
+{
+  setAttribute( Qt::WA_PaintOnScreen );
+  //setAttribute( Qt::WA_NoSystemBackground );
+
+  setObjectName(theName);
+
+  setMouseTracking(true);
+
+  myRenderWindow->Delete();
+  myRenderWindow->DoubleBufferOn();
+
+#ifndef WIN32
+  myRenderWindow->SetDisplayId((void*)QX11Info::display());
+#endif
+  myRenderWindow->SetWindowId((void*)winId());
+}
+
+/*!
+  To initialize by vtkGenericRenderWindowInteractor instance
+*/
+void 
+QVTK_RenderWindowInteractor
+::Initialize(vtkGenericRenderWindowInteractor* theDevice)
+{
+  if ( GetDevice() )
+    myDevice->SetRenderWindow( NULL );
+
+  myDevice = theDevice;
+
+  if ( theDevice )
+    theDevice->SetRenderWindow( getRenderWindow() );
+}
+
+/*!
+  Destructor
+*/
+QVTK_RenderWindowInteractor
+::~QVTK_RenderWindowInteractor() 
+{
+#ifndef WIN32
+  SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance();
+  if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() )
+    aSpaceMouse->close( QX11Info::display() );
+#endif
+}
+
+
+/*!
+  \return corresponding render window interactor
+*/
+vtkGenericRenderWindowInteractor* 
+QVTK_RenderWindowInteractor
+::GetDevice()
+{
+  return myDevice.GetPointer();
+}
+
+/*!
+  \return corresponding render window
+*/
+vtkRenderWindow*
+QVTK_RenderWindowInteractor
+::getRenderWindow()
+{
+  return myRenderWindow.GetPointer();
+}
+
+/*!
+  Just to simplify usage of its device (vtkGenericRenderWindowInteractor)
+*/
+void
+QVTK_RenderWindowInteractor
+::InvokeEvent(unsigned long theEvent, void* theCallData)
+{
+  GetDevice()->InvokeEvent(theEvent,theCallData);
+}
+
+/*!
+  Need for initial contents display on Win32
+*/
+void
+QVTK_RenderWindowInteractor
+::show()
+{
+  QWidget::show();
+  update(); // needed for initial contents display on Win32
+}
+
+/*!
+  To implement final initialization, just before the widget is displayed
+*/
+void
+QVTK_RenderWindowInteractor
+::polish()
+{
+  // Final initialization just before the widget is displayed
+  GetDevice()->SetSize(width(),height());
+  if(!GetDevice()->GetInitialized() && GetDevice()->GetRenderWindow()){
+    GetDevice()->Initialize();
+    GetDevice()->ConfigureEvent();
+  }
+}
+
+/*!
+  To adjust widget and vtkRenderWindow size
+*/
+void
+QVTK_RenderWindowInteractor
+::resize(int w, int h) 
+{
+  GetDevice()->UpdateSize(w,h);
+}
+
+/*!
+  Custom paint event handler
+*/
+void
+QVTK_RenderWindowInteractor
+::paintEvent( QPaintEvent* theEvent ) 
+{
+  GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
+}
+
+
+/*!
+  Custom resize event handler
+*/
+void
+QVTK_RenderWindowInteractor
+::resizeEvent( QResizeEvent* theEvent )
+{
+  int* aSize = getRenderWindow()->GetSize();
+  int aWidth = aSize[0];
+  int aHeight = aSize[1];
+
+  GetDevice()->UpdateSize(width(),height());
+
+  if(isVisible() && aWidth && aHeight){
+    if( aWidth != width() || aHeight != height() ) {
+      vtkRendererCollection * aRenderers = getRenderWindow()->GetRenderers();
+      aRenderers->InitTraversal();
+      double aCoeff = 1.0;
+      if(vtkRenderer *aRenderer = aRenderers->GetNextItem()) {
+       vtkCamera *aCamera = aRenderer->GetActiveCamera();
+       double aScale = aCamera->GetParallelScale();
+       if((aWidth - width())*(aHeight - height()) > 0)
+         aCoeff = sqrt(double(aWidth)/double(width())*double(height())/double(aHeight));
+       else
+         aCoeff = double(aWidth)/double(width());
+       aCamera->SetParallelScale(aScale*aCoeff);
+      }
+    }
+  }
+
+  update(); 
+}
+
+
+
+/*!
+  Custom context menu event handler
+*/
+void
+QVTK_RenderWindowInteractor
+::contextMenuEvent( QContextMenuEvent* event )
+{}
+
+/*!
+  Custom mouse move event handler
+*/
+void
+QVTK_RenderWindowInteractor
+::mouseMoveEvent( QMouseEvent* event ) 
+{
+  GetDevice()->SetEventInformationFlipY(event->x(), 
+                                       event->y(),
+                                       event->modifiers() & Qt::ControlModifier,
+                                       event->modifiers() & Qt::ShiftModifier);
+  GetDevice()->MouseMoveEvent();
+}
+
+
+/*!
+  Custom mouse press event handler
+*/
+void
+QVTK_RenderWindowInteractor
+::mousePressEvent( QMouseEvent* event ) 
+{
+  GetDevice()->SetEventInformationFlipY(event->x(), 
+                                       event->y(),
+                                       event->modifiers() & Qt::ControlModifier,
+                                       event->modifiers() & Qt::ShiftModifier);
+  if( event->button() & Qt::LeftButton )
+    GetDevice()->LeftButtonPressEvent();
+  else if( event->button() & Qt::MidButton )
+    GetDevice()->MiddleButtonPressEvent();
+  else if( event->button() & Qt::RightButton )
+    GetDevice()->RightButtonPressEvent();
+}
+
+
+/*!
+  Custom mouse release event handler
+*/
+void
+QVTK_RenderWindowInteractor
+::mouseReleaseEvent( QMouseEvent *event )
+{
+  GetDevice()->SetEventInformationFlipY(event->x(), 
+                                       event->y(),
+                                       event->modifiers() & Qt::ControlModifier,
+                                       event->modifiers() & Qt::ShiftModifier);
+
+  if( event->button() & Qt::LeftButton )
+    GetDevice()->LeftButtonReleaseEvent();
+  else if( event->button() & Qt::MidButton )
+    GetDevice()->MiddleButtonReleaseEvent();
+  else if( event->button() & Qt::RightButton )
+    GetDevice()->RightButtonReleaseEvent();
+}
+
+
+/*!
+  Custom mouse double click event handler
+*/
+void
+QVTK_RenderWindowInteractor
+::mouseDoubleClickEvent( QMouseEvent* event )
+{}
+
+
+/*!
+  Custom mouse wheel event handler
+*/
+void
+QVTK_RenderWindowInteractor
+::wheelEvent( QWheelEvent* event )
+{
+  activateWindow();
+  setFocus();
+}
+
+
+/*!
+  Custom key press event handler
+*/
+void
+QVTK_RenderWindowInteractor
+::keyPressEvent( QKeyEvent* event ) 
+{
+  GetDevice()->SetKeyEventInformation(event->modifiers() & Qt::ControlModifier,
+                                     event->modifiers() & Qt::ShiftModifier,
+                                     event->key());
+  GetDevice()->KeyPressEvent();
+  GetDevice()->CharEvent();
+}
+
+/*!
+  Custom key release event handler
+*/
+void
+QVTK_RenderWindowInteractor
+::keyReleaseEvent( QKeyEvent * event ) 
+{
+  GetDevice()->SetKeyEventInformation(event->modifiers() & Qt::ControlModifier,
+                                     event->modifiers() & Qt::ShiftModifier,
+                                     event->key());
+  GetDevice()->KeyReleaseEvent();
+}
+
+
+/*!
+  Custom enter event handler
+*/
+void  
+QVTK_RenderWindowInteractor
+::enterEvent( QEvent* event )
+{
+  if(FOCUS_UNDER_MOUSE){
+    activateWindow();
+    setFocus();
+  }
+  GetDevice()->EnterEvent();
+}
+
+/*!
+  Custom leave event handler
+*/
+void  
+QVTK_RenderWindowInteractor
+::leaveEvent( QEvent * )
+{
+  GetDevice()->LeaveEvent();
+}
+
+/*!
+  Reimplemented from QWidget in order to set window - receiver
+  of space mouse events. 
+*/
+void  
+QVTK_RenderWindowInteractor
+::focusInEvent( QFocusEvent* event )
+{
+  QWidget::focusInEvent( event );
+
+#ifndef WIN32
+  // register set space mouse events receiver
+  SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance();
+
+  if ( aSpaceMouse )
+  {
+    if ( !aSpaceMouse->isSpaceMouseOn() )
+      // initialize 3D space mouse driver 
+      aSpaceMouse->initialize( QX11Info::display(), winId() );
+    else
+      aSpaceMouse->setWindow( QX11Info::display(), winId() );
+  }
+#endif
+}
+
+/*!
+  Reimplemented from QWidget in order to set window - receiver
+  of space mouse events. 
+*/
+void  
+QVTK_RenderWindowInteractor
+::focusOutEvent ( QFocusEvent* event )
+{
+  QWidget::focusOutEvent( event );
+
+#ifndef WIN32
+  // unregister set space mouse events receiver
+  SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance();
+  if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() )
+    aSpaceMouse->setWindow( QX11Info::display(), 0 );
+#endif
+}
+
+
+#ifdef WIN32
+
+/*!
+  To handle native Win32 events (from such devices as SpaceMouse)
+*/
+bool QVTK_RenderWindowInteractor::winEvent( MSG* msg )
+{
+  // TODO: Implement event handling for SpaceMouse
+  return QWidget::winEvent( msg );
+}
+
+#else
+
+/*!
+  To handle native X11 events (from such devices as SpaceMouse)
+*/
+bool 
+QVTK_RenderWindowInteractor
+::x11Event( XEvent *xEvent )
+{
+  // handle 3d space mouse events
+  if ( SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance() )
+  {
+    if ( aSpaceMouse->isSpaceMouseOn() && xEvent->type == ClientMessage )
+    {
+      SVTK_SpaceMouse::MoveEvent anEvent;
+      int type = aSpaceMouse->translateEvent( QX11Info::display(), xEvent, &anEvent, 1.0, 1.0 );
+      switch ( type )
+      {
+      case SVTK_SpaceMouse::SpaceMouseMove:
+             GetDevice()->InvokeEvent( SVTK::SpaceMouseMoveEvent, anEvent.data );
+             break;
+      case SVTK_SpaceMouse::SpaceButtonPress:
+             GetDevice()->InvokeEvent( SVTK::SpaceMouseButtonEvent, &anEvent.button );
+             break;
+      case SVTK_SpaceMouse::SpaceButtonRelease:
+             break;
+      }
+      return true; // stop handling the event
+    }
+  }
+
+  return QWidget::x11Event( xEvent );
+}
+
+#endif
+
+/*!
+  Constructor
+*/
+SVTK_RenderWindowInteractor
+::SVTK_RenderWindowInteractor(QWidget* theParent, 
+                              const char* theName):
+  QVTK_RenderWindowInteractor(theParent,theName),
+  myEventCallbackCommand(vtkCallbackCommand::New())
+{
+  myEventCallbackCommand->Delete();
+
+  myEventCallbackCommand->SetClientData(this); 
+  myPriority = 0.0;
+
+  myEventCallbackCommand->SetCallback(SVTK_RenderWindowInteractor::ProcessEvents);
+}
+
+/*!
+  To initialize properly the class
+*/
+void
+SVTK_RenderWindowInteractor
+::Initialize(vtkGenericRenderWindowInteractor* theDevice,
+            SVTK_Renderer* theRenderer,
+            SVTK_Selector* theSelector)
+{
+  QVTK_RenderWindowInteractor::Initialize(theDevice);
+  SetRenderer(theRenderer);
+  SetSelector(theSelector);
+}
+
+/*!
+  Destructor
+*/
+SVTK_RenderWindowInteractor
+::~SVTK_RenderWindowInteractor() 
+{
+  // Sequence of the destruction call are fixed and should be changed.
+  // vtkRenderWindow instance should be destroyed after all vtkRenderer's
+  GetDevice()->SetInteractorStyle(NULL); 
+  while(!myInteractorStyles.empty()){
+    const PInteractorStyle& aStyle = myInteractorStyles.top();
+    aStyle->SetInteractor(NULL);
+    myInteractorStyles.pop();
+  }
+
+  SetRenderer(NULL);
+
+  GetDevice()->SetRenderWindow(NULL);
+}
+
+/*!
+  To get corresponding SVTK_Renderer instance
+*/
+SVTK_Renderer* 
+SVTK_RenderWindowInteractor
+::GetRenderer()
+{
+  return myRenderer.GetPointer();
+}
+
+/*!
+  To get corresponding SVTK_Renderer device (just to simplify collobaration with SVTK_Renderer)
+*/
+vtkRenderer* 
+SVTK_RenderWindowInteractor
+::getRenderer()
+{
+  return GetRenderer()->GetDevice();
+}
+
+/*!
+  Changes renderer
+  \param theRenderer - new renderer
+*/
+void
+SVTK_RenderWindowInteractor
+::SetRenderer(SVTK_Renderer* theRenderer)
+{
+  if(theRenderer == myRenderer.GetPointer())
+    return;
+
+  if(GetRenderer())
+    myRenderWindow->RemoveRenderer(getRenderer());
+
+  myRenderer = theRenderer;
+
+  if(GetRenderer())
+    myRenderWindow->AddRenderer(getRenderer());
+}
+
+
+/*!
+  Changes interactor style
+  \param theStyle - new interactor style
+*/
+void
+SVTK_RenderWindowInteractor
+::InitInteractorStyle(vtkInteractorStyle* theStyle)
+{
+  GetDevice()->SetInteractorStyle(theStyle); 
+}
+
+/*!
+  To change current interactor style by pushing the new one into the container
+*/
+void
+SVTK_RenderWindowInteractor
+::PushInteractorStyle(vtkInteractorStyle* theStyle)
+{
+  myInteractorStyles.push(PInteractorStyle(theStyle));
+  InitInteractorStyle(theStyle);
+}
+
+/*!
+  To restore previous interactor style
+*/
+void
+SVTK_RenderWindowInteractor
+::PopInteractorStyle()
+{
+  if(GetInteractorStyle())
+    myInteractorStyles.pop();
+  
+  if(GetInteractorStyle()) 
+    InitInteractorStyle(GetInteractorStyle());
+}
+
+/*!
+  To get current interactor style
+*/
+vtkInteractorStyle* 
+SVTK_RenderWindowInteractor
+::GetInteractorStyle()
+{
+  return myInteractorStyles.empty() ? 0 : myInteractorStyles.top().GetPointer();
+}
+
+
+/*!
+  To get current selector
+*/
+SVTK_Selector* 
+SVTK_RenderWindowInteractor
+::GetSelector() 
+{ 
+  return mySelector.GetPointer(); 
+}
+
+
+/*!
+  Changes selector
+  \param theSelector - new selector
+*/
+void
+SVTK_RenderWindowInteractor
+::SetSelector(SVTK_Selector* theSelector)
+{ 
+  if(mySelector.GetPointer())
+    mySelector->RemoveObserver(myEventCallbackCommand.GetPointer());
+
+  mySelector = theSelector; 
+
+  if(mySelector.GetPointer())
+    mySelector->AddObserver(vtkCommand::EndPickEvent, 
+                           myEventCallbackCommand.GetPointer(), 
+                           myPriority);
+}
+
+/*!
+  Main process VTK event method
+*/
+void 
+SVTK_RenderWindowInteractor
+::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* vtkNotUsed(theCallData))
+{
+  SVTK_RenderWindowInteractor* self = reinterpret_cast<SVTK_RenderWindowInteractor*>(theClientData);
+
+  switch(theEvent){
+  case vtkCommand::EndPickEvent:
+    self->onEmitSelectionChanged();
+    break;
+  }
+}
+
+/*!
+  To change selection mode (just to simplify collobaration with SVTK_Selector)
+*/
+void
+SVTK_RenderWindowInteractor
+::SetSelectionMode(Selection_Mode theMode)
+{
+  mySelector->SetSelectionMode(theMode);
+}
+
+/*!
+  To get current selection mode (just to simplify collobaration with SVTK_Selector)
+*/
+Selection_Mode
+SVTK_RenderWindowInteractor
+::SelectionMode() const
+{
+  return mySelector->SelectionMode();
+}
+
+
+/*!
+  Emits signal selectionChanged()
+*/
+void
+SVTK_RenderWindowInteractor
+::onEmitSelectionChanged()
+{
+  return emit selectionChanged();
+}
+
+
+/*!
+  Custom mouse move event handler
+*/
+void
+SVTK_RenderWindowInteractor
+::mouseMoveEvent( QMouseEvent* event ) 
+{
+  QVTK_RenderWindowInteractor::mouseMoveEvent(event);
+
+  if(GENERATE_SUIT_EVENTS)
+    emit MouseMove( event );
+}
+
+
+/*!
+  Custom mouse press event handler
+*/
+void
+SVTK_RenderWindowInteractor
+::mousePressEvent( QMouseEvent* event ) 
+{
+  QVTK_RenderWindowInteractor::mousePressEvent(event);
+
+  if(GENERATE_SUIT_EVENTS)
+    emit MouseButtonPressed( event );
+}
+
+
+/*!
+  Custom mouse release event handler
+*/
+void
+SVTK_RenderWindowInteractor
+::mouseReleaseEvent( QMouseEvent *event )
+{
+  bool aRightBtn = event->button() == Qt::RightButton;
+  bool isOperation = false;
+  if( aRightBtn && GetInteractorStyle()) {
+    SVTK_InteractorStyle* style = dynamic_cast<SVTK_InteractorStyle*>( GetInteractorStyle() );
+    if ( style )
+      isOperation = style->CurrentState() != VTK_INTERACTOR_STYLE_CAMERA_NONE;
+  }
+
+  QVTK_RenderWindowInteractor::mouseReleaseEvent(event);
+
+  if ( aRightBtn && !isOperation && !( event->modifiers() & Qt::ControlModifier ) &&
+       !( event->modifiers() & Qt::ShiftModifier ) ) {
+    QContextMenuEvent aEvent( QContextMenuEvent::Mouse,
+                              event->pos(), event->globalPos() );
+    emit contextMenuRequested( &aEvent );
+  }
+  if(GENERATE_SUIT_EVENTS)
+    emit MouseButtonReleased( event );
+}
+
+
+/*!
+  Custom mouse double click event handler
+*/
+void
+SVTK_RenderWindowInteractor
+::mouseDoubleClickEvent( QMouseEvent* event )
+{
+  QVTK_RenderWindowInteractor::mouseDoubleClickEvent(event);
+
+  if(GENERATE_SUIT_EVENTS)
+    emit MouseDoubleClicked( event );
+}
+
+
+/*!
+  Custom mouse wheel event handler
+*/
+void
+SVTK_RenderWindowInteractor
+::wheelEvent( QWheelEvent* event )
+{
+  QVTK_RenderWindowInteractor::wheelEvent(event);
+
+  if(event->delta() > 0)
+    GetDevice()->InvokeEvent(SVTK::ZoomInEvent,NULL);
+  else
+    GetDevice()->InvokeEvent(SVTK::ZoomOutEvent,NULL);
+
+  if(GENERATE_SUIT_EVENTS)
+    emit WheelMoved( event );
+}
+
+/*!
+  Custom key press event handler
+*/
+void
+SVTK_RenderWindowInteractor
+::keyPressEvent( QKeyEvent* event ) 
+{
+  QVTK_RenderWindowInteractor::keyPressEvent(event);
+
+  if(GENERATE_SUIT_EVENTS)
+    emit KeyPressed( event );
+}
+
+/*!
+  Custom key release event handler
+*/
+void
+SVTK_RenderWindowInteractor
+::keyReleaseEvent( QKeyEvent * event ) 
+{
+  QVTK_RenderWindowInteractor::keyReleaseEvent(event);
+
+  if(GENERATE_SUIT_EVENTS)
+    emit KeyReleased( event );
+}
+
diff --git a/src/SVTK/SVTK_RenderWindowInteractor.h b/src/SVTK/SVTK_RenderWindowInteractor.h
new file mode 100644 (file)
index 0000000..51aa1ec
--- /dev/null
@@ -0,0 +1,263 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_RenderWindowInteractor_h
+#define SVTK_RenderWindowInteractor_h
+
+#include "SVTK.h"
+#include "SVTK_Selection.h"
+
+#include <vtkSmartPointer.h>
+#include <QWidget>
+
+// undefining min and max because CASCADE's defines them and
+// it clashes with std::min(), std::max()
+#undef min
+#undef max
+
+#include <stack>
+
+class vtkGenericRenderWindowInteractor;
+class vtkInteractorStyle;
+class vtkCallbackCommand;
+class vtkRenderWindow;
+class vtkRenderer;
+class vtkObject;
+
+class SVTK_Selector;
+class SVTK_Renderer;
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+/*!
+  \class QVTK_RenderWindowInteractor
+  Implements Qt based vtkRenderWindowInteractor.
+  The class inherits #QWidget class in order to be possible process Qt events.
+  It invokes corresponding VTK events through usage of its device - a #vtkGenericRenderWindowInteractor.
+  Also, it creates, initialize and holds vtkRenderWindow instance.
+*/
+class SVTK_EXPORT QVTK_RenderWindowInteractor: public QWidget
+{
+  Q_OBJECT;
+
+ public:
+  QVTK_RenderWindowInteractor(QWidget* theParent, 
+                             const char* theName);
+
+  ~QVTK_RenderWindowInteractor();
+
+  //! To initialize by #vtkGenericRenderWindowInteractor instance
+  virtual
+  void
+  Initialize(vtkGenericRenderWindowInteractor* theDevice);
+
+  vtkGenericRenderWindowInteractor* 
+  GetDevice();
+
+  vtkRenderWindow*
+  getRenderWindow();
+
+  //! Just to simplify usage of its device (#vtkGenericRenderWindowInteractor)
+  virtual
+  void
+  InvokeEvent(unsigned long theEvent, void* theCallData);
+
+ public slots:
+   //! Need for initial contents display on Win32
+  virtual void show();
+
+  //! To implement final initialization, just before the widget is displayed
+  virtual void polish();
+
+  //! To adjust widget and vtkRenderWindow size
+  virtual void resize(int w, int h);
+
+ protected:
+  virtual void paintEvent( QPaintEvent* );
+  virtual void resizeEvent( QResizeEvent* );
+
+  virtual void mouseMoveEvent( QMouseEvent* );
+  virtual void mousePressEvent( QMouseEvent* );
+  virtual void mouseReleaseEvent( QMouseEvent* );
+  virtual void mouseDoubleClickEvent( QMouseEvent* );
+  virtual void wheelEvent( QWheelEvent* );
+  virtual void keyPressEvent( QKeyEvent* );
+  virtual void keyReleaseEvent( QKeyEvent* );
+  virtual void enterEvent( QEvent * );
+  virtual void leaveEvent( QEvent * );
+
+  virtual void contextMenuEvent( QContextMenuEvent * e );
+
+  // reimplemented from QWidget in order to set window - receiver
+  // of space mouse events. 
+  virtual void focusInEvent( QFocusEvent* );
+  virtual void focusOutEvent( QFocusEvent* );
+
+  //! To handle native events (from such devices as SpaceMouse)
+#ifdef WIN32
+  virtual bool winEvent( MSG* );
+#else
+  virtual bool x11Event( XEvent *e );
+#endif
+
+  vtkSmartPointer<vtkRenderWindow> myRenderWindow;
+  vtkSmartPointer<vtkGenericRenderWindowInteractor> myDevice;
+};
+
+
+//! Extends QVTK_RenderWindowInteractor functionality.
+/*!
+  \class SVTK_RenderWindowInteractor
+  Implements such features as 
+  support of selection, 
+  run-time interactor style management,
+  one render window per one renderer collaboration and
+  SUIT_ViewWindow events invocation.
+*/
+class SVTK_EXPORT SVTK_RenderWindowInteractor: public QVTK_RenderWindowInteractor
+{
+  Q_OBJECT;
+
+ public:
+  SVTK_RenderWindowInteractor(QWidget* theParent, 
+                             const char* theName);
+
+  ~SVTK_RenderWindowInteractor();
+
+  //! To initialize properly the class
+  virtual
+  void
+  Initialize(vtkGenericRenderWindowInteractor* theDevice,
+            SVTK_Renderer* theRenderer,
+            SVTK_Selector* theSelector);
+
+  //----------------------------------------------------------------------------
+  //! To get corresponding SVTK_Renderer instance
+  SVTK_Renderer* 
+  GetRenderer();
+
+  //! To get corresponding SVTK_Renderer device (just to simplify collobaration with SVTK_Renderer)
+  vtkRenderer* 
+  getRenderer();
+
+  //----------------------------------------------------------------------------
+  //! To get current interactor style
+  vtkInteractorStyle* 
+  GetInteractorStyle();
+
+  //! To change current interactor style by pushing the new one into the container
+  void
+  PushInteractorStyle(vtkInteractorStyle* theStyle);
+
+  //! To restore previous interactor style
+  void
+  PopInteractorStyle();
+
+  //----------------------------------------------------------------------------
+  //! To get corresponding SVTK_Selector
+  SVTK_Selector* 
+  GetSelector();
+
+  //! To get current selection mode (just to simplify collobaration with SVTK_Selector)
+  Selection_Mode 
+  SelectionMode() const;
+
+  //! To change selection mode (just to simplify collobaration with SVTK_Selector)
+  void 
+  SetSelectionMode(Selection_Mode theMode);
+
+ public:
+  //! To transform vtkCommand::EndPickEvent to Qt selectionChanged signal
+  void
+  onEmitSelectionChanged();
+
+ public:
+ signals:
+  void MouseMove( QMouseEvent* );
+  void MouseButtonPressed( QMouseEvent* );
+  void MouseButtonReleased( QMouseEvent* );
+  void MouseDoubleClicked( QMouseEvent* );
+  void ButtonPressed(const QMouseEvent *event);
+  void ButtonReleased(const QMouseEvent *event);
+  void WheelMoved( QWheelEvent* );
+  void KeyPressed( QKeyEvent* );
+  void KeyReleased( QKeyEvent* );
+  void contextMenuRequested( QContextMenuEvent *e );
+
+  void selectionChanged();
+
+ protected:
+  virtual void mouseMoveEvent( QMouseEvent* );
+  virtual void mousePressEvent( QMouseEvent* );
+  virtual void mouseReleaseEvent( QMouseEvent* );
+  virtual void mouseDoubleClickEvent( QMouseEvent* );
+  virtual void wheelEvent( QWheelEvent* );
+  virtual void keyPressEvent( QKeyEvent* );
+  virtual void keyReleaseEvent( QKeyEvent* );
+
+  void
+  SetRenderer(SVTK_Renderer *theRenderer);
+
+  void
+  SetSelector(SVTK_Selector* theSelector);
+
+  void
+  InitInteractorStyle(vtkInteractorStyle* theStyle);
+
+  //----------------------------------------------------------------
+  // Main process VTK event method
+  static
+  void
+  ProcessEvents(vtkObject* theObject, 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* theCallData);
+
+  // Used to process VTK events
+  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+  // Priority at which events are processed
+  float myPriority;
+
+  //----------------------------------------------------------------
+  vtkSmartPointer<SVTK_Selector> mySelector;
+
+  vtkSmartPointer<SVTK_Renderer> myRenderer;
+
+  typedef vtkSmartPointer<vtkInteractorStyle> PInteractorStyle;
+  typedef std::stack<PInteractorStyle> TInteractorStyles;
+  TInteractorStyles myInteractorStyles;
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
diff --git a/src/SVTK/SVTK_Renderer.cxx b/src/SVTK/SVTK_Renderer.cxx
new file mode 100644 (file)
index 0000000..9dd784f
--- /dev/null
@@ -0,0 +1,751 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   :
+//  Author :
+//  Module :
+//  $Header$
+
+#include "SVTK_Renderer.h"
+
+#include "SVTK_Trihedron.h"
+#include "SVTK_CubeAxesActor2D.h"
+#include "SVTK_RectPicker.h"
+
+#include "SALOME_Actor.h"
+#include "VTKViewer_Actor.h"
+#include "VTKViewer_Transform.h"
+#include "VTKViewer_Utilities.h"
+
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkTextProperty.h>
+#include <vtkObjectFactory.h>
+#include <vtkCallbackCommand.h>
+
+#include <vtkPicker.h>
+#include <vtkPointPicker.h>
+#include <vtkCellPicker.h>
+
+#include <vtkProperty.h>
+
+// undefining min and max because CASCADE's defines them and
+// it clashes with std::min(), std::max() included in utilities.h
+#undef min
+#undef max
+
+
+vtkStandardNewMacro(SVTK_Renderer);
+
+/*!
+  Constructor
+*/
+SVTK_Renderer
+::SVTK_Renderer():
+  myDevice(vtkRenderer::New()),
+  myInteractor(NULL),
+  myPriority(0.0),
+  myEventCallbackCommand(vtkCallbackCommand::New()),
+  myPointPicker(vtkPointPicker::New()),
+  myCellPicker(vtkCellPicker::New()),
+  myPointRectPicker(SVTK_RectPicker::New()),
+  myCellRectPicker(SVTK_RectPicker::New()),
+  myPreHighlightProperty(vtkProperty::New()),
+  myHighlightProperty(vtkProperty::New()),
+  myTransform(VTKViewer_Transform::New()),
+  myCubeAxes(SVTK_CubeAxesActor2D::New()),
+  myTrihedron(SVTK_Trihedron::New()),
+  myTrihedronSize(105),
+  myIsTrihedronRelative(true)
+{
+  myDevice->Delete();
+  myTransform->Delete();
+
+  SetSelectionTolerance();
+
+  myPointPicker->Delete();
+  myCellPicker->Delete();
+
+  myPointRectPicker->Delete();
+  myPointRectPicker->PickFromListOn();
+
+  myCellRectPicker->Delete();
+  myCellRectPicker->PickFromListOn();
+  myCellRectPicker->PickPointsOff();
+
+  //SetPreselectionProp();
+  myPreHighlightProperty->Delete();
+  myPreHighlightProperty->SetColor(0,1,1);
+  myPreHighlightProperty->SetPointSize(SALOME_POINT_SIZE+2);
+  myPreHighlightProperty->SetLineWidth(SALOME_LINE_WIDTH+2);
+  myPreHighlightProperty->SetRepresentationToPoints();
+
+  //SetSelectionProp();
+  myHighlightProperty->Delete();
+  myHighlightProperty->SetColor(1,1,0);
+  myHighlightProperty->SetPointSize(SALOME_POINT_SIZE+2);
+  myHighlightProperty->SetLineWidth(SALOME_LINE_WIDTH+2);
+  myHighlightProperty->SetRepresentationToPoints();
+
+  myTrihedron->Delete();
+  myCubeAxes->Delete();
+  myEventCallbackCommand->Delete();
+
+  myTrihedron->AddToRender(GetDevice());
+  GetDevice()->AddViewProp(GetCubeAxes());
+
+  myBndBox[0] = myBndBox[2] = myBndBox[4] = 0;
+  myBndBox[1] = myBndBox[3] = myBndBox[5] = myTrihedron->GetSize();
+
+  myCubeAxes->SetBounds(myBndBox);
+  myCubeAxes->SetCamera(GetDevice()->GetActiveCamera());
+
+  myCubeAxes->SetLabelFormat("%6.4g");
+  myCubeAxes->SetFlyModeToOuterEdges(); // ENK remarks: it must bee
+  myCubeAxes->SetFontFactor(0.8);
+  myCubeAxes->SetCornerOffset(0);
+  myCubeAxes->SetScaling(0);
+  myCubeAxes->SetNumberOfLabels(5);
+  myCubeAxes->VisibilityOff();
+  myCubeAxes->SetTransform(GetTransform());
+
+  vtkTextProperty* aTextProp = vtkTextProperty::New();
+  aTextProp->SetColor(1, 1, 1);
+  aTextProp->ShadowOn();
+  myCubeAxes->SetAxisTitleTextProperty(aTextProp);
+  myCubeAxes->SetAxisLabelTextProperty(aTextProp);
+  aTextProp->Delete();
+
+  GetDevice()->GetActiveCamera()->ParallelProjectionOn();
+  GetDevice()->LightFollowCameraOn();
+  GetDevice()->TwoSidedLightingOn();
+
+  myEventCallbackCommand->SetClientData(this);
+  myEventCallbackCommand->SetCallback(SVTK_Renderer::ProcessEvents);
+  GetDevice()->AddObserver(vtkCommand::ConfigureEvent,
+                          myEventCallbackCommand.GetPointer(), 
+                          myPriority);
+  GetDevice()->AddObserver(vtkCommand::ResetCameraEvent,
+                          myEventCallbackCommand.GetPointer(), 
+                          myPriority);
+  GetDevice()->AddObserver(vtkCommand::ResetCameraClippingRangeEvent,
+                          myEventCallbackCommand.GetPointer(), 
+                          myPriority);
+}
+
+/*!
+  Destructor
+*/
+SVTK_Renderer
+::~SVTK_Renderer()
+{
+  vtkActorCollection* anActors = GetDevice()->GetActors();
+  vtkActorCollection* anActors2 = vtkActorCollection::New();
+
+  anActors->InitTraversal();
+  while(vtkActor* anAct = anActors->GetNextActor()){
+    if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct)){
+      anActors2->AddItem(anActor);
+    }
+  }
+
+  anActors2->InitTraversal();
+  while(vtkActor* anAct = anActors2->GetNextActor()){
+    if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct)){
+      RemoveActor(anActor);
+    }
+  }
+
+  anActors2->Delete();
+}
+
+
+/*!
+  Main process event method
+*/
+void 
+SVTK_Renderer
+::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* vtkNotUsed(theCallData))
+{
+  SVTK_Renderer* self = reinterpret_cast<SVTK_Renderer*>(theClientData);
+
+  switch(theEvent){
+  case vtkCommand::ConfigureEvent:
+    self->OnResetView();
+    break;
+  case vtkCommand::ResetCameraEvent:
+    self->OnFitAll();
+    break;
+  case vtkCommand::ResetCameraClippingRangeEvent:
+    self->OnResetClippingRange();
+    break;
+  }
+}
+
+/*!
+  \return renderer's device
+*/
+vtkRenderer* 
+SVTK_Renderer
+::GetDevice()
+{
+  return myDevice.GetPointer();
+}
+
+/*!
+  Initialize renderer
+*/
+void 
+SVTK_Renderer
+::Initialize(vtkRenderWindowInteractor* theInteractor,
+            SVTK_Selector* theSelector)
+{
+  myInteractor = theInteractor;
+  mySelector = theSelector;
+}
+
+/*!
+  Publishes pointed actor into the renderer
+*/
+void
+SVTK_Renderer
+::AddActor(VTKViewer_Actor* theActor)
+{
+  if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(theActor)){
+    anActor->SetInteractor(myInteractor);
+    anActor->SetTransform(GetTransform());
+    anActor->SetSelector(mySelector.GetPointer());
+
+    anActor->SetPointPicker(myPointPicker.GetPointer());
+    anActor->SetCellPicker(myCellPicker.GetPointer());
+
+    anActor->SetPointRectPicker(myPointRectPicker.GetPointer());
+    anActor->SetCellRectPicker(myCellRectPicker.GetPointer());
+
+    anActor->SetPreHighlightProperty(myPreHighlightProperty.GetPointer());
+    anActor->SetHighlightProperty(myHighlightProperty.GetPointer());
+
+    anActor->AddToRender(GetDevice());
+    AdjustActors();
+  }
+}
+
+/*!
+  Removes pointed actor from the renderer
+*/
+void
+SVTK_Renderer
+::RemoveActor(VTKViewer_Actor* theActor)
+{
+  if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(theActor)){
+    // Order of the calls are important because VTKViewer_Actor::RemoveFromRender
+    //   can leads do destruction of the actor
+    anActor->SetInteractor(NULL);
+    anActor->SetTransform(NULL);
+    anActor->SetSelector(NULL);
+
+    anActor->SetPointPicker(NULL);
+    anActor->SetCellPicker(NULL);
+
+    anActor->SetPointRectPicker(NULL);
+    anActor->SetCellRectPicker(NULL);
+
+    anActor->SetPreHighlightProperty(NULL);
+    anActor->SetHighlightProperty(NULL);
+
+    anActor->RemoveFromRender(GetDevice());
+    AdjustActors();
+  }
+}
+
+/*!
+  Get special container that keeps scaling of the scene
+*/
+VTKViewer_Transform* 
+SVTK_Renderer
+::GetTransform()
+{
+  return myTransform.GetPointer();
+}
+
+/*!
+  Allows to get a scale that is applied on the whole scene
+*/
+void
+SVTK_Renderer
+::GetScale( double theScale[3] ) 
+{
+  myTransform->GetMatrixScale( theScale );
+}
+
+/*!
+  Allows to apply a scale on the whole scene
+*/
+void
+SVTK_Renderer
+::SetScale( double theScale[3] ) 
+{
+  myTransform->SetMatrixScale( theScale[0], theScale[1], theScale[2] );
+  AdjustActors();
+}
+
+/*!
+  Applies color and size (PointSize and LineWidth) of primitives in selection mode
+*/
+void
+SVTK_Renderer
+::SetSelectionProp(const double& theRed, 
+                  const double& theGreen, 
+                  const double& theBlue, 
+                  const int& theWidth) 
+{
+  myHighlightProperty->SetColor( theRed, theGreen, theBlue );
+  myHighlightProperty->SetLineWidth( theWidth );
+  myHighlightProperty->SetPointSize( theWidth );
+}
+
+/*!
+  Applies color and size (PointSize and LineWidth) of primitives in preselection mode
+*/
+void
+SVTK_Renderer
+::SetPreselectionProp(const double& theRed, 
+                     const double& theGreen, 
+                     const double& theBlue, 
+                     const int& theWidth) 
+{
+  myPreHighlightProperty->SetColor( theRed, theGreen, theBlue );
+  myPreHighlightProperty->SetLineWidth( theWidth );
+  myPreHighlightProperty->SetPointSize( theWidth );
+}
+
+/*!
+  Setup requested tolerance for the picking
+*/
+void
+SVTK_Renderer
+::SetSelectionTolerance(const double& theTolNodes, 
+                       const double& theTolCell)
+{
+  myPointPicker->SetTolerance( theTolNodes );
+  myCellPicker->SetTolerance( theTolCell );
+
+  myPointRectPicker->SetTolerance( theTolNodes );
+  myCellRectPicker->SetTolerance( theTolCell );
+}
+
+
+/*! If parameter theIsForcedUpdate is true, recalculate parameters for
+ *  trihedron and cube axes, even if trihedron and cube axes is invisible.
+ */
+
+inline
+bool
+CheckBndBox(const vtkFloatingPointType theBounds[6])
+{
+  if(theBounds[0] > -VTK_LARGE_FLOAT && theBounds[1] < VTK_LARGE_FLOAT &&
+     theBounds[2] > -VTK_LARGE_FLOAT && theBounds[3] < VTK_LARGE_FLOAT &&
+     theBounds[4] > -VTK_LARGE_FLOAT && theBounds[5] < VTK_LARGE_FLOAT)
+    return true;
+  return false;
+}
+
+/*!
+  Adjusts size of actors
+*/
+bool
+SVTK_Renderer
+::OnAdjustActors()
+{
+  bool aTDisplayed = IsTrihedronDisplayed();
+  bool aCDisplayed = IsCubeAxesDisplayed();
+
+  vtkFloatingPointType aNewBndBox[6];
+  aNewBndBox[ 0 ] = aNewBndBox[ 2 ] = aNewBndBox[ 4 ] = VTK_LARGE_FLOAT;
+  aNewBndBox[ 1 ] = aNewBndBox[ 3 ] = aNewBndBox[ 5 ] = -VTK_LARGE_FLOAT;
+
+  int aVisibleNum = myTrihedron->GetVisibleActorCount(GetDevice());
+  if(aVisibleNum){
+    if(aTDisplayed)
+      myTrihedron->VisibilityOff();
+
+    if(aCDisplayed) 
+      myCubeAxes->VisibilityOff();
+
+    // if the new trihedron size have sufficient difference, then apply the value
+    vtkFloatingPointType aSize = myTrihedron->GetSize();
+    if ( IsTrihedronRelative() )
+      {
+       ComputeTrihedronSize(GetDevice(),aSize,aSize,myTrihedronSize);
+       myTrihedron->SetSize(aSize);
+      }
+    else
+      myTrihedron->SetSize( myTrihedronSize );
+
+    // iterate through displayed objects and set size if necessary
+    vtkActorCollection* anActors = GetDevice()->GetActors();
+    anActors->InitTraversal();
+    while(vtkActor* anAct = anActors->GetNextActor()){
+      if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct)){
+       if(anActor->IsResizable())
+         anActor->SetSize(0.5*aSize);
+        if(anActor->GetVisibility() && !anActor->IsInfinitive()){
+         vtkFloatingPointType *aBounds = anActor->GetBounds();
+          if(CheckBndBox(aBounds))
+           for(int i = 0; i < 5; i = i + 2){
+             if(aBounds[i] < aNewBndBox[i]) 
+               aNewBndBox[i] = aBounds[i];
+             if(aBounds[i+1] > aNewBndBox[i+1]) 
+               aNewBndBox[i+1] = aBounds[i+1];
+           }
+        }
+      }
+    }
+
+    if(aTDisplayed) 
+      myTrihedron->VisibilityOn();
+
+    if(aCDisplayed) 
+      myCubeAxes->VisibilityOn();
+    
+  }else{
+    double aSize = myTrihedron->GetSize();
+    aNewBndBox[0] = aNewBndBox[2] = aNewBndBox[4] = 0;
+    aNewBndBox[1] = aNewBndBox[3] = aNewBndBox[5] = aSize;
+  }
+  
+  if(CheckBndBox(aNewBndBox)){
+    for(int i = 0; i < 6; i++)
+      myBndBox[i] = aNewBndBox[i];
+    myCubeAxes->SetBounds(myBndBox);
+    return true;
+  }
+
+  return false;
+}
+
+/*!
+  Adjusts size of actors
+*/
+void
+SVTK_Renderer
+::AdjustActors()
+{
+  if(OnAdjustActors())
+    ::ResetCameraClippingRange(GetDevice());
+}
+
+/*!
+  Set size of the trihedron
+  \param theSize - new size
+  \param theRelative - if it is true, then size is mesured in percents from bounding box of the scene,
+  otherwise - in viewer units
+*/
+void
+SVTK_Renderer
+::SetTrihedronSize(vtkFloatingPointType theSize, const bool theRelative)
+{
+  if(myTrihedronSize != theSize || myIsTrihedronRelative != theRelative){
+    myTrihedronSize = theSize;
+    myIsTrihedronRelative = theRelative;
+    AdjustActors();
+  }
+}
+
+/*!
+  \return size of the trihedron in percents from bounding box of the scene
+*/
+vtkFloatingPointType
+SVTK_Renderer
+::GetTrihedronSize() const
+{
+  return myTrihedronSize;
+}
+
+/*!
+  \return true if the size of the trihedron is relative
+*/
+bool 
+SVTK_Renderer
+::IsTrihedronRelative() const
+{
+  return myIsTrihedronRelative;
+}
+
+/*!
+  \return trihedron control
+*/
+VTKViewer_Trihedron* 
+SVTK_Renderer
+::GetTrihedron()
+{
+  return myTrihedron.GetPointer();
+}
+
+/*!
+  \return true if trihedron is displayed
+*/
+bool
+SVTK_Renderer
+::IsTrihedronDisplayed()
+{
+  return myTrihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
+}
+
+/*!
+  Toggle trihedron visibility
+*/
+void 
+SVTK_Renderer
+::OnViewTrihedron()
+{
+  if(IsTrihedronDisplayed())
+    myTrihedron->VisibilityOff();
+  else
+    myTrihedron->VisibilityOn();
+}
+
+/*!
+  Adjust size of the trihedron to the bounding box of the scene
+*/
+void
+SVTK_Renderer
+::OnAdjustTrihedron()
+{   
+  AdjustActors();
+}
+
+/*!
+  \return graduated rules control
+*/
+SVTK_CubeAxesActor2D* 
+SVTK_Renderer
+::GetCubeAxes()
+{
+  return myCubeAxes.GetPointer();
+}
+
+/*!
+  \return true if graduated rules displayed
+*/
+bool
+SVTK_Renderer
+::IsCubeAxesDisplayed()
+{
+  return myCubeAxes->GetVisibility() == 1;
+}
+
+/*!
+  Toggle graduated rules visibility
+*/
+void
+SVTK_Renderer
+::OnViewCubeAxes()
+{
+  if(IsCubeAxesDisplayed())
+    myCubeAxes->VisibilityOff();
+  else
+    myCubeAxes->VisibilityOn();
+}
+
+/*!
+  Adjust size of the graduated rules to the bounding box of the scene
+*/
+void
+SVTK_Renderer
+::OnAdjustCubeAxes()
+{   
+  AdjustActors();
+}
+
+/*!
+  Sets camera into predefined state
+*/
+void
+SVTK_Renderer
+::OnResetView()
+{
+  int aTrihedronIsVisible = IsTrihedronDisplayed();
+  int aCubeAxesIsVisible = IsCubeAxesDisplayed();
+
+  myTrihedron->SetVisibility( VTKViewer_Trihedron::eOnlyLineOn );
+  myCubeAxes->SetVisibility(0);
+
+  ::ResetCamera(GetDevice(),true);  
+  vtkCamera* aCamera = GetDevice()->GetActiveCamera();
+  aCamera->SetPosition(1,-1,1);
+  aCamera->SetViewUp(0,0,1);
+  ::ResetCamera(GetDevice(),true);  
+
+  if(aTrihedronIsVisible) 
+    myTrihedron->VisibilityOn();
+  else
+    myTrihedron->VisibilityOff();
+
+  if(aCubeAxesIsVisible) 
+    myCubeAxes->VisibilityOn();
+  else
+    myCubeAxes->VisibilityOff();
+
+  static vtkFloatingPointType aCoeff = 3.0;
+  aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
+}
+
+/*!
+  Fit all presentation in the scene into the window
+*/
+void
+SVTK_Renderer
+::OnFitAll()
+{
+  int aTrihedronWasVisible = false;
+  int aCubeAxesWasVisible = false;
+
+  aTrihedronWasVisible = IsTrihedronDisplayed();
+  if(aTrihedronWasVisible)
+    myTrihedron->VisibilityOff();
+
+  aCubeAxesWasVisible = IsCubeAxesDisplayed();
+  if(aCubeAxesWasVisible)
+    myCubeAxes->VisibilityOff();
+
+  if(myTrihedron->GetVisibleActorCount(GetDevice())){
+    myTrihedron->VisibilityOff();
+    myCubeAxes->VisibilityOff();
+    ::ResetCamera(GetDevice());
+  }else{
+    myTrihedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn);
+    myCubeAxes->SetVisibility(2);
+    ::ResetCamera(GetDevice(),true);
+  }
+
+  if(aTrihedronWasVisible)
+    myTrihedron->VisibilityOn();
+  else
+    myTrihedron->VisibilityOff();
+  
+  if(aCubeAxesWasVisible)
+    myCubeAxes->VisibilityOn();
+  else
+    myCubeAxes->VisibilityOff();
+
+  ::ResetCameraClippingRange(GetDevice());
+}
+
+/*!
+  Reset camera clipping range to adjust the range to the bounding box of the scene
+*/
+void
+SVTK_Renderer
+::OnResetClippingRange()
+{
+  return;
+  ::ResetCameraClippingRange(GetDevice());
+}
+
+/*!
+  To reset direction of the camera to front view
+*/
+void
+SVTK_Renderer
+::OnFrontView()
+{
+  vtkCamera* aCamera = GetDevice()->GetActiveCamera();
+  aCamera->SetPosition(1,0,0);
+  aCamera->SetViewUp(0,0,1);
+  aCamera->SetFocalPoint(0,0,0);
+  this->OnFitAll();
+}
+
+/*!
+  To reset direction of the camera to back view
+*/
+void
+SVTK_Renderer
+::OnBackView()
+{
+  vtkCamera* aCamera = GetDevice()->GetActiveCamera();
+  aCamera->SetPosition(-1,0,0);
+  aCamera->SetViewUp(0,0,1);
+  aCamera->SetFocalPoint(0,0,0);
+  this->OnFitAll();
+}
+
+/*!
+  To reset direction of the camera to top view
+*/
+void
+SVTK_Renderer
+::OnTopView()
+{
+  vtkCamera* aCamera = GetDevice()->GetActiveCamera();
+  aCamera->SetPosition(0,0,1);
+  aCamera->SetViewUp(0,1,0);
+  aCamera->SetFocalPoint(0,0,0);
+  this->OnFitAll();
+}
+
+/*!
+  To reset direction of the camera to bottom view
+*/
+void
+SVTK_Renderer
+::OnBottomView()
+{
+  vtkCamera* aCamera = GetDevice()->GetActiveCamera();
+  aCamera->SetPosition(0,0,-1);
+  aCamera->SetViewUp(0,1,0);
+  aCamera->SetFocalPoint(0,0,0);
+  this->OnFitAll();
+}
+
+/*!
+  To reset direction of the camera to left view
+*/
+void
+SVTK_Renderer
+::OnLeftView()
+{
+  vtkCamera* aCamera = GetDevice()->GetActiveCamera(); 
+  aCamera->SetPosition(0,-1,0);
+  aCamera->SetViewUp(0,0,1);
+  aCamera->SetFocalPoint(0,0,0);
+  this->OnFitAll();
+}
+
+/*!
+  To reset direction of the camera to right view
+*/
+void
+SVTK_Renderer
+::OnRightView()
+{
+  vtkCamera* aCamera = GetDevice()->GetActiveCamera();
+  aCamera->SetPosition(0,1,0);
+  aCamera->SetViewUp(0,0,1);
+  aCamera->SetFocalPoint(0,0,0);
+  this->OnFitAll();
+}
diff --git a/src/SVTK/SVTK_Renderer.h b/src/SVTK/SVTK_Renderer.h
new file mode 100644 (file)
index 0000000..3e44d5f
--- /dev/null
@@ -0,0 +1,258 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_Renderer_h
+#define SVTK_Renderer_h
+
+#include "SVTK.h"
+#include "VTKViewer.h"
+
+#include <vtkObject.h>
+#include <vtkSmartPointer.h>
+
+class vtkRenderer;
+class vtkCallbackCommand;
+class vtkRenderWindowInteractor;
+
+class vtkPicker;
+class vtkPointPicker;
+class vtkCellPicker;
+class vtkProperty;
+
+class SVTK_RectPicker;
+
+class VTKViewer_Trihedron;
+class VTKViewer_Transform;
+class SVTK_CubeAxesActor2D;
+class VTKViewer_Actor;
+class SVTK_Selector;
+
+#ifdef WIN32
+#pragma warning ( disable:4251 )
+#endif
+
+/*! 
+  \class SVTK_Renderer
+  The class is a container for #vtkRenderer instance.
+  Main goal of the class is to apply common behaviour to all #SALOME_Actor, like
+  selection and preselection colors.
+  Also, the class is responsible for management of internal actors like trihedron an so on.
+ */
+class SVTK_EXPORT SVTK_Renderer : public vtkObject
+{
+ public:
+  vtkTypeMacro(SVTK_Renderer,vtkObject);
+  static SVTK_Renderer* New();
+
+  //----------------------------------------------------------------------------
+  //! Get its device
+  vtkRenderer* 
+  GetDevice();
+
+  //! Initialize the class
+  virtual
+  void 
+  Initialize(vtkRenderWindowInteractor* theInteractor,
+            SVTK_Selector* theSelector);
+
+  //----------------------------------------------------------------------------
+  //! Publishes pointed actor into the renderer
+  virtual
+  void 
+  AddActor(VTKViewer_Actor* theActor);
+
+  //! Removes pointed actor from the renderer
+  virtual
+  void 
+  RemoveActor(VTKViewer_Actor* theActor);
+
+  //! Get special container that keeps scaling of the scene 
+  VTKViewer_Transform* 
+  GetTransform();
+
+  //! Allows to apply a scale on the whole scene
+  virtual
+  void
+  SetScale( double theScale[3] );
+
+  //! Allows to get a scale that is applied on the whole scene
+  void
+  GetScale( double theScale[3] );
+
+  //----------------------------------------------------------------------------
+  //! Applies color and size (PointSize and LineWidth) of primitives in selection mode
+  void
+  SetSelectionProp(const double& theRed = 1, 
+                  const double& theGreen = 1,
+                  const double& theBlue = 0, 
+                  const int& theWidth = 5);
+
+  //! Applies color and size (PointSize and LineWidth) of primitives in preselection mode
+  void
+  SetPreselectionProp(const double& theRed = 0, 
+                     const double& theGreen = 1,
+                     const double& theBlue = 1, 
+                     const int& theWidth = 5);
+
+  //! Setup requested tolerance for the picking
+  void
+  SetSelectionTolerance(const double& theTolNodes = 0.025, 
+                       const double& theTolCell = 0.001);
+
+  //----------------------------------------------------------------------------
+  //! Adjust all intenal actors (trihedron and graduated rules) to the scene
+  void
+  AdjustActors();
+
+  //! Set size of the trihedron in percents from bounding box of the scene
+  void
+  SetTrihedronSize(vtkFloatingPointType theSize, const bool theRelative = true);
+  //! Get size of the trihedron in percents from bounding box of the scene
+  vtkFloatingPointType  
+  GetTrihedronSize() const;
+
+  //! Shows if the size of the trihedron is relative
+  bool  
+  IsTrihedronRelative() const;
+
+  //----------------------------------------------------------------------------
+  //! Get trihedron control
+  VTKViewer_Trihedron* 
+  GetTrihedron();
+
+  //! Is trihedron displayed
+  bool 
+  IsTrihedronDisplayed();
+
+  //! Toggle trihedron visibility
+  void 
+  OnViewTrihedron(); 
+
+  //! Adjust size of the trihedron to the bounding box of the scene
+  void 
+  OnAdjustTrihedron();
+
+  //----------------------------------------------------------------------------
+  //! Get graduated rules control
+  SVTK_CubeAxesActor2D* 
+  GetCubeAxes();
+
+  //! Is graduated rules displayed
+  bool 
+  IsCubeAxesDisplayed();
+
+  //! Toggle graduated rules visibility
+  void 
+  OnViewCubeAxes();
+
+  //! Adjust size of the graduated rules to the bounding box of the scene
+  void 
+  OnAdjustCubeAxes();
+
+  //----------------------------------------------------------------------------
+  //! Fit all presentation in the scene into the window
+  void OnFitAll(); 
+  
+  //! Set camera into predefined state
+  void OnResetView(); 
+
+  //! Reset camera clipping range to adjust the range to the bounding box of the scene
+  void OnResetClippingRange(); 
+
+  //! To reset direction of the camera to front view
+  void OnFrontView(); 
+
+  //! To reset direction of the camera to back view
+  void OnBackView(); 
+
+  //! To reset direction of the camera to top view
+  void OnTopView();
+
+  //! To reset direction of the camera to bottom view
+  void OnBottomView();
+
+  //! To reset direction of the camera to right view
+  void OnRightView(); 
+
+  //! To reset direction of the camera to left view
+  void OnLeftView();     
+
+ protected:
+  SVTK_Renderer();
+  ~SVTK_Renderer();
+
+  virtual
+  bool
+  OnAdjustActors();
+
+  //----------------------------------------------------------------------------
+  // Priority at which events are processed
+  vtkFloatingPointType myPriority;
+
+  // Used to process events
+  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+  // Description:
+  // Main process event method
+  static void ProcessEvents(vtkObject* object, 
+                            unsigned long event,
+                            void* clientdata, 
+                            void* calldata);
+  
+  vtkSmartPointer<vtkRenderer> myDevice;
+  vtkRenderWindowInteractor* myInteractor;
+  vtkSmartPointer<SVTK_Selector> mySelector;
+
+  //----------------------------------------------------------------------------
+  vtkSmartPointer<VTKViewer_Transform> myTransform;
+
+  //----------------------------------------------------------------------------
+  // Highlight/ Prehighlight devices
+  vtkSmartPointer<vtkPointPicker> myPointPicker;
+  vtkSmartPointer<vtkCellPicker> myCellPicker;
+
+  vtkSmartPointer<SVTK_RectPicker> myPointRectPicker;
+  vtkSmartPointer<SVTK_RectPicker> myCellRectPicker;
+
+  vtkSmartPointer<vtkProperty> myPreHighlightProperty;
+  vtkSmartPointer<vtkProperty> myHighlightProperty;
+
+  //----------------------------------------------------------------------------
+  vtkSmartPointer<SVTK_CubeAxesActor2D> myCubeAxes;
+  vtkSmartPointer<VTKViewer_Trihedron> myTrihedron;  
+  vtkFloatingPointType myTrihedronSize;
+  bool myIsTrihedronRelative;
+  vtkFloatingPointType myBndBox[6];
+};
+
+#ifdef WIN32
+#pragma warning ( default:4251 )
+#endif
+
+#endif
diff --git a/src/SVTK/SVTK_Selection.h b/src/SVTK/SVTK_Selection.h
new file mode 100644 (file)
index 0000000..4b0b4f5
--- /dev/null
@@ -0,0 +1,45 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_Selection.h
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_SELECTION_H
+#define SVTK_SELECTION_H
+
+
+//! It is possible to introduce new type of selection 
+typedef int Selection_Mode; 
+
+const Selection_Mode NodeSelection = 0;
+const Selection_Mode CellSelection = 1;
+const Selection_Mode EdgeOfCellSelection = 2;
+const Selection_Mode EdgeSelection = 3;
+const Selection_Mode FaceSelection = 4;
+const Selection_Mode VolumeSelection = 5;
+const Selection_Mode ActorSelection = 6;
+
+
+#endif
diff --git a/src/SVTK/SVTK_SelectionEvent.h b/src/SVTK/SVTK_SelectionEvent.h
new file mode 100644 (file)
index 0000000..75d0131
--- /dev/null
@@ -0,0 +1,55 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_SelectionEvent.h
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_SELECTIONEVENT_H
+#define SVTK_SELECTIONEVENT_H
+
+#include "SVTK_Selection.h"
+
+//! The structure is used for passing all infromation necessary for claculation of the selection.
+/*!
+  The SVTK_SelectionEvent is generated by #SVTK_InteractorStyle.
+  In its turn the #SVTK_InteractorStyle uses for it generation #vtkRenderWindowInteractor and
+  #SVTK_Selector instances.
+ */
+struct SVTK_SelectionEvent
+{
+  //! Through usage of the parameter any new type of selection can be introduced
+  Selection_Mode mySelectionMode; 
+  int myX; //!< Current X position of the mouse
+  int myY; //!< Current Y position of the mouse
+  int myLastX; //!< Last X position of the mouse before starting any complex operation (like rectangle selection)
+  int myLastY; //!< Last Y position of the mouse before starting any complex operation
+  bool myIsRectangle; //!< A flag to define is it necessary provide rectangle selection for current #Selection_Mode
+  bool myIsCtrl; //!< Is Ctrl key are pressed
+  bool myIsShift; //!< Is Shift key are pressed
+  int myKeyCode; //!< Code of the pressed key
+  int myRepeatCount; //!< Number of repetion of the key pressing
+};
+
+#endif
diff --git a/src/SVTK/SVTK_Selector.cxx b/src/SVTK/SVTK_Selector.cxx
new file mode 100644 (file)
index 0000000..86e9bc3
--- /dev/null
@@ -0,0 +1,519 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_Selection.cxx
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+
+#include "SVTK_SelectorDef.h"
+
+#include "VTKViewer_Filter.h"
+
+#include "SALOME_Actor.h"
+
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+#include <vtkCallbackCommand.h>
+
+/*!
+  \return new SVTK_Selector
+*/
+SVTK_Selector* 
+SVTK_Selector
+::New()
+{
+  return new SVTK_SelectorDef();
+}
+
+/*!
+  Default constructor
+*/
+SVTK_SelectorDef
+::SVTK_SelectorDef()
+{
+  mySelectionMode = ActorSelection;
+}
+
+/*!
+  Destructor
+*/
+SVTK_SelectorDef
+::~SVTK_SelectorDef()
+{
+}
+
+/*!
+  To invoke selectionChanged signals
+*/
+void 
+SVTK_SelectorDef
+::StartPickCallback()
+{
+  this->InvokeEvent(vtkCommand::StartPickEvent,NULL);
+}
+
+/*!
+  To invoke selectionChanged signals
+*/
+void 
+SVTK_SelectorDef
+::EndPickCallback()
+{
+  this->InvokeEvent(vtkCommand::EndPickEvent,NULL);
+}
+
+/*!
+  To change current Selection_Mode (as outside effect, it invokes selectionChange signal)
+*/
+void 
+SVTK_SelectorDef
+::SetSelectionMode(Selection_Mode theMode)
+{
+  if(mySelectionMode != theMode){
+    mySelectionMode = theMode;
+    myMapIOSubIndex.clear();
+    this->EndPickCallback();
+  }
+}
+
+/*!
+  Clear selection
+*/
+void 
+SVTK_SelectorDef
+::ClearIObjects() 
+{
+  myIO2Actors.clear();
+  myIObjects.clear();
+  myMapIOSubIndex.clear();
+}
+
+/*!
+  \return true if the SALOME_InteractiveObject presents into selection
+*/
+bool
+SVTK_SelectorDef
+::IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const
+{
+  return !theIO.IsNull() && (myIObjects.find(theIO) != myIObjects.end());
+}
+
+/*!
+  \return true if the SALOME_Actor presents into selection
+*/
+bool
+SVTK_SelectorDef
+::IsSelected(SALOME_Actor* theActor) const
+{
+  const Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
+  return IsSelected(anIO) && myIO2Actors.find(anIO) != myIO2Actors.end();
+}
+
+/*!
+  \return corresponding SALOME_Actor for SALOME_InteractiveObject
+  \param theIO - SALOME_InteractiveObject
+*/
+SALOME_Actor*
+SVTK_SelectorDef
+::GetActor(const Handle(SALOME_InteractiveObject)& theIO) const
+{
+  TIO2Actors::const_iterator anIter = myIO2Actors.find(theIO);
+  if(anIter != myIO2Actors.end())
+    return anIter->second.GetPointer();
+  return NULL;
+}
+
+/*!
+  Adds SALOME_InteractiveObject into selection
+  \param theIO - SALOME_InteractiveObject
+*/
+bool 
+SVTK_SelectorDef
+::AddIObject(const Handle(SALOME_InteractiveObject)& theIO) 
+{
+  if(!IsSelected(theIO)){
+    myIObjects.insert(theIO);
+    return true;
+  }
+  return false;
+}
+
+/*!
+  Adds SALOME_Actor into selection
+  \param theActor - SALOME_Actor
+*/
+bool 
+SVTK_SelectorDef
+::AddIObject(SALOME_Actor* theActor) 
+{
+  const Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
+
+  bool anIsIOBound = IsSelected(anIO);
+  if(!anIsIOBound)
+    myIObjects.insert(anIO);
+
+  bool anIsActorBound = myIO2Actors.find(anIO) != myIO2Actors.end();
+  if(!anIsActorBound)
+    myIO2Actors[anIO] = theActor;
+  
+  return !anIsIOBound || !anIsActorBound;
+}
+
+/*!
+  Removes SALOME_InteractiveObject from selection
+  \param theIO - SALOME_InteractiveObject
+*/
+bool 
+SVTK_SelectorDef
+::RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO) 
+{
+  bool anIsIOBound = myIObjects.find(theIO) != myIObjects.end();
+
+  myIObjects.erase(theIO);
+  myIO2Actors.erase(theIO);
+  myMapIOSubIndex.erase(theIO);
+
+  return anIsIOBound;
+}
+
+/*!
+  Removes SALOME_Actor from selection
+  \param theActor - SALOME_Actor
+*/
+bool 
+SVTK_SelectorDef
+::RemoveIObject(SALOME_Actor* theActor) 
+{
+  const Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
+
+  bool anIsActorBound = myIO2Actors.find(anIO) != myIO2Actors.end();
+  if(anIsActorBound)
+    myIO2Actors.erase(anIO);
+
+  return RemoveIObject(anIO) || anIsActorBound;
+}
+
+/*!
+  \return list of all SALOME_InteractiveObject presenting in selection
+*/
+const SALOME_ListIO& 
+SVTK_SelectorDef
+::StoredIObjects() const
+{
+  myIObjectList.Clear();
+  TIObjects::const_iterator anIter = myIObjects.begin();
+  TIObjects::const_iterator anIterEnd = myIObjects.end();
+  for(; anIter != anIterEnd; anIter++)
+    myIObjectList.Append(*anIter);
+
+  return myIObjectList;
+}
+
+/*!
+  \return number of selected objects
+*/
+int
+SVTK_SelectorDef
+::IObjectCount() const
+{
+  return myIObjects.size();
+}
+
+/*!
+  \return true if the SALOME_InteractiveObject has a subselection
+  \param theIO - SALOME_InteractiveObject
+*/
+bool 
+SVTK_SelectorDef
+::HasIndex( const Handle(SALOME_InteractiveObject)& theIO) const
+{
+  return myMapIOSubIndex.find(theIO) != myMapIOSubIndex.end();
+}
+
+/*!
+  Gets indices of subselection for SALOME_InteractiveObject
+  \param theIO - SALOME_InteractiveObject
+*/
+void 
+SVTK_SelectorDef
+::GetIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+           TColStd_IndexedMapOfInteger& theIndex)
+{
+  TMapIOSubIndex::const_iterator anIter = myMapIOSubIndex.find(theIO);
+  if(anIter != myMapIOSubIndex.end())
+    theIndex = anIter->second.myMap;
+  else
+    theIndex.Clear();
+}
+
+/*!
+  \return true if the index presents in subselection 
+  \param theIO - SALOME_InteractiveObject
+  \param theIndex - index
+*/
+bool
+SVTK_SelectorDef
+::IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO, 
+                 int theIndex) const
+{
+  TMapIOSubIndex::const_iterator anIter = myMapIOSubIndex.find(theIO);
+  if(anIter != myMapIOSubIndex.end()){
+    const TColStd_IndexedMapOfInteger& aMapIndex = anIter->second.myMap;
+    return aMapIndex.Contains( theIndex ) == Standard_True;
+  }
+
+  return false;
+}
+
+static bool removeIndex(TColStd_IndexedMapOfInteger& theMapIndex, const int theIndex)
+{
+  int anId = theMapIndex.FindIndex(theIndex); // i==0 if Index is not in the MapIndex
+  if(anId){
+    // only the last key can be removed
+    int aLastId = theMapIndex.FindKey(theMapIndex.Extent());
+    if(aLastId == anId)
+      theMapIndex.RemoveLast();
+    else{
+      TColStd_IndexedMapOfInteger aNewMap;
+      aNewMap.ReSize(theMapIndex.Extent()-1);
+      for(int j = 1; j <= theMapIndex.Extent(); j++){
+        int anIndex = theMapIndex(j);
+        if ( anIndex != theIndex )
+          aNewMap.Add( anIndex );
+      }
+      theMapIndex = aNewMap;
+    }
+  }
+  return anId != 0;
+}
+
+/*!
+  Changes indices of subselection for SALOME_InteractiveObject
+  \param theIO - SALOME_InteractiveObject
+  \param theIndices - indices
+  \param theIsModeShift - if it is false, then map will be cleared before indices are added
+*/
+bool
+SVTK_SelectorDef
+::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                   const TColStd_IndexedMapOfInteger& theIndices, 
+                   bool theIsModeShift)
+{
+  TMapIOSubIndex::iterator aMapIter = myMapIOSubIndex.find(theIO);
+  if(aMapIter == myMapIOSubIndex.end()){
+    TIndexedMapOfInteger anEmpty;
+    aMapIter = myMapIOSubIndex.
+      insert(TMapIOSubIndex::value_type(theIO,anEmpty)).first;
+  }
+  TColStd_IndexedMapOfInteger& aMapIndex = aMapIter->second.myMap;
+
+  if(!theIsModeShift)
+    aMapIndex.Clear();
+  
+  for(int i = 1, iEnd = theIndices.Extent(); i <= iEnd; i++)
+    aMapIndex.Add(theIndices(i));
+  
+  if(aMapIndex.IsEmpty()) {
+    myMapIOSubIndex.erase(theIO);
+    return false;
+  }
+
+  return true;
+}
+
+
+/*!
+  Changes indices of subselection for SALOME_InteractiveObject
+  \param theIO - SALOME_InteractiveObject
+  \param theIndices - indices
+  \param theIsModeShift - if it is false, then map will be cleared before indices are added
+*/
+bool
+SVTK_SelectorDef
+::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                   const TColStd_MapOfInteger& theIndices, 
+                   bool theIsModeShift)
+{
+  TMapIOSubIndex::iterator aMapIter = myMapIOSubIndex.find(theIO);
+  if(aMapIter == myMapIOSubIndex.end()){
+    TIndexedMapOfInteger anEmpty;
+    aMapIter = myMapIOSubIndex.
+      insert(TMapIOSubIndex::value_type(theIO,anEmpty)).first;
+  }
+  TColStd_IndexedMapOfInteger& aMapIndex = aMapIter->second.myMap;
+
+  if(!theIsModeShift)
+    aMapIndex.Clear();
+  
+  TColStd_MapIteratorOfMapOfInteger anIter(theIndices);
+  for(; anIter.More(); anIter.Next())
+    aMapIndex.Add(anIter.Key());
+  
+  if(aMapIndex.IsEmpty()) {
+    myMapIOSubIndex.erase(theIO);
+    return false;
+  }
+
+  return true;
+}
+
+
+/*!
+  Changes indices of subselection for SALOME_InteractiveObject
+  \param theIO - SALOME_InteractiveObject
+  \param theIndex - index
+  \param theIsModeShift - if it is false, then map will be cleared before indices are added
+*/
+bool 
+SVTK_SelectorDef
+::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                   int theIndex, 
+                   bool theIsModeShift)
+{
+  TMapIOSubIndex::iterator anIter = myMapIOSubIndex.find(theIO);
+  if(anIter == myMapIOSubIndex.end()){
+    TIndexedMapOfInteger anEmpty;
+    anIter = myMapIOSubIndex.
+      insert(TMapIOSubIndex::value_type(theIO,anEmpty)).first;
+  }
+  TColStd_IndexedMapOfInteger& aMapIndex = anIter->second.myMap;
+
+  bool anIsConatains = aMapIndex.Contains( theIndex ) == Standard_True;
+  if ( anIsConatains )
+    removeIndex( aMapIndex, theIndex );
+  
+  if ( !theIsModeShift )
+    aMapIndex.Clear();
+  
+  if ( !anIsConatains )
+    aMapIndex.Add( theIndex );
+
+  if ( aMapIndex.IsEmpty() )
+    myMapIOSubIndex.erase( theIO );
+
+  return false;
+}
+
+
+/*!
+  Removes index of subselection for SALOME_InteractiveObject
+  \param theIO - SALOME_InteractiveObject
+  \param theIndex - index
+*/
+void
+SVTK_SelectorDef
+::RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+              int theIndex)
+{
+  if(IsIndexSelected(theIO,theIndex)){
+    TMapIOSubIndex::iterator anIter = myMapIOSubIndex.find(theIO);
+    TColStd_IndexedMapOfInteger& aMapIndex = anIter->second.myMap;
+    removeIndex(aMapIndex,theIndex);
+  }
+}
+
+/*!
+  Clears all indices of subselection
+*/
+void 
+SVTK_SelectorDef
+::ClearIndex()
+{
+  myMapIOSubIndex.clear();  
+}
+
+/*!
+  To apply a filter on the selection
+  \param theFilter - new filter
+*/
+void
+SVTK_SelectorDef
+::SetFilter(const Handle(VTKViewer_Filter)& theFilter)
+{
+  myFilters.insert(TFilters::value_type(theFilter->GetId(),theFilter));
+}
+
+/*!
+  \return true if filter with given number is applyed
+  \param theId - filter id
+*/
+bool
+SVTK_SelectorDef
+::IsFilterPresent(const TFilterID theId) const
+{
+  return myFilters.find(theId) != myFilters.end();
+}
+
+/*!
+  To remove a filter from the selection
+  \param theId - filter id
+*/
+void  
+SVTK_SelectorDef
+::RemoveFilter(const TFilterID theId)
+{
+  if(IsFilterPresent(theId))
+    myFilters.erase(theId);
+}
+
+/*!
+  \return true if the index satisfy installed filters
+  \param theActor - actor
+  \param theId - filter id
+  \param theIsNode - whether it is node
+*/
+bool
+SVTK_SelectorDef
+::IsValid(SALOME_Actor* theActor,
+         const TFilterID theId,
+         const bool theIsNode) const
+{
+  TFilters::const_iterator anIter = myFilters.begin();
+  for(; anIter != myFilters.end(); ++anIter){
+    const Handle(VTKViewer_Filter)& aFilter = anIter->second;
+    if(theIsNode == aFilter->IsNodeFilter() &&
+       !aFilter->IsValid(theActor,theId))
+      return false;
+  }
+  return true;
+}
+
+/*!
+  \return filter by it's id
+  \param theId - filter id
+*/
+Handle(VTKViewer_Filter) 
+SVTK_SelectorDef
+::GetFilter(const TFilterID theId) const
+{
+  TFilters::const_iterator anIter = myFilters.find(theId);
+  if(anIter != myFilters.end()){
+    const Handle(VTKViewer_Filter)& aFilter = anIter->second;
+    return aFilter;
+  }
+  return Handle(VTKViewer_Filter)();
+}
+
diff --git a/src/SVTK/SVTK_Selector.h b/src/SVTK/SVTK_Selector.h
new file mode 100644 (file)
index 0000000..17ab9be
--- /dev/null
@@ -0,0 +1,212 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_Selection.h
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_SELECTOR_H
+#define SVTK_SELECTOR_H
+
+#include "SVTK.h"
+#include "SVTK_Selection.h"
+#include "SALOME_ListIO.hxx"
+
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+#include <vtkObject.h>
+
+class Handle(VTKViewer_Filter);
+
+class SALOME_Actor;
+class Handle(SALOME_InteractiveObject);
+
+//! Define an abstract interface for selection in SVTK package
+/*!
+  The class implements selection functionality through storing corresponding
+  references to #SALOME_InteractiveObject. For implementation of subselection
+  modes it keeps a corresponding map of sub indexes.
+  \note
+  Also, for each #SALOME_InteractiveObject it tries to keep corresponding refenrence to #SALOME_Actor
+ */
+class SVTK_EXPORT SVTK_Selector: public vtkObject
+{
+public:
+  static SVTK_Selector* New();
+  
+  vtkTypeMacro(SVTK_Selector,vtkObject);
+
+  //! To change current Selection_Mode (as outside effect, it invokes selectionChange signal)
+  virtual
+  void 
+  SetSelectionMode(Selection_Mode theMode) = 0;
+
+  //! Get current Selection_Mode
+  virtual
+  Selection_Mode
+  SelectionMode() const = 0;
+
+  //! Clear selection
+  virtual
+  void
+  ClearIObjects() = 0;
+
+  //! Try to find corresponding #SALOME_Actor for given reference on #SALOME_InteractiveObject
+  virtual
+  SALOME_Actor* 
+  GetActor(const Handle(SALOME_InteractiveObject)& theIO) const = 0;
+
+  //! Check, is the #SALOME_InteractiveObject is present into selection
+  virtual
+  bool
+  IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const = 0;
+
+  //! Check, is the #SALOME_Actor is present into selection
+  virtual
+  bool
+  IsSelected(SALOME_Actor* theActor) const = 0;
+
+  //! Modify the selection by adding new reference on #SALOME_InteractiveObject
+  virtual
+  bool
+  AddIObject(const Handle(SALOME_InteractiveObject)& theIO) = 0;
+
+  //! Modify the selection by adding new reference on #SALOME_Actor
+  virtual
+  bool
+  AddIObject(SALOME_Actor* theActor) = 0;
+
+  //! Modify the selection by removing a reference on #SALOME_InteractiveObject
+  virtual
+  bool 
+  RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO) = 0;
+
+  //! Modify the selection by removing a reference on #SALOME_Actor
+  virtual
+  bool 
+  RemoveIObject(SALOME_Actor* theActor) = 0;
+
+  //! Get all #SALOME_InteractiveObject references that is present into selection
+  virtual
+  const SALOME_ListIO& 
+  StoredIObjects() const = 0;
+
+  //! Get number of selected objects
+  virtual
+  int 
+  IObjectCount() const = 0;
+
+  //! Check, if the #SALOME_InteractiveObject has a subselection
+  virtual
+  bool 
+  HasIndex(const Handle(SALOME_InteractiveObject)& theIO ) const = 0;
+
+  //! Get indexes of subslection for given #SALOME_InteractiveObject
+  virtual
+  void 
+  GetIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+           TColStd_IndexedMapOfInteger& theIndex ) = 0;
+       
+  //! Change indices of subselection for given #SALOME_InteractiveObject
+  virtual
+  bool 
+  AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                   const TColStd_IndexedMapOfInteger& theIndices, 
+                   bool theIsModeShift) = 0;
+
+  //! Change indexes of subslection for given #SALOME_InteractiveObject
+  virtual
+  bool 
+  AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                   const TColStd_MapOfInteger& theIndices, 
+                   bool theIsModeShift) = 0;
+
+  //! Change index of subslection for given #SALOME_InteractiveObject
+  virtual
+  bool
+  AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                   int theIndex, 
+                   bool theIsModeShift) = 0;
+
+  //! Change index of subslection for given #SALOME_InteractiveObject
+  virtual
+  void 
+  RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+              int theIndex) = 0;
+
+  //! Check, if the given index is present in subselection 
+  virtual
+  bool 
+  IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO, 
+                 int theIndex) const = 0;
+
+  //! Clear subselection
+  virtual
+  void 
+  ClearIndex() = 0;
+
+  //----------------------------------------------------------------------------
+  typedef int TFilterID;
+
+  //! To apply a filter on the selection
+  virtual
+  void 
+  SetFilter(const Handle(VTKViewer_Filter)& theFilter) = 0;
+
+  //! To get a section filter by its number
+  virtual
+  Handle(VTKViewer_Filter) 
+  GetFilter(const TFilterID theId) const = 0;
+
+  //! Check, if a filter with given number is applyed
+  virtual
+  bool
+  IsFilterPresent(const TFilterID theId) const = 0;
+
+  //! To remove a filter from the selection
+  virtual
+  void
+  RemoveFilter(const TFilterID theId) = 0;
+
+  //! Check, if the index satisfy to the installed filters
+  virtual
+  bool
+  IsValid(SALOME_Actor* theActor,
+         const int theId,
+         const bool theIsNode = false) const = 0;
+  
+  //----------------------------------------------------------------------------
+  virtual
+  void 
+  StartPickCallback() = 0;
+
+  //! To invoke selectionChanged signals
+  virtual
+  void 
+  EndPickCallback() = 0;
+};
+
+
+#endif
diff --git a/src/SVTK/SVTK_SelectorDef.h b/src/SVTK/SVTK_SelectorDef.h
new file mode 100644 (file)
index 0000000..6515a18
--- /dev/null
@@ -0,0 +1,213 @@
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SALOME_Selection.h
+//  Author : Nicolas REJNERI
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_SELECTORDEF_H
+#define SVTK_SELECTORDEF_H
+
+#include <set>
+#include <map>
+
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <vtkSmartPointer.h>
+
+#include "SALOME_InteractiveObject.hxx"
+
+#include "SVTK_Selector.h"
+
+class SALOME_Actor;
+
+class SVTK_Viewer;
+class SVTK_ViewWindow;
+
+class SVTK_SelectorDef: public SVTK_Selector
+{
+public:
+  SVTK_SelectorDef();
+  virtual ~SVTK_SelectorDef();
+
+  virtual
+  void 
+  SetSelectionMode(Selection_Mode theMode);
+
+  virtual
+  Selection_Mode
+  SelectionMode() const { return mySelectionMode; }
+
+  virtual
+  void
+  ClearIObjects();
+
+  virtual
+  SALOME_Actor* 
+  GetActor(const Handle(SALOME_InteractiveObject)& theIO) const;
+
+  virtual
+  bool
+  IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const;
+
+  virtual
+  bool
+  IsSelected(SALOME_Actor* theActor) const;
+
+  virtual
+  bool
+  AddIObject(const Handle(SALOME_InteractiveObject)& theIO);
+
+  virtual
+  bool
+  AddIObject(SALOME_Actor* theActor);
+
+  virtual
+  bool 
+  RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO);
+
+  virtual
+  bool 
+  RemoveIObject(SALOME_Actor* theActor);
+
+  virtual
+  const SALOME_ListIO& 
+  StoredIObjects() const;
+
+  virtual
+  int 
+  IObjectCount() const;
+
+  virtual
+  bool 
+  HasIndex(const Handle(SALOME_InteractiveObject)& theIO ) const;
+
+  virtual
+  void 
+  GetIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+           TColStd_IndexedMapOfInteger& theIndex );
+       
+  virtual
+  bool 
+  AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                   const TColStd_IndexedMapOfInteger& theIndices, 
+                   bool theIsModeShift);
+  virtual
+  bool 
+  AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                   const TColStd_MapOfInteger& theIndices, 
+                   bool theIsModeShift);
+  virtual
+  bool
+  AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                   int theIndex, 
+                   bool theIsModeShift);
+  virtual
+  void 
+  RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+              int theIndex);
+  virtual
+  bool 
+  IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO, 
+                 int theIndex) const;
+  virtual
+  void 
+  ClearIndex();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void 
+  SetFilter(const Handle(VTKViewer_Filter)& theFilter);
+
+  virtual
+  Handle(VTKViewer_Filter) 
+  GetFilter(const TFilterID theId) const;
+
+  virtual
+  bool
+  IsFilterPresent(const TFilterID theId) const;
+
+  virtual
+  void
+  RemoveFilter(const int theId);
+
+  virtual
+  bool
+  IsValid(SALOME_Actor* theActor,
+         const TFilterID theId,
+         const bool theIsNode = false) const;
+  
+  //----------------------------------------------------------------------------
+  virtual
+  void 
+  StartPickCallback();
+
+  virtual
+  void 
+  EndPickCallback();
+
+private:
+  int mySelectionMode;
+
+  struct TIOLessThan
+  {
+    bool 
+    operator()(const Handle(SALOME_InteractiveObject)& theRightIO,
+              const Handle(SALOME_InteractiveObject)& theLeftIO) const
+    {
+      return strcmp(theRightIO->getEntry(),theLeftIO->getEntry()) < 0;
+    }
+  };
+
+  struct TIndexedMapOfInteger
+  {
+    TColStd_IndexedMapOfInteger myMap;
+    TIndexedMapOfInteger()
+    {}
+    TIndexedMapOfInteger(const TIndexedMapOfInteger& theIndexedMapOfInteger)
+    {
+      myMap = theIndexedMapOfInteger.myMap;
+    }
+  };
+
+  mutable SALOME_ListIO myIObjectList;
+  typedef std::set<Handle(SALOME_InteractiveObject),
+                   TIOLessThan> TIObjects;
+  TIObjects myIObjects;
+
+  typedef std::map<Handle(SALOME_InteractiveObject),
+                   vtkSmartPointer<SALOME_Actor>,
+                   TIOLessThan> TIO2Actors;
+  TIO2Actors myIO2Actors;
+
+  typedef std::map<Handle(SALOME_InteractiveObject),
+                   TIndexedMapOfInteger,
+                   TIOLessThan> TMapIOSubIndex;
+  TMapIOSubIndex myMapIOSubIndex;
+
+  typedef std::map<TFilterID,Handle(VTKViewer_Filter)> TFilters;
+  TFilters myFilters;
+};
+
+#endif
diff --git a/src/SVTK/SVTK_SetRotationPointDlg.cxx b/src/SVTK/SVTK_SetRotationPointDlg.cxx
new file mode 100755 (executable)
index 0000000..f620284
--- /dev/null
@@ -0,0 +1,333 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#include "SVTK_SetRotationPointDlg.h"
+#include "SVTK_MainWindow.h"
+#include "SVTK_RenderWindowInteractor.h"
+#include "SVTK_Event.h"
+#include "SVTK_InteractorStyle.h"
+
+#include "VTKViewer_Utilities.h"
+
+#include "QtxAction.h"
+
+#include <QLineEdit>
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QGridLayout>
+#include <QDoubleValidator>
+#include <QCheckBox>
+
+#include <vtkCallbackCommand.h>
+
+using namespace std;
+
+/*!
+  Constructor
+*/
+SVTK_SetRotationPointDlg
+::SVTK_SetRotationPointDlg(QtxAction* theAction,
+                          SVTK_MainWindow* theParent,
+                          const char* theName):
+  SVTK_DialogBase(theAction,
+                 theParent, 
+                 theName),
+  myMainWindow(theParent),
+  myPriority(0.0),
+  myEventCallbackCommand(vtkCallbackCommand::New()),
+  myRWInteractor(theParent->GetInteractor())
+{
+  setWindowTitle(tr("DLG_TITLE"));
+  setSizeGripEnabled(TRUE);
+
+  // Create layout for this dialog
+  QGridLayout* layoutDlg = new QGridLayout (this);
+  layoutDlg->setSpacing(6);
+  layoutDlg->setMargin(11);
+
+  // Create check box "Use Bounding Box Center"
+  QHBoxLayout* aCheckBox = new QHBoxLayout;
+
+  myIsBBCenter = new QCheckBox(tr("USE_BBCENTER"));
+  myIsBBCenter->setChecked(true);
+  aCheckBox->addWidget(myIsBBCenter);
+  connect(myIsBBCenter, SIGNAL(stateChanged(int)), SLOT(onBBCenterChecked()));
+
+  // Create croup button with radio buttons
+  myGroupBoxSel = new QGroupBox( "", this );
+  QVBoxLayout *vbox = new QVBoxLayout( myGroupBoxSel );
+  vbox->setMargin(11);
+  vbox->addStretch(1);
+  
+  // Create "Set to Origin" button
+  myToOrigin = new QPushButton(myGroupBoxSel);
+  myToOrigin->setText(tr("LBL_TOORIGIN"));
+  vbox->addWidget(myToOrigin);
+  connect(myToOrigin, SIGNAL(clicked()), this, SLOT(onToOrigin()));
+
+  // Create "Select Point from View" button
+  mySelectPoint = new QPushButton(myGroupBoxSel);
+  mySelectPoint->setText(tr("LBL_SELECTPOINT"));
+  mySelectPoint->setCheckable(true);
+  vbox->addWidget(mySelectPoint);
+  connect(mySelectPoint, SIGNAL(clicked()), this, SLOT(onSelectPoint()));
+
+  // Create croup box with grid layout
+  myGroupBoxCoord = new QGroupBox(this);
+  myGroupBoxCoord->setObjectName("GroupBox");
+  QHBoxLayout* aHBoxLayout = new QHBoxLayout(myGroupBoxCoord);
+  aHBoxLayout->setMargin(11);
+  aHBoxLayout->setSpacing(6);
+
+  // "X" coordinate
+  QLabel* TextLabelX = new QLabel (tr("LBL_X"), myGroupBoxCoord );
+  TextLabelX->setObjectName("TextLabelX");
+  TextLabelX->setFixedWidth(15);
+  myX = new QLineEdit(myGroupBoxCoord);
+  myX->setValidator(new QDoubleValidator(myX));
+  myX->setText(QString::number(0.0));
+  connect(myX, SIGNAL(textChanged(const QString&)), this, SLOT(onCoordChanged()));
+
+  // "Y" coordinate
+  QLabel* TextLabelY = new QLabel (tr("LBL_Y"), myGroupBoxCoord );
+  TextLabelY->setObjectName("TextLabelY");
+  TextLabelY->setFixedWidth(15);
+  myY = new QLineEdit(myGroupBoxCoord);
+  myY->setValidator(new QDoubleValidator(myY));
+  myY->setText(QString::number(0.0));
+  connect(myY, SIGNAL(textChanged(const QString&)), this, SLOT(onCoordChanged()));
+
+  // "Z" coordinate
+  QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), myGroupBoxCoord );
+  TextLabelZ->setObjectName("TextLabelZ");
+  TextLabelZ->setFixedWidth(15);
+  myZ = new QLineEdit(myGroupBoxCoord);
+  myZ->setValidator(new QDoubleValidator(myZ));
+  myZ->setText(QString::number(0.0));
+  connect(myZ, SIGNAL(textChanged(const QString&)), this, SLOT(onCoordChanged()));
+
+  // Layout widgets in the horizontal group box
+  aHBoxLayout->addWidget(TextLabelX);
+  aHBoxLayout->addWidget(myX);
+  aHBoxLayout->addWidget(TextLabelY);
+  aHBoxLayout->addWidget(myY);
+  aHBoxLayout->addWidget(TextLabelZ);
+  aHBoxLayout->addWidget(myZ);
+
+  // "Close" button
+  QGroupBox* aGroupBox = new QGroupBox(this);
+  QHBoxLayout* aHBoxLayout2 = new QHBoxLayout(aGroupBox);
+  aHBoxLayout2->setMargin(11);
+  aHBoxLayout2->setSpacing(6);
+
+  QPushButton* m_bClose = new QPushButton(tr("&Close"), aGroupBox );
+  m_bClose->setObjectName("m_bClose");
+  m_bClose->setAutoDefault(TRUE);
+  m_bClose->setFixedSize(m_bClose->sizeHint());
+  connect(m_bClose, SIGNAL(clicked()), this, SLOT(onClickClose()));
+
+  // Layout buttons
+  aHBoxLayout2->addWidget(m_bClose);
+
+  // Layout top level widgets
+  layoutDlg->addLayout(aCheckBox,0,0);
+  layoutDlg->addWidget(myGroupBoxSel,1,0);
+  layoutDlg->addWidget(myGroupBoxCoord,2,0);
+  layoutDlg->addWidget(aGroupBox,3,0);
+  
+  setEnabled(myGroupBoxSel,!myIsBBCenter->isChecked());
+  setEnabled(myGroupBoxCoord,!myIsBBCenter->isChecked());
+
+  this->resize(400, this->sizeHint().height());
+
+  myEventCallbackCommand->Delete();
+  myEventCallbackCommand->SetClientData(this);
+  myEventCallbackCommand->SetCallback(SVTK_SetRotationPointDlg::ProcessEvents);
+  myIsObserverAdded = false;
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+SVTK_SetRotationPointDlg
+::~SVTK_SetRotationPointDlg()
+{
+  // no need to delete child widgets, Qt does it all for us
+}
+
+void
+SVTK_SetRotationPointDlg
+::addObserver()
+{
+  if ( !myIsObserverAdded ) {
+    vtkInteractorStyle* aIStyle = myRWInteractor->GetInteractorStyle();
+    aIStyle->AddObserver(SVTK::BBCenterChanged, myEventCallbackCommand.GetPointer(), myPriority);
+    aIStyle->AddObserver(SVTK::RotationPointChanged, myEventCallbackCommand.GetPointer(), myPriority);
+    myIsObserverAdded = true;
+  }
+}
+
+/*!
+  Return true if it is the first show for this dialog
+*/
+bool
+SVTK_SetRotationPointDlg
+::IsFirstShown()
+{
+  return myIsBBCenter->isChecked() && myX->text().toDouble() == 0.
+    && myY->text().toDouble() == 0. && myZ->text().toDouble() == 0.;
+}
+
+/*!
+  Processes events
+*/
+void 
+SVTK_SetRotationPointDlg
+::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* theCallData)
+{
+  SVTK_SetRotationPointDlg* self = reinterpret_cast<SVTK_SetRotationPointDlg*>(theClientData);
+  vtkFloatingPointType* aCoord = (vtkFloatingPointType*)theCallData;
+  
+  switch ( theEvent ) {
+  case SVTK::BBCenterChanged:
+    if ( self->myIsBBCenter->isChecked()
+        ||
+        IsBBEmpty(self->myMainWindow->getRenderer()) )
+    {
+      if ( aCoord )
+      {
+       self->myX->setText( QString::number(aCoord[0]) );
+       self->myY->setText( QString::number(aCoord[1]) );
+       self->myZ->setText( QString::number(aCoord[2]) );
+      }
+    }
+    break;
+  case SVTK::RotationPointChanged:
+    if ( aCoord )
+    {
+      self->myX->setText( QString::number(aCoord[0]) );
+      self->myY->setText( QString::number(aCoord[1]) );
+      self->myZ->setText( QString::number(aCoord[2]) );
+    }
+    if ( !self->myIsBBCenter->isChecked() )
+      self->mySelectPoint->toggle();
+  }
+}
+
+void 
+SVTK_SetRotationPointDlg
+::setEnabled(QGroupBox* theGrp, const bool theState)
+{
+  QObjectList aChildren(theGrp->children());
+  QObject* anObj;
+  for(int i = 0; i < aChildren.size(); i++)
+  {
+    anObj = aChildren.at(i);
+    if (anObj !=0 && anObj->inherits("QLineEdit"))
+      ((QLineEdit*)anObj)->setReadOnly(!theState);
+    if (anObj !=0 && anObj->inherits("QPushButton"))
+      ((QLineEdit*)anObj)->setEnabled(theState);
+  }
+  
+}
+
+void 
+SVTK_SetRotationPointDlg
+::onBBCenterChecked()
+{
+  setEnabled(myGroupBoxSel,!myIsBBCenter->isChecked());
+  setEnabled(myGroupBoxCoord,!myIsBBCenter->isChecked());
+  
+  if ( myIsBBCenter->isChecked() )
+  { 
+    if ( mySelectPoint->isChecked() )
+      mySelectPoint->toggle();
+    // activate mode : the rotation point is the center of the bounding box
+    // send the data to the SVTK_InteractorStyle: set the type of the rotation point
+    //                                            calculate coordinates of the rotation point
+    myMainWindow->activateSetRotationGravity();
+  }
+  else
+  {
+    QString aX = myX->text();
+    myX->setText(QString::number(aX.toDouble()+1.));
+    myX->setText(aX);
+  }
+}
+
+void
+SVTK_SetRotationPointDlg
+::onToOrigin()
+{
+  if ( mySelectPoint->isChecked() )
+    mySelectPoint->toggle();
+  myX->setText(QString::number(0.0));
+  myY->setText(QString::number(0.0));
+  myZ->setText(QString::number(0.0));
+}
+
+void
+SVTK_SetRotationPointDlg
+::onSelectPoint()
+{
+  if ( mySelectPoint->isChecked() )
+    myMainWindow->activateStartPointSelection();
+  else
+    mySelectPoint->toggle();
+}
+
+void
+SVTK_SetRotationPointDlg
+::onCoordChanged()
+{
+  if ( !myIsBBCenter->isChecked() ) {
+    if ( mySelectPoint->isChecked()
+        &&
+        ( myX->hasFocus() || myY->hasFocus() || myZ->hasFocus() ) )
+      mySelectPoint->toggle();
+    vtkFloatingPointType aCenter[3] = {myX->text().toDouble(), 
+                                      myY->text().toDouble(), 
+                                      myZ->text().toDouble()};
+    myMainWindow->activateSetRotationSelected((void*)aCenter);
+  }
+  else
+    myMainWindow->activateSetRotationGravity();
+}
+
+void
+SVTK_SetRotationPointDlg
+::onClickClose()
+{
+  reject();
+}
+
+
diff --git a/src/SVTK/SVTK_SetRotationPointDlg.h b/src/SVTK/SVTK_SetRotationPointDlg.h
new file mode 100755 (executable)
index 0000000..57df001
--- /dev/null
@@ -0,0 +1,109 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_SETROTATIONPOINTDLG_H
+#define SVTK_SETROTATIONPOINTDLG_H
+
+#include "SVTK.h"
+
+#include "SVTK_DialogBase.h"
+
+#include <vtkSmartPointer.h>
+
+class SVTK_MainWindow;
+class SVTK_RenderWindowInteractor;
+
+class QtxAction;
+
+class QLineEdit;
+class QPushButton;
+class QGroupBox;
+class QCheckBox;
+
+class vtkCallbackCommand;
+class vtkObject;
+
+class SVTK_EXPORT SVTK_SetRotationPointDlg : public SVTK_DialogBase
+{
+  Q_OBJECT;
+
+public:
+  SVTK_SetRotationPointDlg(QtxAction* theAction,
+                          SVTK_MainWindow* theParent,
+                          const char* theName);
+
+  ~SVTK_SetRotationPointDlg();
+  
+  void addObserver();
+  bool IsFirstShown();
+  
+protected:
+  SVTK_MainWindow *myMainWindow;
+  SVTK_RenderWindowInteractor* myRWInteractor;
+  bool myIsObserverAdded;
+  
+  QCheckBox*    myIsBBCenter;
+
+  QGroupBox   * myGroupBoxSel;
+  QPushButton*  myToOrigin;
+  QPushButton*  mySelectPoint;
+
+  QGroupBox* myGroupBoxCoord;
+  QLineEdit* myX;
+  QLineEdit* myY;
+  QLineEdit* myZ;
+
+  void setEnabled(QGroupBox* theGrp, const bool theState);
+
+  //----------------------------------------------------------------------------
+  // Priority at which events are processed
+  vtkFloatingPointType myPriority;
+
+  // Used to process events
+  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+  // Description:
+  // Main process event method
+  static void ProcessEvents(vtkObject* object, 
+                            unsigned long event,
+                            void* clientdata, 
+                            void* calldata);
+
+protected slots:
+  void onBBCenterChecked();
+  
+  void onToOrigin();
+  void onSelectPoint();
+
+  void onCoordChanged();
+
+  void onClickClose();
+
+};
+
+#endif // SVTK_SETROTATIONPOINTDLG_H
diff --git a/src/SVTK/SVTK_SpaceMouse.cxx b/src/SVTK/SVTK_SpaceMouse.cxx
new file mode 100644 (file)
index 0000000..7d858a7
--- /dev/null
@@ -0,0 +1,213 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_SpaceMouse.cxx
+//  Author : Alexander SLADKOV
+//  Module : SALOME
+//  $Header$
+
+#include <string.h>
+#include <math.h>
+#include <stdio.h>
+
+#ifndef WIN32
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+#include <X11/keysym.h>
+#endif
+
+#include "SVTK_SpaceMouse.h"
+
+SVTK_SpaceMouse* SVTK_SpaceMouse::myInstance = 0;
+
+/*!
+  \return shared instance of object (creates if there is no one)
+*/
+SVTK_SpaceMouse* SVTK_SpaceMouse::getInstance()
+{
+  if ( !myInstance )
+    myInstance = new SVTK_SpaceMouse();
+  return myInstance;
+}
+
+/*!
+  Constructor
+*/
+SVTK_SpaceMouse::SVTK_SpaceMouse()
+{
+#ifndef WIN32
+  win = InputFocus;
+#endif
+  spaceMouseOn = 0;
+}
+
+#ifndef WIN32
+
+/*!
+  Initialization
+*/
+int SVTK_SpaceMouse::initialize( Display *display, Window window )
+{
+ XMotionEvent        = XInternAtom( display, "MotionEvent",        1 );
+ XButtonPressEvent   = XInternAtom( display, "ButtonPressEvent",   1 );
+ XButtonReleaseEvent = XInternAtom( display, "ButtonReleaseEvent", 1 );
+ XCommandEvent       = XInternAtom( display, "CommandEvent",       1 );
+
+ spaceMouseOn = (XMotionEvent        != 0) && 
+                (XButtonPressEvent   != 0) && 
+                (XButtonReleaseEvent != 0) && 
+                (XCommandEvent       != 0);
+ if ( !spaceMouseOn )
+  return 0;
+
+ spaceMouseOn = setWindow( display, window );
+ if ( !spaceMouseOn )
+  return 0;
+ return spaceMouseOn; 
+}
+
+static int errorCallback( Display *display, XErrorEvent *Error )
+{
+  char msg[ 128 ];
+  if ( Error->error_code != BadWindow ) {
+    XGetErrorText( display,Error->error_code,msg,sizeof( msg ) );
+    fprintf( stderr, "SpaceMouse reported error = %s. Exit ... \n", msg );
+  }
+  return 0;
+}
+
+/*!
+  Initialize by window
+*/
+int SVTK_SpaceMouse::setWindow( Display *display, Window window )
+{
+  XTextProperty winName;
+  XEvent xEvent;
+  Atom type;
+  int format;
+  unsigned long NItems, BytesReturn;
+  unsigned char *PropReturn;
+  Window root;
+  int result;
+  int (*errorHandler)(Display *,XErrorEvent *);
+
+  result = 1;
+  errorHandler = XSetErrorHandler( errorCallback );
+  root = RootWindow( display, DefaultScreen(display) );
+
+  PropReturn = NULL;
+  XGetWindowProperty( display, root, XCommandEvent, 0,1, 0,
+                     AnyPropertyType, &type, &format, &NItems,
+                     &BytesReturn, &PropReturn );
+
+  win = InputFocus;
+  if ( PropReturn != NULL ) {
+    win = *(Window *) PropReturn;
+    XFree( PropReturn );
+  }
+  else
+    return result = 0;
+
+  if ( XGetWMName( display, win, &winName ) == 0 )
+    return result = 0;
+
+  if ( strcmp( (char *) "Magellan Window", (char *) winName.value) != 0 )
+    return result = 0;
+
+  xEvent.type = ClientMessage;
+  xEvent.xclient.format = 16;
+  xEvent.xclient.send_event = 0;
+  xEvent.xclient.display = display;
+  xEvent.xclient.window = win;
+  xEvent.xclient.message_type = XCommandEvent;
+  
+  xEvent.xclient.data.s[0] = (short) ((window>>16)&0x0000FFFF);
+  xEvent.xclient.data.s[1] = (short)  (window&0x0000FFFF);
+  xEvent.xclient.data.s[2] = 27695;
+
+  if ( XSendEvent( display, win, 0, 0x0000, &xEvent ) == 0 )
+    return result = 0;
+
+  XFlush( display );
+
+  XSetErrorHandler( errorHandler );
+  return result;
+}
+
+/*!
+  Close
+*/
+int SVTK_SpaceMouse::close(Display *display)
+{
+  initialize( display, (Window)InputFocus );
+  spaceMouseOn = 0;
+  
+  return 1;
+}
+
+/*!
+  Custom event handler
+*/
+int SVTK_SpaceMouse::translateEvent( Display* display, XEvent* xEvent, MoveEvent* spaceMouseEvent,
+                   double scale, double rScale )
+{
+  if ( !spaceMouseOn )
+    return 0;
+
+  if ( xEvent->type == ClientMessage ) {
+    if ( xEvent->xclient.message_type == XMotionEvent ) {
+      spaceMouseEvent->type = SpaceMouseMove;
+      spaceMouseEvent->data[ x ] =
+       xEvent->xclient.data.s[2] * scale;
+      spaceMouseEvent->data[ y ] =
+       xEvent->xclient.data.s[3] * scale;
+      spaceMouseEvent->data[ z ] =
+       xEvent->xclient.data.s[4] * scale;
+      spaceMouseEvent->data[ a ] =
+       xEvent->xclient.data.s[5] * rScale;
+      spaceMouseEvent->data[ b ] =
+       xEvent->xclient.data.s[6] * rScale;
+      spaceMouseEvent->data[ c ] =
+       xEvent->xclient.data.s[7] * rScale;
+      spaceMouseEvent->period = xEvent->xclient.data.s[8];
+      return 1;
+    }
+    else if ( xEvent->xclient.message_type == XButtonPressEvent ) {
+      spaceMouseEvent->type = SpaceButtonPress;
+      spaceMouseEvent->button = xEvent->xclient.data.s[2];
+      return 2;
+    }
+    else if ( xEvent->xclient.message_type == XButtonReleaseEvent ) {
+      spaceMouseEvent->type = SpaceButtonRelease;
+      spaceMouseEvent->button = xEvent->xclient.data.s[2];
+      return 3;
+    }
+  }
+  return (!display);
+}
+
+#endif
diff --git a/src/SVTK/SVTK_SpaceMouse.h b/src/SVTK/SVTK_SpaceMouse.h
new file mode 100644 (file)
index 0000000..f920bf4
--- /dev/null
@@ -0,0 +1,81 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : SVTK_SpaceMouse.h
+//  Author : Alexander SLADKOV
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_SpaceMouse_h
+#define SVTK_SpaceMouse_h
+
+#ifndef WIN32
+extern "C"
+{
+#include <X11/X.h>
+#include <X11/Xlib.h>
+}
+#endif
+
+class SVTK_SpaceMouse 
+{
+ public:
+
+  // access to SpaceMouse utility class
+  static SVTK_SpaceMouse* getInstance();
+
+  enum MoveData { x, y, z, a, b, c };
+  enum EventType { SpaceMouseMove = 1, SpaceButtonPress, SpaceButtonRelease };
+
+  typedef struct  {
+    int type;
+    int button;
+    double data[6];
+    int period;
+  } MoveEvent;
+
+  bool isSpaceMouseOn() const { return spaceMouseOn != 0; }
+
+#ifndef WIN32
+  int initialize     ( Display*, Window );
+  int setWindow      ( Display*, Window );
+  int translateEvent ( Display*, XEvent*, MoveEvent*, double, double );
+  int close          ( Display* );
+#endif
+
+ private:
+  SVTK_SpaceMouse();
+  static SVTK_SpaceMouse* myInstance;
+
+#ifndef WIN32
+  Atom XMotionEvent;
+  Atom XButtonPressEvent;
+  Atom XButtonReleaseEvent;
+  Atom XCommandEvent;
+
+  Window win;
+#endif
+  int spaceMouseOn;
+};
+
+#endif
diff --git a/src/SVTK/SVTK_Trihedron.cxx b/src/SVTK/SVTK_Trihedron.cxx
new file mode 100644 (file)
index 0000000..45751cf
--- /dev/null
@@ -0,0 +1,58 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 "SVTK_Trihedron.h"
+#include "SALOME_Actor.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkActorCollection.h>
+#include <vtkRenderer.h>
+
+vtkStandardNewMacro(SVTK_Trihedron);
+
+/*!
+  Constructor
+*/
+SVTK_Trihedron
+::SVTK_Trihedron()
+{
+}
+
+/*!
+  \return count of visible actors
+  \param theRenderer - renderer to be checked
+*/
+int 
+SVTK_Trihedron
+::GetVisibleActorCount(vtkRenderer* theRenderer)
+{
+  vtkActorCollection* aCollection = theRenderer->GetActors();
+  aCollection->InitTraversal();
+  int aCount = 0;
+  while(vtkActor* aProp = aCollection->GetNextActor()) {
+    if(aProp->GetVisibility())
+      if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(aProp)) {
+        if(!anActor->IsInfinitive()) 
+         aCount++;
+      }
+      else if ( !OwnActor( anActor ) ) {
+       aCount++;
+      }
+  }
+  return aCount;
+}
diff --git a/src/SVTK/SVTK_Trihedron.h b/src/SVTK/SVTK_Trihedron.h
new file mode 100644 (file)
index 0000000..3f410cd
--- /dev/null
@@ -0,0 +1,41 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 SVTK_TRIHEDRON_H
+#define SVTK_TRIHEDRON_H
+
+#include "SVTK.h"
+
+#include "VTKViewer_Trihedron.h"
+
+class SVTK_EXPORT SVTK_Trihedron : public VTKViewer_Trihedron
+{
+protected:
+  SVTK_Trihedron();
+  SVTK_Trihedron(const SVTK_Trihedron&); // Not implemented
+  void operator = (const SVTK_Trihedron&); // Not implemented
+
+public:
+  vtkTypeMacro(SVTK_Trihedron,VTKViewer_Trihedron);
+  static SVTK_Trihedron *New();
+  
+  virtual int GetVisibleActorCount(vtkRenderer* theRenderer);
+};
+
+
+#endif
diff --git a/src/SVTK/SVTK_UpdateRateDlg.cxx b/src/SVTK/SVTK_UpdateRateDlg.cxx
new file mode 100644 (file)
index 0000000..4c5262e
--- /dev/null
@@ -0,0 +1,380 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#include "SVTK_UpdateRateDlg.h"
+
+#include "SVTK_MainWindow.h"
+#include "SVTK_RenderWindowInteractor.h"
+#include "VTKViewer_Algorithm.h"
+#include "SALOME_Actor.h"
+
+#include "QtxDoubleSpinBox.h"
+#include "QtxAction.h"
+
+#include <sstream>
+
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QGridLayout>
+#include <QLineEdit>
+
+#include <vtkGenericRenderWindowInteractor.h>
+#include <vtkCallbackCommand.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderer.h>
+#include <vtkMapper.h>
+#include <vtkDataSet.h>
+
+static vtkFloatingPointType OFF_UPDATE_RATE = 0.00001;
+static vtkFloatingPointType FLOAT_TOLERANCE = 1.0 / VTK_LARGE_FLOAT;
+
+using namespace std;
+
+namespace
+{
+  //----------------------------------------------------------------------------
+  inline
+  QString 
+  GetUpdateRate(SVTK_RenderWindowInteractor* theRWInteractor)
+  {
+    if(vtkRenderer *aRenderer = theRWInteractor->getRenderer()){
+      vtkFloatingPointType aLastRenderTimeInSeconds = aRenderer->GetLastRenderTimeInSeconds();
+      if(aLastRenderTimeInSeconds > FLOAT_TOLERANCE){
+       std::ostringstream aStr;
+       vtkFloatingPointType aFPS = 1.0 / aLastRenderTimeInSeconds;
+       aStr<<aFPS;
+       return QString(aStr.str().c_str());
+      }
+    }
+    return "Inf";
+  }
+
+
+  //----------------------------------------------------------------------------
+  struct TRenderTimeMultiplier
+  {
+    vtkFloatingPointType myVTKMultiplier;
+    vtkFloatingPointType mySALOMEMultiplier;
+
+    TRenderTimeMultiplier():
+      myVTKMultiplier(0.0),
+      mySALOMEMultiplier(0.0)
+    {}
+
+    void
+    operator()(vtkActor* theActor)
+    {
+      if(theActor->GetVisibility()){
+       myVTKMultiplier += theActor->GetAllocatedRenderTime();
+       if(dynamic_cast<SALOME_Actor*>(theActor))
+         mySALOMEMultiplier += theActor->GetAllocatedRenderTime();
+      }
+    }
+  };
+
+
+  //----------------------------------------------------------------------------
+  inline
+  vtkFloatingPointType 
+  AdjustUpdateRate(SVTK_RenderWindowInteractor* theRWInteractor,
+                  vtkFloatingPointType theUpdateRate)
+  {
+    if(vtkRenderer *aRenderer = theRWInteractor->getRenderer()){
+      if(vtkActorCollection *anActorCollection = aRenderer->GetActors()){
+       TRenderTimeMultiplier aMultiplier;
+       using namespace VTK;
+       aMultiplier = ForEach<vtkActor>(anActorCollection,
+                                       aMultiplier);
+       if(aMultiplier.mySALOMEMultiplier > FLOAT_TOLERANCE)
+         theUpdateRate *= aMultiplier.mySALOMEMultiplier / aMultiplier.myVTKMultiplier;
+      }
+    }
+    return theUpdateRate;
+  }
+
+
+  //----------------------------------------------------------------------------
+  struct TCellsCounter
+  {
+    vtkIdType myCounter;
+    TCellsCounter():
+      myCounter(0)
+    {}
+
+    void
+    operator()(SALOME_Actor* theActor)
+    {
+      if(theActor->GetVisibility()){
+       if(vtkMapper *aMapper = theActor->GetMapper()){
+         if(vtkDataSet *aDataSet = aMapper->GetInput()){
+           myCounter += aDataSet->GetNumberOfCells();
+         }
+       }
+      }
+    }
+  };
+
+
+  //----------------------------------------------------------------------------
+  inline
+  QString 
+  GetNumberOfCells(SVTK_RenderWindowInteractor* theRWInteractor)
+  {
+    if(vtkRenderer *aRenderer = theRWInteractor->getRenderer()){
+      if(vtkActorCollection *anActorCollection = aRenderer->GetActors()){
+       TCellsCounter aCounter;
+       using namespace VTK;
+       aCounter = ForEach<SALOME_Actor>(anActorCollection,
+                                        aCounter);
+       return QString::number(aCounter.myCounter);
+      }
+    }
+    
+    return QString::number(0);
+  }
+}
+
+/*!
+  Constructor
+*/
+SVTK_UpdateRateDlg
+::SVTK_UpdateRateDlg(QtxAction* theAction,
+                    SVTK_MainWindow* theParent,
+                    const char* theName):
+  SVTK_DialogBase(theAction,
+                 theParent, 
+                 theName),
+  myPriority(0.0),
+  myEventCallbackCommand(vtkCallbackCommand::New()),
+  myRWInteractor(theParent->GetInteractor()),
+  myAction(theAction)
+{
+  vtkRenderWindowInteractor* aRWI = myRWInteractor->GetDevice();
+  bool anIsEnabledUpdateRate = false;
+
+  setWindowTitle(tr("DLG_TITLE"));
+  QVBoxLayout* aVBoxLayout = new QVBoxLayout(this);
+  aVBoxLayout->setMargin(5);
+  aVBoxLayout->setSpacing(5);
+  {
+    QGroupBox* aGroupBox = new QGroupBox(tr("INPUT_FRAME_TITLE"), this);
+
+    aGroupBox->setCheckable(true);
+    aGroupBox->setChecked(anIsEnabledUpdateRate);
+    myIsEnableUpdateRateGroupBox = aGroupBox;
+
+    QGridLayout* aGridLayout = new QGridLayout(aGroupBox);
+    aGridLayout->setSpacing( 6 );
+    aGridLayout->setMargin( 11 );
+    {
+      QLabel* aLabel = new QLabel(tr("DESIRED"), aGroupBox);
+      aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+      aGridLayout->addWidget(aLabel, 0, 0);
+
+      QtxDoubleSpinBox* aDblSpinBox = new QtxDoubleSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox);
+      aDblSpinBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+      aGridLayout->addWidget(aDblSpinBox, 0, 1);
+
+      aDblSpinBox->setValue(aRWI->GetDesiredUpdateRate());
+      aDblSpinBox->setEnabled(anIsEnabledUpdateRate);
+      connect(aGroupBox, SIGNAL(toggled(bool)), aDblSpinBox, SLOT(setEnabled(bool)));
+      myDesiredUpdateRateSblSpinBox = aDblSpinBox;
+    }
+    {
+      QLabel* aLabel = new QLabel(tr("STILL"), aGroupBox);
+      aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+      aGridLayout->addWidget(aLabel, 1, 0);
+
+      QtxDoubleSpinBox* aDblSpinBox = new QtxDoubleSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox);
+      aDblSpinBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+      aGridLayout->addWidget(aDblSpinBox, 1, 1);
+
+      aDblSpinBox->setValue(aRWI->GetStillUpdateRate());
+      aDblSpinBox->setEnabled(anIsEnabledUpdateRate);
+      connect(aGroupBox, SIGNAL(toggled(bool)), aDblSpinBox, SLOT(setEnabled(bool)));
+      myStillUpdateRateSblSpinBox = aDblSpinBox;
+    }
+    aVBoxLayout->addWidget(aGroupBox);
+  }
+  {
+    QGroupBox* aGroupBox = new QGroupBox(tr("INFORMATION_FRAME_TITLE"), this);
+    
+    QGridLayout* aGridLayout = new QGridLayout(aGroupBox);
+    aGridLayout->layout()->setSpacing( 6 );
+    aGridLayout->layout()->setMargin( 11 );
+    {
+      QLabel* aLabel = new QLabel(tr("CURRENT_FPS"), aGroupBox);
+      aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+      aGridLayout->addWidget(aLabel, 0, 0);
+
+      QLineEdit* aLineEdit = new QLineEdit( aGroupBox );
+      aLineEdit->setReadOnly( TRUE );
+      aGridLayout->addWidget(aLineEdit, 0, 1);
+
+      myCurrentUpdateRateLineEdit = aLineEdit;
+      myCurrentUpdateRateLineEdit->setText( GetUpdateRate(myRWInteractor) );
+    }
+    {
+      QLabel* aLabel = new QLabel(tr("NUMBER_CELLS"), aGroupBox);
+      aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+      aGridLayout->addWidget(aLabel, 1, 0);
+
+      QLineEdit* aLineEdit = new QLineEdit( aGroupBox );
+      aLineEdit->setReadOnly( TRUE );
+      aGridLayout->addWidget(aLineEdit, 1, 1);
+
+      myNumberOfCellsLineEdit = aLineEdit;
+      myNumberOfCellsLineEdit->setText( GetNumberOfCells(myRWInteractor) );
+    }
+    aVBoxLayout->addWidget(aGroupBox);
+  }
+  {
+    QGroupBox* aGroupBox = new QGroupBox(this);
+    QHBoxLayout* aHBoxLayout = new QHBoxLayout(aGroupBox);
+    aHBoxLayout->setMargin(11);
+    aHBoxLayout->setSpacing(6);
+    {
+      QPushButton* aPushButton = new QPushButton(tr("OK"), aGroupBox);
+      aPushButton->setDefault(TRUE);
+      aPushButton->setAutoDefault(TRUE);
+      aHBoxLayout->addWidget(aPushButton);
+      connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickOk()));
+    }
+    {
+      QPushButton* aPushButton = new QPushButton(tr("Apply"), aGroupBox);
+      aPushButton->setDefault(TRUE);
+      aPushButton->setAutoDefault(TRUE);
+      aHBoxLayout->addWidget(aPushButton);
+      connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickApply()));
+    }
+    aHBoxLayout->addStretch();
+    {
+      QPushButton* aPushButton = new QPushButton(tr("Close"), aGroupBox);
+      aPushButton->setDefault(TRUE);
+      aPushButton->setAutoDefault(TRUE);
+      aHBoxLayout->addWidget(aPushButton);
+      connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickClose()));
+    }
+    aVBoxLayout->addWidget(aGroupBox);
+  }
+
+  if(!anIsEnabledUpdateRate){
+    aRWI->SetDesiredUpdateRate(OFF_UPDATE_RATE);
+    aRWI->SetStillUpdateRate(OFF_UPDATE_RATE);  
+  }
+
+  myEventCallbackCommand->Delete();
+  myEventCallbackCommand->SetClientData(this);
+  myEventCallbackCommand->SetCallback(SVTK_UpdateRateDlg::ProcessEvents);
+  vtkRenderer *aRenderer = myRWInteractor->getRenderer();
+  aRenderer->AddObserver(vtkCommand::EndEvent,
+                        myEventCallbackCommand.GetPointer(), 
+                        myPriority);
+}
+
+/*!
+  Destroys the object and frees any allocated resources
+ */
+SVTK_UpdateRateDlg
+::~SVTK_UpdateRateDlg()
+{
+  // no need to delete child widgets, Qt does it all for us
+}
+
+/*!
+  Processes events
+*/
+void 
+SVTK_UpdateRateDlg
+::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* vtkNotUsed(theCallData))
+{
+  SVTK_UpdateRateDlg* self = reinterpret_cast<SVTK_UpdateRateDlg*>(theClientData);
+
+  if(theEvent == vtkCommand::EndEvent){
+    self->myCurrentUpdateRateLineEdit->setText( GetUpdateRate(self->myRWInteractor) );
+    self->myNumberOfCellsLineEdit->setText( GetNumberOfCells(self->myRWInteractor) );
+  }
+}
+
+/*!
+  Update
+*/
+void 
+SVTK_UpdateRateDlg
+::Update()
+{
+  vtkRenderWindowInteractor* aRWI = myRWInteractor->GetDevice();
+
+  vtkFloatingPointType anUpdateRate;
+  if(myIsEnableUpdateRateGroupBox->isChecked()){
+    anUpdateRate = AdjustUpdateRate(myRWInteractor,myDesiredUpdateRateSblSpinBox->value());
+    aRWI->SetDesiredUpdateRate(anUpdateRate);
+    anUpdateRate = AdjustUpdateRate(myRWInteractor,myStillUpdateRateSblSpinBox->value());
+    aRWI->SetStillUpdateRate(anUpdateRate);
+  }else{
+    aRWI->SetDesiredUpdateRate(OFF_UPDATE_RATE);
+    aRWI->SetStillUpdateRate(OFF_UPDATE_RATE);
+  }
+
+  myRWInteractor->getRenderWindow()->Render();
+}
+
+/*!
+  SLOT on OK clicked
+*/
+void 
+SVTK_UpdateRateDlg
+::onClickOk()
+{
+  Update();
+  onClickClose();
+}
+
+/*!
+  SLOT on Apply clicked
+*/
+void
+SVTK_UpdateRateDlg
+::onClickApply()
+{
+  Update();
+}
+
+/*!
+  SLOT on Close clicked
+*/
+void 
+SVTK_UpdateRateDlg
+::onClickClose()
+{
+  reject();
+}
diff --git a/src/SVTK/SVTK_UpdateRateDlg.h b/src/SVTK/SVTK_UpdateRateDlg.h
new file mode 100644 (file)
index 0000000..761f75a
--- /dev/null
@@ -0,0 +1,93 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#ifndef SVTK_UPDATERATEDLG_H
+#define SVTK_UPDATERATEDLG_H
+
+#include "SVTK_DialogBase.h"
+
+#include <vtkSmartPointer.h>
+
+class SVTK_MainWindow;
+class SVTK_RenderWindowInteractor;
+
+class QtxDoubleSpinBox;
+class QtxAction;
+
+class QGroupBox;
+class QLineEdit;
+
+class vtkCallbackCommand;
+class vtkObject;
+
+
+class SVTK_UpdateRateDlg : public SVTK_DialogBase
+{
+  Q_OBJECT;
+
+public:
+  SVTK_UpdateRateDlg(QtxAction* theAction,
+                    SVTK_MainWindow* theParent,
+                    const char* theName);
+
+  ~SVTK_UpdateRateDlg();
+
+  void Update();
+
+protected:
+  SVTK_RenderWindowInteractor* myRWInteractor;
+  QtxDoubleSpinBox* myDesiredUpdateRateSblSpinBox;
+  QtxDoubleSpinBox* myStillUpdateRateSblSpinBox;
+  QGroupBox* myIsEnableUpdateRateGroupBox;
+
+  QLineEdit* myCurrentUpdateRateLineEdit;
+  QLineEdit* myNumberOfCellsLineEdit;
+
+  QtxAction* myAction;
+
+  //----------------------------------------------------------------------------
+  // Priority at which events are processed
+  vtkFloatingPointType myPriority;
+
+  // Used to process events
+  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+  // Description:
+  // Main process event method
+  static void ProcessEvents(vtkObject* object, 
+                            unsigned long event,
+                            void* clientdata, 
+                            void* calldata);
+  
+protected slots:
+  void onClickOk();
+  void onClickApply();
+  void onClickClose();
+};
+
+#endif // SVTK_UPDATERATEDLG_H
diff --git a/src/SVTK/SVTK_View.cxx b/src/SVTK/SVTK_View.cxx
new file mode 100644 (file)
index 0000000..e056d6d
--- /dev/null
@@ -0,0 +1,675 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  Copyright (C) 2003  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
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#include "SALOME_Actor.h"
+
+#include "SVTK_View.h"
+#include "SVTK_Renderer.h"
+#include "SVTK_MainWindow.h"
+#include "SVTK_RenderWindowInteractor.h"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+
+#include <vtkActorCollection.h>
+#include <vtkRenderer.h>
+
+/*!
+  Constructor
+*/
+SVTK_SignalHandler
+::SVTK_SignalHandler(SVTK_MainWindow* theMainWindow):
+  QObject(theMainWindow),
+  myMainWindow(theMainWindow)
+{
+  SVTK_RenderWindowInteractor* anInteractor = theMainWindow->GetInteractor();
+
+  connect(anInteractor,SIGNAL(KeyPressed(QKeyEvent*)),
+         this,SIGNAL(KeyPressed(QKeyEvent*)) );
+  connect(anInteractor,SIGNAL(KeyReleased(QKeyEvent*)),
+         this,SIGNAL(KeyReleased(QKeyEvent*)));
+  connect(anInteractor,SIGNAL(MouseButtonPressed(QMouseEvent*)),
+         this,SIGNAL(MouseButtonPressed(QMouseEvent*)));
+  connect(anInteractor,SIGNAL(MouseButtonReleased(QMouseEvent*)),
+         this,SIGNAL(MouseButtonReleased(QMouseEvent*)));
+  connect(anInteractor,SIGNAL(MouseDoubleClicked(QMouseEvent*)),
+         this,SIGNAL(MouseDoubleClicked(QMouseEvent*)));
+  connect(anInteractor,SIGNAL(MouseMove(QMouseEvent*)),
+         this,SIGNAL(MouseMove(QMouseEvent*)));
+  connect(anInteractor,SIGNAL(contextMenuRequested(QContextMenuEvent*)),
+         this,SIGNAL(contextMenuRequested(QContextMenuEvent*)));
+  connect(anInteractor,SIGNAL(selectionChanged()),
+         this,SIGNAL(selectionChanged()));
+}
+
+/*!
+  Destructor
+*/
+SVTK_SignalHandler
+::~SVTK_SignalHandler()
+{
+}
+
+/*!
+  \return corresponding svtk main window
+*/
+SVTK_MainWindow*
+SVTK_SignalHandler
+::GetMainWindow()
+{
+  return myMainWindow;
+}
+
+
+/*!
+  Redirect the request to #SVTK_MainWindow::Repaint (just for flexibility)
+*/
+void
+SVTK_SignalHandler
+::Repaint(bool theUpdateTrihedron)
+{
+  myMainWindow->Repaint(theUpdateTrihedron);
+}
+
+/*!
+  Redirect the request to #SVTK_MainWindow::GetRenderer (just for flexibility)
+*/
+SVTK_Renderer* 
+SVTK_SignalHandler
+::GetRenderer()
+{
+  return myMainWindow->GetRenderer();
+}
+
+/*!
+  Redirect the request to #SVTK_MainWindow::getRenderer (just for flexibility)
+*/
+vtkRenderer* 
+SVTK_SignalHandler
+::getRenderer()
+{
+  return myMainWindow->getRenderer();
+}
+
+namespace SVTK
+{
+  struct THighlightAction
+  {
+    bool myIsHighlight;
+    THighlightAction( bool theIsHighlight ):
+      myIsHighlight( theIsHighlight )
+    {}
+    
+    void
+    operator()( SALOME_Actor* theActor) 
+    {
+      if(theActor->GetMapper() && theActor->hasIO()){
+       theActor->Highlight( myIsHighlight );
+      }
+    }
+  };
+}
+
+/*!
+  SLOT: called on selection change
+*/
+void
+SVTK_SignalHandler
+::onSelectionChanged()
+{
+  vtkActorCollection* anActors = myMainWindow->getRenderer()->GetActors();
+
+  using namespace SVTK;
+  ForEach<SALOME_Actor>(anActors,
+                       THighlightAction( false ));
+  SVTK_Selector* aSelector = myMainWindow->GetSelector();
+  const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
+  SALOME_ListIteratorOfListIO anIter(aListIO);
+  for(; anIter.More(); anIter.Next()){
+    ForEachIf<SALOME_Actor>(anActors,
+                           TIsSameIObject<SALOME_Actor>(anIter.Value()),
+                           THighlightAction(true));
+  }
+
+  myMainWindow->Repaint(false);
+}
+
+/*!
+  Constructor
+*/
+SVTK_View
+::SVTK_View(SVTK_MainWindow* theMainWindow) :
+  SVTK_SignalHandler(theMainWindow)
+{
+}
+
+/*!
+  Destructor
+*/
+SVTK_View
+::~SVTK_View()
+{
+}
+
+/*!
+  Unhilights all objects in viewer
+*/
+void 
+SVTK_View
+::unHighlightAll() 
+{
+  using namespace SVTK;
+  ForEach<SALOME_Actor>(getRenderer()->GetActors(),
+                       THighlightAction( false ));
+  Repaint();
+}
+
+/*!
+  Hilights/unhilights object in viewer
+  \param theIO - object to be updated
+  \param theIsHighlight - if it is true, object will be hilighted, otherwise it will be unhilighted
+  \param theIsUpdate - update current viewer
+*/
+void
+SVTK_View
+::highlight( const Handle(SALOME_InteractiveObject)& theIO, 
+            bool theIsHighlight, 
+            bool theIsUpdate ) 
+{
+  using namespace SVTK;
+  ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+                         TIsSameIObject<SALOME_Actor>( theIO ),
+                         THighlightAction(theIsHighlight));
+  Repaint();
+}
+
+/*!
+  Display object
+  \param theEntry - entry that corresponds to intractive objects
+*/
+Handle(SALOME_InteractiveObject)
+SVTK_View
+::FindIObject(const char* theEntry) 
+{
+  using namespace SVTK;
+  SALOME_Actor* anActor = 
+    Find<SALOME_Actor>(getRenderer()->GetActors(),
+                      TIsSameEntry<SALOME_Actor>(theEntry));
+  if(anActor != NULL)
+    return anActor->getIO();
+  return NULL;
+}
+
+/*!
+   Redirect the request to #SVTK_Renderer::SetPreselectionProp
+*/
+void
+SVTK_View
+::SetSelectionProp(const double& theRed, 
+                  const double& theGreen, 
+                  const double& theBlue, 
+                  const int& theWidth) 
+{
+  GetRenderer()->SetSelectionProp(theRed,theGreen,theBlue,theWidth);
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::SetPreselectionProp
+*/
+void
+SVTK_View
+::SetPreselectionProp(const double& theRed, 
+                     const double& theGreen, 
+                     const double& theBlue, 
+                     const int& theWidth) 
+{
+  GetRenderer()->SetPreselectionProp(theRed,theGreen,theBlue,theWidth);
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::SetPreselectionProp
+*/
+void
+SVTK_View
+::SetSelectionTolerance(const double& theTolNodes, 
+                       const double& theTolCell)
+{
+  GetRenderer()->SetSelectionTolerance(theTolNodes,theTolCell);
+}
+
+/*!
+  \return true if object is in viewer or in collector
+  \param theIO - object to be checked
+*/
+bool
+SVTK_View
+::isInViewer(const Handle(SALOME_InteractiveObject)& theIObject)
+{
+  using namespace SVTK;
+  SALOME_Actor* anActor = 
+    Find<SALOME_Actor>(getRenderer()->GetActors(),
+                      TIsSameIObject<SALOME_Actor>(theIObject));
+  return anActor != NULL;
+}
+
+/*!
+  \return true if object is displayed in viewer
+  \param theIO - object to be checked
+*/
+bool
+SVTK_View
+::isVisible(const Handle(SALOME_InteractiveObject)& theIObject)
+{
+  using namespace SVTK;
+  SALOME_Actor* anActor = 
+    Find<SALOME_Actor>(getRenderer()->GetActors(),
+                      TIsSameIObject<SALOME_Actor>(theIObject));
+  return anActor != NULL && anActor->GetVisibility();
+}
+
+/*!
+  Changes name of object
+  \param theIObject - object to be renamed
+  \param theName - new name
+*/
+void
+SVTK_View
+::rename(const Handle(SALOME_InteractiveObject)& theIObject, 
+        const QString& theName)
+{
+  using namespace SVTK;
+  ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+                         TIsSameIObject<SALOME_Actor>(theIObject),
+                         TSetFunction<SALOME_Actor,const char*,const char*>
+                         (&SALOME_Actor::setName,theName.toLatin1().data()));
+}
+
+/*!
+  \return current display mode (obsolete)
+*/
+int
+SVTK_View
+::GetDisplayMode() 
+{
+  return myDisplayMode; 
+}
+
+/*!
+  Set current display mode
+  \param theMode - new display mode
+*/
+void
+SVTK_View
+::SetDisplayMode(int theMode)
+{
+  if(theMode == 0) 
+    ChangeRepresentationToWireframe();
+  else 
+    ChangeRepresentationToSurface();
+  myDisplayMode = theMode;
+}
+
+/*!
+  Set current display mode
+  \param theIObject - object
+  \param theMode - new display mode
+*/
+void
+SVTK_View
+::SetDisplayMode(const Handle(SALOME_InteractiveObject)& theIObject, 
+                int theMode)
+{
+  using namespace SVTK;
+  ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+                         TIsSameIObject<SALOME_Actor>(theIObject),
+                         TSetFunction<SALOME_Actor,int>
+                         (&SALOME_Actor::setDisplayMode,theMode));
+}
+
+/*!
+  Change all actors to wireframe
+*/
+void
+SVTK_View
+::ChangeRepresentationToWireframe()
+{
+  ChangeRepresentationToWireframe(getRenderer()->GetActors());
+}
+
+/*!
+  Change all actors to shading
+*/
+void
+SVTK_View
+::ChangeRepresentationToSurface()
+{
+  ChangeRepresentationToSurface(getRenderer()->GetActors());
+}
+
+/*!
+  Change to wireframe a list of vtkactor
+  theCollection - list of vtkactor
+*/
+void
+SVTK_View
+::ChangeRepresentationToWireframe(vtkActorCollection* theCollection)
+{
+  using namespace SVTK;
+  ForEach<SALOME_Actor>(theCollection,
+                       TSetFunction<SALOME_Actor,int>
+                       (&SALOME_Actor::setDisplayMode,0));
+  Repaint();
+}
+
+/*!
+  Change to shading a list of vtkactor
+  theCollection - list of vtkactor
+*/
+void
+SVTK_View
+::ChangeRepresentationToSurface(vtkActorCollection* theCollection)
+{
+  using namespace SVTK;
+  ForEach<SALOME_Actor>(theCollection,
+                       TSetFunction<SALOME_Actor,int>
+                       (&SALOME_Actor::setDisplayMode,1));
+  Repaint();
+}
+
+namespace SVTK
+{
+  struct TErase
+  {
+    VTK::TSetFunction<vtkActor,int> mySetFunction;
+    TErase():
+      mySetFunction(&vtkActor::SetVisibility,false)
+    {}
+    void
+    operator()(SALOME_Actor* theActor)
+    {
+      theActor->SetVisibility(false);
+      // Erase dependent actors
+      vtkActorCollection* aCollection = vtkActorCollection::New(); 
+      theActor->GetChildActors(aCollection);
+      VTK::ForEach<vtkActor>(aCollection,mySetFunction);
+      aCollection->Delete();
+    }
+  };
+}
+
+/*!
+  To erase all existing VTK presentations
+*/
+void
+SVTK_View
+::EraseAll()
+{   
+  using namespace SVTK;
+  ForEach<SALOME_Actor>(getRenderer()->GetActors(),
+                       TErase());
+  Repaint();
+}
+
+/*!
+  To display all existing VTK presentations
+*/
+void
+SVTK_View
+::DisplayAll()
+{ 
+  using namespace SVTK;
+  ForEach<SALOME_Actor>(getRenderer()->GetActors(),
+                       TSetVisibility<SALOME_Actor>(true));
+  Repaint();
+}
+
+/*!
+  To erase VTK presentation
+  \param theActor - actor
+  \param theIsUpdate - updates current viewer
+*/
+void
+SVTK_View
+::Erase(SALOME_Actor* theActor, 
+       bool theIsUpdate)
+{
+  SVTK::TErase()(theActor);
+
+  if(theIsUpdate)
+    Repaint();
+}
+
+
+/*!
+  To erase VTK presentation
+  \param theIObject - object
+  \param theIsUpdate - updates current viewer
+*/
+void
+SVTK_View
+::Erase(const Handle(SALOME_InteractiveObject)& theIObject, 
+       bool theIsUpdate)
+{
+  using namespace SVTK;
+  ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+                         TIsSameIObject<SALOME_Actor>(theIObject),
+                         TErase());
+  if(theIsUpdate)
+    Repaint();
+}
+
+/*!
+  To display the VTK presentation
+*/
+void
+SVTK_View
+::Display(SALOME_Actor* theActor, 
+         bool theIsUpdate)
+{
+  GetRenderer()->AddActor(theActor);
+  theActor->SetVisibility(true);
+
+  if(theIsUpdate)
+    Repaint();
+}
+
+/*!
+  To display the VTK presentation
+*/
+void
+SVTK_View
+::Display(const Handle(SALOME_InteractiveObject)& theIObject, 
+         bool theIsUpdate)
+{
+  using namespace SVTK;
+  ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+                         TIsSameIObject<SALOME_Actor>(theIObject),
+                         TSetVisibility<SALOME_Actor>(true));
+
+  if(theIsUpdate)
+    Repaint();
+}
+
+/*!
+  To display VTK presentation with defined #SALOME_InteractiveObject and erase all others
+*/
+void
+SVTK_View
+::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject)
+{
+  EraseAll();
+  Display(theIObject);
+}
+
+
+namespace SVTK
+{
+  struct TRemoveAction
+  {
+    SVTK_Renderer* myRenderer;
+    TRemoveAction(SVTK_Renderer* theRenderer): 
+      myRenderer(theRenderer)
+    {}
+    void
+    operator()(SALOME_Actor* theActor)
+    {
+      myRenderer->RemoveActor(theActor);
+    }
+  };
+}
+
+/*!
+  To remove the VTK presentation
+*/
+void
+SVTK_View
+::Remove(const Handle(SALOME_InteractiveObject)& theIObject, 
+        bool theIsUpdate)
+{
+  using namespace SVTK;
+  ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+                         TIsSameIObject<SALOME_Actor>(theIObject),
+                         TRemoveAction(GetRenderer()));
+  if(theIsUpdate)
+    Repaint();
+}
+
+/*!
+  To remove the VTK presentation
+*/
+void
+SVTK_View
+::Remove(SALOME_Actor* theActor, 
+        bool theIsUpdate)
+{
+  GetRenderer()->RemoveActor(theActor);
+  if(theIsUpdate)
+    Repaint();
+}
+
+/*!
+  To remove all VTK presentations
+*/
+void
+SVTK_View
+::RemoveAll(bool theIsUpdate)
+{
+  vtkRenderer* aRenderer = getRenderer();
+  if(vtkActorCollection* anActors = aRenderer->GetActors()){
+    anActors->InitTraversal();
+    while(vtkActor *anAct = anActors->GetNextActor()){
+      if(SALOME_Actor* aSAct = SALOME_Actor::SafeDownCast(anAct)){
+        if(aSAct->hasIO() && aSAct->getIO()->hasEntry())
+          aRenderer->RemoveActor( anAct );
+      }
+    }
+
+    if(theIsUpdate)
+      Repaint();
+  }
+}
+
+/*!
+  \return current transparency
+  \param theIObject - object
+*/
+float
+SVTK_View
+::GetTransparency(const Handle(SALOME_InteractiveObject)& theIObject) 
+{
+  using namespace SVTK;
+  SALOME_Actor* anActor = 
+    Find<SALOME_Actor>(getRenderer()->GetActors(),
+                      TIsSameIObject<SALOME_Actor>(theIObject));
+  if(anActor)
+    return 1.0 - anActor->GetOpacity();
+  return -1.0;
+}
+
+
+/*!
+  Sets current transparency
+  \param theIObject - object
+  \param theTrans - new transparency
+*/
+void
+SVTK_View
+::SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject, 
+                 float theTrans)
+{
+  vtkFloatingPointType anOpacity = 1.0 - theTrans;
+  using namespace SVTK;
+  ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+                         TIsSameIObject<SALOME_Actor>(theIObject),
+                         TSetFunction<SALOME_Actor,vtkFloatingPointType>
+                         (&SALOME_Actor::SetOpacity,anOpacity));
+}
+
+/*!
+  Change color
+  \param theIObject - object
+  \param theColor - new color
+*/
+void
+SVTK_View
+::SetColor(const Handle(SALOME_InteractiveObject)& theIObject,
+          const QColor& theColor) 
+{
+  vtkFloatingPointType aColor[3] = {theColor.red()/255., theColor.green()/255., theColor.blue()/255.};
+
+  using namespace SVTK;
+  ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
+                         TIsSameIObject<SALOME_Actor>(theIObject),
+                         TSetFunction<SALOME_Actor,const vtkFloatingPointType*>
+                         (&SALOME_Actor::SetColor,aColor));
+}
+
+
+/*!
+  \return object color
+  \param theIObject - object
+*/
+QColor
+SVTK_View
+::GetColor(const Handle(SALOME_InteractiveObject)& theIObject) 
+{
+  using namespace SVTK;
+  SALOME_Actor* anActor = 
+    Find<SALOME_Actor>(getRenderer()->GetActors(),
+                      TIsSameIObject<SALOME_Actor>(theIObject));
+  if(anActor){
+    vtkFloatingPointType r,g,b;
+    anActor->GetColor(r,g,b);
+    return QColor(int(r*255),int(g*255),int(b*255));
+  }
+
+  return QColor(0,0,0);
+}
+
diff --git a/src/SVTK/SVTK_View.h b/src/SVTK/SVTK_View.h
new file mode 100644 (file)
index 0000000..af25bf5
--- /dev/null
@@ -0,0 +1,271 @@
+// Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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 SVTK_VIEW_H
+#define SVTK_VIEW_H
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+#include "SVTK.h"
+#include "SALOME_InteractiveObject.hxx"
+
+#include <QObject>
+
+class vtkActorCollection;
+class vtkRenderer;
+
+class SVTK_MainWindow;
+class SVTK_Renderer;
+
+class SALOME_Actor;
+
+class QMouseEvent;
+class QWheelEvent;
+class QKeyEvent;
+class QContextMenuEvent;
+class QColor;
+
+
+//! Main purpose of the class is to provide a way to customize #SVTK_MainWindow.
+/*!
+  This class is initialized by #SVTK_MainWindow and just pass Qt signals from 
+  corresponding #SVTK_RenderWindowInteractor of the #SVTK_MainWindow.
+  Its main purpose is to provide a simple and flexible way to customize the #SVTK_MainWindow.
+  So, in your own viewer it is possible to derive new #SVTK_MainWindow and 
+  use existing functionality without any modifications.
+ */
+class SVTK_EXPORT SVTK_SignalHandler : public QObject
+{
+  Q_OBJECT;
+
+public:
+  SVTK_SignalHandler(SVTK_MainWindow* theMainWindow);
+
+  virtual
+  ~SVTK_SignalHandler();
+
+  //! Get reference to its #SVTK_MainWindow
+  SVTK_MainWindow*
+  GetMainWindow();
+
+  //----------------------------------------------------------------------------
+  //! Redirect the request to #SVTK_MainWindow::Repaint (just for flexibility)
+  void
+  Repaint(bool theUpdateTrihedron = true);
+
+  //----------------------------------------------------------------------------
+  //! Redirect the request to #SVTK_MainWindow::GetRenderer (just for flexibility)
+  SVTK_Renderer* 
+  GetRenderer();
+
+  //! Redirect the request to #SVTK_MainWindow::getRenderer (just for flexibility)
+  vtkRenderer* 
+  getRenderer();
+
+  //----------------------------------------------------------------------------
+ public slots:
+  void onSelectionChanged();
+
+ public:
+ signals:
+  void MouseMove( QMouseEvent* );
+  void MouseButtonPressed( QMouseEvent* );
+  void MouseButtonReleased( QMouseEvent* );
+  void MouseDoubleClicked( QMouseEvent* );
+  void ButtonPressed(const QMouseEvent *event);
+  void ButtonReleased(const QMouseEvent *event);
+  void WheelMoved( QWheelEvent* );
+  void KeyPressed( QKeyEvent* );
+  void KeyReleased( QKeyEvent* );
+  void contextMenuRequested( QContextMenuEvent *e );
+  void selectionChanged();
+
+ protected:
+  SVTK_MainWindow* myMainWindow;
+};
+
+
+//! This class is introduced just for compatibility with old code.
+/*!
+  This class contains frequantly used functionality in old code.
+  Now, you are supposed to extend existing functionality through
+  writing corresponding functors (see SVTK_Functor.h for example).
+ */
+class SVTK_EXPORT SVTK_View : public SVTK_SignalHandler
+{
+  Q_OBJECT;
+
+public:
+  SVTK_View(SVTK_MainWindow* theMainWindow);
+
+  virtual
+  ~SVTK_View();
+  
+  /*  interactive object management */
+  //! To highlight a VTK presentation with the same #SALOME_InteractiveObject
+  void
+  highlight(const Handle(SALOME_InteractiveObject)& IObject, 
+           bool highlight, 
+           bool immediatly = true);
+
+  //! To unhighlight all VTK presentations
+  void
+  unHighlightAll();
+
+  //! Try to find a SALOME_InteractiveObject in the view that corresponds to the entry
+  Handle(SALOME_InteractiveObject) 
+  FindIObject(const char* Entry);
+
+  //! Check, if the viewer contains a presentatin with defined #SALOME_InteractiveObject
+  bool
+  isInViewer(const Handle(SALOME_InteractiveObject)& IObject);
+
+  //! Check, if a presentatin with defined #SALOME_InteractiveObject is visible
+  bool
+  isVisible(const Handle(SALOME_InteractiveObject)& IObject);
+
+  void
+  rename(const Handle(SALOME_InteractiveObject)& IObject, 
+        const QString& newName);
+  
+  //----------------------------------------------------------------------------
+  // Displaymode management
+  //! Get current display mode (obsolete)
+  int 
+  GetDisplayMode();
+
+  //! Set current display mode
+  void
+  SetDisplayMode(int);
+
+  //! Switch representation wireframe/shading
+  void
+  SetDisplayMode(const Handle(SALOME_InteractiveObject)& IObject, 
+                int theMode);
+
+  //! Change all actors to wireframe
+  void 
+  ChangeRepresentationToWireframe();
+
+  //! Change all actors to surface
+  void
+  ChangeRepresentationToSurface();
+
+  //! Change to wireframe a list of vtkactor
+  void
+  ChangeRepresentationToWireframe(vtkActorCollection* theListofActors);
+
+  //! Change to surface a list of vtkactor
+  void
+  ChangeRepresentationToSurface(vtkActorCollection* theListofActors);
+
+  //! Change transparency
+  void
+  SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject,
+                 float trans);
+
+  //! Get current transparency
+  float 
+  GetTransparency(const Handle(SALOME_InteractiveObject)& theIObject);
+
+  //! Change color
+  void
+  SetColor(const Handle(SALOME_InteractiveObject)& theIObject,
+          const QColor& theColor);
+
+  //! Get current color
+  QColor
+  GetColor(const Handle(SALOME_InteractiveObject)& theIObject);
+
+  //----------------------------------------------------------------------------
+  // Erase Display functions
+  //! To erase all existing VTK presentations
+  void
+  EraseAll();
+
+  //! To display all existing VTK presentations
+  void
+  DisplayAll();
+
+  //! To remove from the view all existing VTK presentations
+  void
+  RemoveAll( const bool immediatly );
+
+  //! To erase VTK presentation with defined #SALOME_InteractiveObject
+  void
+  Erase(const Handle(SALOME_InteractiveObject)& IObject, 
+       bool immediatly = true);
+  void
+  Remove(const Handle(SALOME_InteractiveObject)& IObject, 
+        bool immediatly = true);
+
+  //! To display VTK presentation with defined #SALOME_InteractiveObject
+  void
+  Display(const Handle(SALOME_InteractiveObject)& IObject, 
+         bool immediatly = true);
+
+  //! To display VTK presentation with defined #SALOME_InteractiveObject and erase all anothers
+  void
+  DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject);
+
+  //! To display the VTK presentation
+  void
+  Display(SALOME_Actor* SActor, 
+         bool immediatly = true);
+
+  //! To erase the VTK presentation
+  void
+  Erase(SALOME_Actor* SActor, 
+       bool immediatly = true);
+
+  //! To remove the VTK presentation
+  void
+  Remove(SALOME_Actor* SActor, 
+        bool updateViewer = true);
+
+  //----------------------------------------------------------------------------
+  //! Redirect the request to #SVTK_Renderer::SetPreselectionProp
+  void
+  SetSelectionProp(const double& theRed = 1, 
+                  const double& theGreen = 1,
+                  const double& theBlue = 0, 
+                  const int& theWidth = 5);
+
+  //! Redirect the request to #SVTK_Renderer::SetPreselectionProp
+  void
+  SetPreselectionProp(const double& theRed = 0, 
+                     const double& theGreen = 1,
+                     const double& theBlue = 1, 
+                     const int& theWidth = 5);
+
+  //! Redirect the request to #SVTK_Renderer::SetPreselectionProp
+  void
+  SetSelectionTolerance(const double& theTolNodes = 0.025, 
+                       const double& theTolCell = 0.001);
+
+ protected:  
+  int myDisplayMode;
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif
diff --git a/src/SVTK/SVTK_ViewManager.cxx b/src/SVTK/SVTK_ViewManager.cxx
new file mode 100644 (file)
index 0000000..b7856fd
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 "SVTK_ViewManager.h"
+#include "SVTK_ViewModel.h"
+
+#include <VTKViewer_ViewManager.h>
+
+/*!
+  Constructor
+*/
+SVTK_ViewManager::SVTK_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop ) 
+: SUIT_ViewManager( study, theDesktop, new SVTK_Viewer() )
+{
+  setTitle( VTKViewer_ViewManager::tr( "VTK_VIEW_TITLE" ) );
+}
+
+/*!
+  Destructor
+*/
+SVTK_ViewManager::~SVTK_ViewManager()
+{
+}
+
+/*!
+  \return corresponding main window
+*/
+SUIT_Desktop* SVTK_ViewManager::getDesktop()
+{
+  return myDesktop;
+}
diff --git a/src/SVTK/SVTK_ViewManager.h b/src/SVTK/SVTK_ViewManager.h
new file mode 100644 (file)
index 0000000..8ff4efc
--- /dev/null
@@ -0,0 +1,42 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 SVTK_VIEWMANAGER_H
+#define SVTK_VIEWMANAGER_H
+
+#include "SUIT_ViewManager.h"
+#include "SVTK.h"
+
+class SUIT_Desktop;
+
+//! Extend SUIT_ViewManager to deal with SVTK_Viewer
+class SVTK_EXPORT SVTK_ViewManager : public SUIT_ViewManager
+{
+  Q_OBJECT
+
+public:
+  //! Construct the view manager
+  SVTK_ViewManager( SUIT_Study* study, SUIT_Desktop* );
+
+  //! Destroy the view manager
+  virtual ~SVTK_ViewManager();
+
+  SUIT_Desktop* getDesktop();
+};
+
+#endif
diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx
new file mode 100644 (file)
index 0000000..990a96e
--- /dev/null
@@ -0,0 +1,512 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 <QMenu>
+#include <QColorDialog>
+#include <QToolBar>
+
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkActorCollection.h>
+
+//#include "SUIT_Session.h"
+#include "SUIT_ViewModel.h"
+#include "SUIT_ViewManager.h"
+
+#include "SVTK_Selection.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_View.h"
+#include "SVTK_MainWindow.h"
+#include "SVTK_Prs.h"
+
+#include "VTKViewer_ViewModel.h"
+
+#include <SALOME_Actor.h>
+
+// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study.
+// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from 
+// SALOMEDS::StudyManager - no linkage with SalomeApp. 
+
+// Temporarily commented to avoid awful dependecy on SALOMEDS
+// TODO: better mechanism of storing display/erse status in a study
+// should be provided...
+//static _PTR(Study) getStudyDS() 
+//{
+//  SALOMEDSClient_Study* aStudy = NULL;
+//  _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );
+  // get id of SUIT_Study, if it's a SalomeApp_Study, it will return
+  //    id of its underlying SALOMEDS::Study
+//  SUIT_Application* app = SUIT_Session::session()->activeApplication();
+//  if ( !app )  return _PTR(Study)(aStudy); 
+//  SUIT_Study* stud = app->activeStudy();
+//  if ( !stud ) return _PTR(Study)(aStudy);  
+//  const int id = stud->id(); // virtual method, must return SALOMEDS_Study id
+  // get SALOMEDS_Study with this id from StudyMgr
+//  return aMgr->GetStudyByID( id );
+//}
+
+/*!
+  Constructor
+*/
+SVTK_Viewer::SVTK_Viewer()
+{
+  myTrihedronSize = 105;
+  myTrihedronRelative = true;
+}
+
+/*!
+  Destructor
+*/
+SVTK_Viewer::~SVTK_Viewer() 
+{
+}
+
+/*!
+  \return background color
+*/
+QColor
+SVTK_Viewer
+::backgroundColor() const
+{
+  return myBgColor;
+}
+
+/*!
+  Changes background color
+  \param theColor - new background color
+*/
+void
+SVTK_Viewer
+::setBackgroundColor( const QColor& theColor )
+{
+  if ( !theColor.isValid() )
+    return;
+
+  QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+    if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){
+      if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow)){
+       aView->setBackgroundColor(theColor);
+      }
+    }
+  }
+
+  myBgColor = theColor;
+}
+
+/*!Create new instance of view window on desktop \a theDesktop.
+ *\retval SUIT_ViewWindow* - created view window pointer.
+ */
+SUIT_ViewWindow*
+SVTK_Viewer::
+createView( SUIT_Desktop* theDesktop )
+{
+  TViewWindow* aViewWindow = new TViewWindow(theDesktop);
+  aViewWindow->Initialize(this);
+
+  aViewWindow->setBackgroundColor( backgroundColor() );
+  aViewWindow->SetTrihedronSize( trihedronSize(), trihedronRelative() );
+
+  return aViewWindow;
+}
+
+/*!
+  \return trihedron size
+*/
+vtkFloatingPointType SVTK_Viewer::trihedronSize() const
+{
+  return myTrihedronSize;
+}
+
+/*!
+  \return true if thihedron changes size in accordance with bounding box
+*/
+bool SVTK_Viewer::trihedronRelative() const
+{
+  return myTrihedronRelative;
+}
+
+/*!
+  Sets trihedron size and relativeness( whether thihedron changes size in accordance with bounding box)
+  \param theSize - new size
+  \param theRelative - new relativeness
+*/
+void SVTK_Viewer::setTrihedronSize( const vtkFloatingPointType theSize, const bool theRelative )
+{
+  myTrihedronSize = theSize;
+  myTrihedronRelative = theRelative;
+
+  if (SUIT_ViewManager* aViewManager = getViewManager()) {
+    QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
+    for ( uint i = 0; i < aViews.count(); i++ )
+    {
+      if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
+             aView->SetTrihedronSize( theSize, theRelative );
+    }
+  }
+}
+
+/*!
+  Sets new view manager
+  \param theViewManager - new view manager
+*/
+void SVTK_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
+{
+  SUIT_ViewModel::setViewManager(theViewManager);
+
+  if ( !theViewManager )
+    return;
+
+  connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
+  
+  connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
+  
+  connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
+}
+
+/*!
+  Builds popup for vtk viewer
+*/
+void
+SVTK_Viewer
+::contextMenuPopup( QMenu* thePopup )
+{
+  thePopup->addAction( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
+  thePopup->addAction( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
+
+  thePopup->addSeparator();
+
+  if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
+    if ( !aView->getMainWindow()->getToolBar()->isVisible() ){
+      thePopup->addAction( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
+    }
+    aView->RefreshDumpImage();
+  }
+}
+
+/*!
+  SLOT: called on mouse button press, empty implementation
+*/
+void 
+SVTK_Viewer
+::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event)
+{}
+
+/*!
+  SLOT: called on mouse move, empty implementation
+*/
+void 
+SVTK_Viewer
+::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event)
+{}
+
+/*!
+  SLOT: called on mouse button release, empty implementation
+*/
+void 
+SVTK_Viewer
+::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event)
+{}
+
+/*!
+  Enables/disables selection
+  \param isEnabled - new state
+*/
+void 
+SVTK_Viewer
+::enableSelection(bool isEnabled)
+{
+  mySelectionEnabled = isEnabled;
+  //!! To be done for view windows
+}
+
+/*!
+  Enables/disables selection of many object
+  \param isEnabled - new state
+*/
+void
+SVTK_Viewer
+::enableMultiselection(bool isEnable)
+{
+  myMultiSelectionEnabled = isEnable;
+  //!! To be done for view windows
+}
+
+/*!
+  SLOT: called on dump view operation is activated, stores scene to raster file
+*/
+void
+SVTK_Viewer
+::onDumpView()
+{
+  if(SUIT_ViewWindow* aView = myViewManager->getActiveView())
+    aView->onDumpView();
+}
+
+/*!
+  SLOT: called if background color is to be changed changed, passes new color to view port
+*/
+void
+SVTK_Viewer
+::onChangeBgColor()
+{
+  if(SUIT_ViewWindow* aView = myViewManager->getActiveView()){
+    QColor aColor = QColorDialog::getColor( backgroundColor(), aView);
+    setBackgroundColor(aColor);
+  }
+}
+
+/*!
+  SLOT: called when popup item "Show toolbar" is activated, shows toolbar of active view window
+*/
+void
+SVTK_Viewer
+::onShowToolbar() 
+{
+  QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+    if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))){
+      aView->getMainWindow()->getToolBar()->show();
+    }
+  }
+}
+
+/*!
+  Display presentation
+  \param prs - presentation
+*/
+void
+SVTK_Viewer
+::Display( const SALOME_VTKPrs* prs )
+{
+  // try do downcast object
+  if(const SVTK_Prs* aPrs = dynamic_cast<const SVTK_Prs*>( prs )){
+    if(aPrs->IsNull())
+      return;
+    if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){
+      // get SALOMEDS Study
+      // Temporarily commented to avoid awful dependecy on SALOMEDS
+      // TODO: better mechanism of storing display/erse status in a study
+      // should be provided...
+      // _PTR(Study) aStudy(getStudyDS());
+      anActorCollection->InitTraversal();
+      while(vtkActor* anActor = anActorCollection->GetNextActor()){
+       if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
+         // Set visibility flag
+          // Temporarily commented to avoid awful dependecy on SALOMEDS
+          // TODO: better mechanism of storing display/erse status in a study
+          // should be provided...
+         //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+         //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
+         //  ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),true,this);
+         //}
+         // just display the object
+         QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
+         for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+           if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i))){
+             if(SVTK_View* aView = aViewWindow->getView()){
+               aView->Display(anAct,false);
+               if(anAct->IsSetCamera()){
+                 vtkRenderer* aRenderer = aView->getRenderer();
+                 anAct->SetCamera( aRenderer->GetActiveCamera() );
+               }
+             }
+           }
+         }
+       }
+      }
+    }
+  }
+}
+
+/*!
+  Erase presentation
+  \param prs - presentation
+  \param forced - removes object from view
+*/
+void
+SVTK_Viewer
+::Erase( const SALOME_VTKPrs* prs, const bool forced )
+{
+  // try do downcast object
+  if(const SVTK_Prs* aPrs = dynamic_cast<const SVTK_Prs*>( prs )){
+    if(aPrs->IsNull())
+      return;
+    if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){
+      // get SALOMEDS Study
+      // Temporarily commented to avoid awful dependecy on SALOMEDS
+      // TODO: better mechanism of storing display/erse status in a study
+      // should be provided...
+      //_PTR(Study) aStudy(getStudyDS());
+      anActorCollection->InitTraversal();
+      while(vtkActor* anActor = anActorCollection->GetNextActor())
+       if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
+         // Set visibility flag
+          // Temporarily commented to avoid awful dependecy on SALOMEDS
+          // TODO: better mechanism of storing display/erse status in a study
+          // should be provided...
+         //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+         //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
+         //  ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+         //}
+         // just display the object
+         QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
+         for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+           if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
+             if(SVTK_View* aView = aViewWindow->getView())
+               if ( forced )
+                 aView->Remove(anAct,false);
+               else
+                 aView->Erase(anAct,forced);
+         }
+       }
+    }
+  }
+}
+
+/*!
+  Erase all presentations
+  \param forced - removes all objects from view
+*/
+void
+SVTK_Viewer
+::EraseAll( const bool forced )
+{
+  // Temporarily commented to avoid awful dependecy on SALOMEDS
+  // TODO: better mechanism of storing display/erse status in a study
+  // should be provided...
+  //_PTR(Study) aStudy(getStudyDS());
+  QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+    if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
+      if(SVTK_View* aView = aViewWindow->getView()){
+       vtkRenderer* aRenderer =  aView->getRenderer();
+       vtkActorCollection* anActorCollection = aRenderer->GetActors();
+       anActorCollection->InitTraversal();
+       while(vtkActor* anActor = anActorCollection->GetNextActor()){
+         if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
+           // Set visibility flag
+            // Temporarily commented to avoid awful dependecy on SALOMEDS
+            // TODO: better mechanism of storing display/erse status in a study
+            // should be provided...
+           //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+           //if(!anObj.IsNull() && anObj->hasEntry() && aStudy)
+           //  ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+           if(forced)
+             aRenderer->RemoveActor(anAct);
+           else{
+             // just erase actor
+             anAct->SetVisibility( false );
+             // erase dependent actors
+             vtkActorCollection* aCollection = vtkActorCollection::New();
+             anAct->GetChildActors( aCollection );
+             aCollection->InitTraversal();
+             while(vtkActor* aSubAct = aCollection->GetNextActor())
+               aSubAct->SetVisibility( false );
+             aCollection->Delete();
+           }
+         }
+       }
+      }
+  }
+  Repaint();
+}
+
+/*!
+  Create presentation corresponding to the entry
+  \param entry - entry
+*/
+SALOME_Prs* 
+SVTK_Viewer
+::CreatePrs( const char* entry )
+{
+  SVTK_Prs* prs = new SVTK_Prs();
+  if ( entry ) {
+    if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(getViewManager()->getActiveView()))
+      if(SVTK_View* aView = aViewWindow->getView()){
+       vtkRenderer* aRenderer =  aView->getRenderer();
+       vtkActorCollection* theActors = aRenderer->GetActors();
+       theActors->InitTraversal();
+       vtkActor* ac;
+       while( ( ac = theActors->GetNextActor() ) ) {
+         SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
+         if ( anActor && anActor->hasIO() && !strcmp( anActor->getIO()->getEntry(), entry ) ) {
+           prs->AddObject( ac );
+         }
+       }
+      }
+  }
+  return prs;
+}
+
+/*!
+  Auxiliary method called before displaying of objects
+*/
+void
+SVTK_Viewer
+::BeforeDisplay( SALOME_Displayer* d )
+{
+  d->BeforeDisplay( this, SALOME_VTKViewType() );
+}
+
+/*!
+  Auxiliary method called after displaying of objects
+*/
+void
+SVTK_Viewer::AfterDisplay( SALOME_Displayer* d )
+{
+  d->AfterDisplay( this, SALOME_VTKViewType() );
+}
+
+/*!
+  \return true if object is displayed in viewer
+  \param obj - object to be checked
+*/
+bool
+SVTK_Viewer
+::isVisible( const Handle(SALOME_InteractiveObject)& io )
+{
+  QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
+    if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
+      if(TViewWindow* aViewWnd = dynamic_cast<TViewWindow*>(aViewWindow))
+        if(SVTK_View* aView = aViewWnd->getView())
+          if(!aView->isVisible( io ))
+            return false;
+
+  return true;
+}
+
+/*!
+  Updates current viewer
+*/
+void 
+SVTK_Viewer
+::Repaint()
+{
+//  if (theUpdateTrihedron) onAdjustTrihedron();
+  QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
+    if(TViewWindow* aViewWindow = dynamic_cast<TViewWindow*>(aViews.at(i)))
+      if(SVTK_View* aView = aViewWindow->getView())
+       aView->Repaint();
+}
diff --git a/src/SVTK/SVTK_ViewModel.h b/src/SVTK/SVTK_ViewModel.h
new file mode 100644 (file)
index 0000000..db6c4d7
--- /dev/null
@@ -0,0 +1,127 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 SVTK_VIEWMODEL_H
+#define SVTK_VIEWMODEL_H
+
+#include "SVTK.h"
+#include "SVTK_ViewModelBase.h"
+
+#include "SALOME_Prs.h"
+#include "SALOME_InteractiveObject.hxx"
+
+#include <QColor>
+
+class QMouseEvent;
+
+class SVTK_ViewWindow;
+
+//! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View 
+class SVTK_EXPORT SVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View 
+{
+  Q_OBJECT;
+
+public:
+  typedef SVTK_ViewWindow TViewWindow;
+  
+  //! Define string representation of the viewer type
+  static QString Type() { return "VTKViewer"; }
+
+  SVTK_Viewer();
+  virtual ~SVTK_Viewer();
+
+  //! See #SUIT_ViewModel::createView
+  virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
+
+  //! See #SUIT_ViewModel::createView
+  virtual void setViewManager(SUIT_ViewManager* theViewManager);
+
+  //! See #SUIT_ViewModel::contextMenuPopup
+  virtual void contextMenuPopup( QMenu* );
+
+  //! See #SUIT_ViewModel::getType
+  virtual QString getType() const { return Type(); }
+
+  //! Get background color of the viewer
+  QColor backgroundColor() const;
+
+  //! Set background color to the viewer
+  void setBackgroundColor( const QColor& );
+
+  //! Get size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
+  vtkFloatingPointType trihedronSize() const;
+
+  //! Shows if the size of trihedron relative (see #SVTK_Renderer::SetTrihedronSize)
+  bool trihedronRelative() const;
+
+  //! Set size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
+  void setTrihedronSize( const vtkFloatingPointType, const bool = true );
+
+public:
+  void enableSelection(bool isEnabled);
+  bool isSelectionEnabled() const { return mySelectionEnabled; }
+
+  void enableMultiselection(bool isEnable);
+  bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
+
+  int  getSelectionCount() const;
+
+  /* Reimplemented from SALOME_View */
+
+  //! See #SALOME_View::Display( const SALOME_Prs* )
+  void Display( const SALOME_VTKPrs* ); 
+
+  //! See #SALOME_View::Erase( const SALOME_VTKPrs*, const bool = false )
+  void Erase( const SALOME_VTKPrs*, const bool = false );
+
+  //! See #SALOME_View::EraseAll( const bool = false )
+  void EraseAll( const bool = false );
+
+  //! See #SALOME_View::CreatePrs( const char* entry = 0 )
+  SALOME_Prs* CreatePrs( const char* entry = 0 );
+
+  //! See #SALOME_View::BeforeDisplay( SALOME_Displayer* d )
+  virtual void BeforeDisplay( SALOME_Displayer* d );
+
+  //! See #SALOME_View::AfterDisplay( SALOME_Displayer* d )
+  virtual void AfterDisplay( SALOME_Displayer* d );
+
+  //! See #SALOME_View::isVisible( const Handle(SALOME_InteractiveObject)& )
+  virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
+
+  //! See #SALOME_View::Repaint()
+  virtual void Repaint();
+
+protected slots:
+  void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
+  void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
+  void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
+
+  void onDumpView();
+  void onShowToolbar();
+  void onChangeBgColor();
+
+private:
+  QColor myBgColor;
+  vtkFloatingPointType myTrihedronSize;
+  bool   myTrihedronRelative;
+  bool   mySelectionEnabled;
+  bool   myMultiSelectionEnabled;
+};
+
+#endif
diff --git a/src/SVTK/SVTK_ViewModelBase.h b/src/SVTK/SVTK_ViewModelBase.h
new file mode 100644 (file)
index 0000000..49f335e
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright (C) 2005  CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// 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 SVTK_SELECTIONCHANGED_H
+#define SVTK_SELECTIONCHANGED_H
+
+#include <qobject.h>
+
+#include "SVTK.h"
+#include "SUIT_ViewModel.h"
+
+
+//! To define minimal interface for #SVTK_ViewWindow initialization
+class SVTK_EXPORT SVTK_ViewModelBase: public SUIT_ViewModel
+{
+  Q_OBJECT;
+
+public slots:
+  //! To invoke Qt #selectionChanged signal
+  void onSelectionChanged()
+  {
+    emit selectionChanged();
+  }
+
+ signals:
+  //! To declare signal on selection changed
+  void selectionChanged();
+};
+
+#endif
diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx
new file mode 100755 (executable)
index 0000000..454df63
--- /dev/null
@@ -0,0 +1,1040 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 "SALOME_Actor.h"
+
+#include <QToolBar>
+#include <QEvent>
+
+#include <vtkTextProperty.h>
+#include <vtkActorCollection.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderer.h>
+#include <vtkCamera.h>
+#include <vtkPointPicker.h>
+#include <vtkCellPicker.h>
+#include <vtkAxisActor2D.h>
+
+#include "QtxAction.h"
+
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_Accel.h"
+
+#include "SUIT_Tools.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Accel.h"
+
+#include "VTKViewer_Utilities.h"
+
+#include "SVTK_View.h"
+#include "SVTK_MainWindow.h"
+#include "SVTK_Selector.h"
+
+#include "SVTK_Event.h"
+#include "SVTK_Renderer.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_ViewModelBase.h"
+#include "SVTK_InteractorStyle.h"
+#include "SVTK_RenderWindowInteractor.h"
+#include "SVTK_GenericRenderWindowInteractor.h"
+#include "SVTK_CubeAxesActor2D.h"
+
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+
+
+namespace SVTK
+{
+  int convertAction( const int accelAction )
+  {
+    switch ( accelAction ) {
+    case SUIT_Accel::PanLeft     : return SVTK::PanLeftEvent;
+    case SUIT_Accel::PanRight    : return SVTK::PanRightEvent;
+    case SUIT_Accel::PanUp       : return SVTK::PanUpEvent;
+    case SUIT_Accel::PanDown     : return SVTK::PanDownEvent;
+    case SUIT_Accel::ZoomIn      : return SVTK::ZoomInEvent;
+    case SUIT_Accel::ZoomOut     : return SVTK::ZoomOutEvent;
+    case SUIT_Accel::RotateLeft  : return SVTK::RotateLeftEvent;
+    case SUIT_Accel::RotateRight : return SVTK::RotateRightEvent;
+    case SUIT_Accel::RotateUp    : return SVTK::RotateUpEvent;
+    case SUIT_Accel::RotateDown  : return SVTK::RotateDownEvent;  
+    }
+    return accelAction;
+  }
+}
+
+
+
+
+
+/*!
+  Constructor
+*/
+SVTK_ViewWindow
+::SVTK_ViewWindow(SUIT_Desktop* theDesktop):
+  SUIT_ViewWindow(theDesktop),
+  myMainWindow(0),
+  myView(NULL),
+  myDumpImage(QImage())
+{}
+
+/*!
+  To initialize #SVTK_ViewWindow instance
+*/
+void
+SVTK_ViewWindow
+::Initialize(SVTK_ViewModelBase* theModel)
+{
+  if(SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr()){
+    myMainWindow = new SVTK_MainWindow(this,"SVTK_MainWindow",aResourceMgr,this);
+
+    SVTK_RenderWindowInteractor* anIteractor = 
+      new SVTK_RenderWindowInteractor(myMainWindow,"SVTK_RenderWindowInteractor");
+
+    SVTK_Selector* aSelector = SVTK_Selector::New();
+
+    SVTK_GenericRenderWindowInteractor* aDevice = 
+      SVTK_GenericRenderWindowInteractor::New();
+    aDevice->SetRenderWidget(anIteractor);
+    aDevice->SetSelector(aSelector);
+
+    SVTK_Renderer* aRenderer = SVTK_Renderer::New();
+    aRenderer->Initialize(aDevice,aSelector);
+
+    anIteractor->Initialize(aDevice,aRenderer,aSelector);
+
+    aDevice->Delete();
+    aRenderer->Delete();
+    aSelector->Delete();
+
+    myMainWindow->Initialize(anIteractor);
+
+    SVTK_InteractorStyle* aStyle = SVTK_InteractorStyle::New();
+    anIteractor->PushInteractorStyle(aStyle);
+    aStyle->Delete();
+
+    setCentralWidget(myMainWindow);
+    
+    myView = new SVTK_View(myMainWindow);
+    Initialize(myView,theModel);
+
+    anIteractor->getRenderWindow()->Render();
+    myMainWindow->onResetView();
+  }
+}
+
+/*!
+  To initialize #SVTK_ViewWindow instance
+*/
+void
+SVTK_ViewWindow
+::Initialize(SVTK_View* theView,
+            SVTK_ViewModelBase* theModel)
+{
+  connect(theView,SIGNAL(KeyPressed(QKeyEvent*)),
+          this,SLOT(onKeyPressed(QKeyEvent*)) );
+  connect(theView,SIGNAL(KeyReleased(QKeyEvent*)),
+          this,SLOT(onKeyReleased(QKeyEvent*)));
+  connect(theView,SIGNAL(MouseButtonPressed(QMouseEvent*)),
+          this,SLOT(onMousePressed(QMouseEvent*)));
+  connect(theView,SIGNAL(MouseButtonReleased(QMouseEvent*)),
+          this,SLOT(onMouseReleased(QMouseEvent*)));
+  connect(theView,SIGNAL(MouseDoubleClicked(QMouseEvent*)),
+          this,SLOT(onMouseDoubleClicked(QMouseEvent*)));
+  connect(theView,SIGNAL(MouseMove(QMouseEvent*)),
+          this,SLOT(onMouseMoving(QMouseEvent*)));
+  connect(theView,SIGNAL(contextMenuRequested(QContextMenuEvent*)),
+          this,SIGNAL(contextMenuRequested(QContextMenuEvent *)));
+  connect(theView,SIGNAL(selectionChanged()),
+         theModel,SLOT(onSelectionChanged()));
+}
+
+/*!
+  Destructor
+*/
+SVTK_ViewWindow
+::~SVTK_ViewWindow()
+{}
+
+
+/*!
+  \return corresponding view
+*/
+SVTK_View* 
+SVTK_ViewWindow
+::getView() 
+{ 
+  return myView; 
+}
+
+/*!
+  \return corresponding vtk main window
+*/
+SVTK_MainWindow* 
+SVTK_ViewWindow
+::getMainWindow() 
+{ 
+  return myMainWindow; 
+}
+
+/*!
+  \return corresponding vtk render window
+*/
+vtkRenderWindow*
+SVTK_ViewWindow
+::getRenderWindow()
+{
+  return getMainWindow()->getRenderWindow();
+}
+
+/*!
+  \return corresponding vtk render window interactor
+*/
+vtkRenderWindowInteractor*
+SVTK_ViewWindow
+::getInteractor()
+{
+  return getMainWindow()->getInteractor();
+}
+
+/*!
+  \return corresponding vtk renderer
+*/
+vtkRenderer*
+SVTK_ViewWindow
+::getRenderer()
+{
+  return myMainWindow->getRenderer();
+}
+
+/*!
+  \return corresponding vtk selector
+*/
+SVTK_Selector* 
+SVTK_ViewWindow
+::GetSelector() 
+{ 
+  return myMainWindow->GetSelector(); 
+}
+
+/*!
+  Processes transformation "front view"
+*/
+void
+SVTK_ViewWindow
+::onFrontView()
+{
+  myMainWindow->onFrontView();
+}
+
+/*!
+  Processes transformation "back view"
+*/
+void
+SVTK_ViewWindow
+::onBackView()
+{
+  myMainWindow->onBackView();
+}
+
+/*!
+  Processes transformation "top view"
+*/
+void
+SVTK_ViewWindow
+::onTopView()
+{
+  myMainWindow->onTopView();
+}
+
+/*!
+  Processes transformation "bottom view"
+*/
+void
+SVTK_ViewWindow
+::onBottomView()
+{
+  myMainWindow->onBottomView();
+}
+
+/*!
+  Processes transformation "left view"
+*/
+void
+SVTK_ViewWindow
+::onLeftView()
+{
+  myMainWindow->onLeftView();
+}
+
+/*!
+  Processes transformation "right view"
+*/
+void
+SVTK_ViewWindow
+::onRightView()
+{
+  myMainWindow->onRightView();
+}
+
+/*!
+  Processes transformation "reset view": sets default orientation of viewport camera
+*/
+void
+SVTK_ViewWindow
+::onResetView()
+{
+  myMainWindow->onResetView();
+}
+
+/*!
+  Processes transformation "fit all"
+*/
+void
+SVTK_ViewWindow
+::onFitAll()
+{
+  myMainWindow->onFitAll();
+}
+
+/*!
+  SLOT: called if selection is changed
+*/
+void
+SVTK_ViewWindow
+::onSelectionChanged()
+{
+  myView->onSelectionChanged();
+}
+
+/*!
+  Change selection mode
+  \param theMode - new selection mode
+*/
+void
+SVTK_ViewWindow
+::SetSelectionMode(Selection_Mode theMode)
+{
+  myMainWindow->SetSelectionMode( theMode );
+}
+
+/*!
+  \return selection mode
+*/
+Selection_Mode
+SVTK_ViewWindow
+::SelectionMode() const
+{
+  return myMainWindow->SelectionMode();
+}
+
+/*!
+  Unhilights all objects in viewer
+*/
+void 
+SVTK_ViewWindow
+::unHighlightAll() 
+{
+  myView->unHighlightAll();
+}
+
+/*!
+  Hilights/unhilights object in viewer
+  \param theIO - object to be updated
+  \param theIsHighlight - if it is true, object will be hilighted, otherwise it will be unhilighted
+  \param theIsUpdate - update current viewer
+*/
+void
+SVTK_ViewWindow
+::highlight(const Handle(SALOME_InteractiveObject)& theIO, 
+           bool theIsHighlight, 
+           bool theIsUpdate ) 
+{
+  myView->highlight( theIO, theIsHighlight, theIsUpdate );
+}
+
+/*!
+  \return true if object is in viewer or in collector
+  \param theIO - object to be checked
+*/
+bool
+SVTK_ViewWindow
+::isInViewer( const Handle(SALOME_InteractiveObject)& theIO ) 
+{
+  return myView->isInViewer( theIO );
+}
+
+/*!
+  \return true if object is displayed in viewer
+  \param theIO - object to be checked
+*/
+bool
+SVTK_ViewWindow
+::isVisible( const Handle(SALOME_InteractiveObject)& theIO ) 
+{
+  return myView->isVisible( theIO );
+}
+
+/*!
+  Display object
+  \param theEntry - entry that corresponds to intractive objects
+*/
+Handle(SALOME_InteractiveObject)
+SVTK_ViewWindow
+::FindIObject(const char* theEntry) 
+{
+  return myView->FindIObject(theEntry);
+}
+
+/*!
+  Display object
+  \param theIO - object
+  \param theImmediatly - update viewer
+*/
+void
+SVTK_ViewWindow
+::Display(const Handle(SALOME_InteractiveObject)& theIO,
+         bool theImmediatly) 
+{
+  myView->Display(theIO,theImmediatly);
+}
+
+/*!
+  Erase object
+  \param theIO - object
+  \param theImmediatly - update viewer
+*/
+void
+SVTK_ViewWindow
+::Erase(const Handle(SALOME_InteractiveObject)& theIO,
+         bool theImmediatly) 
+{
+  myView->Erase(theIO,theImmediatly);
+}
+
+/*!
+  Display only passed object
+  \param theIO - object
+*/
+void
+SVTK_ViewWindow
+::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIO) 
+{
+  myView->DisplayOnly(theIO);
+}
+
+/*!
+  Display all objects in view
+*/
+void 
+SVTK_ViewWindow
+::DisplayAll() 
+{
+  myView->DisplayAll();
+}
+
+/*!
+  Erase all objects in view
+*/
+void 
+SVTK_ViewWindow
+::EraseAll() 
+{
+  myView->EraseAll();
+}
+
+/*!
+  Sets background color
+  \param color - new background color
+*/
+void
+SVTK_ViewWindow
+::setBackgroundColor( const QColor& color )
+{
+  myMainWindow->SetBackgroundColor( color );
+
+  QPalette palette;
+  palette.setColor(backgroundRole(), color);
+  setPalette(palette);
+}
+
+/*!
+  \return background color of viewer
+*/
+QColor
+SVTK_ViewWindow
+::backgroundColor() const
+{
+  return myMainWindow->BackgroundColor();
+}
+
+/*!
+  Updates current viewer
+*/
+void
+SVTK_ViewWindow
+::Repaint(bool theUpdateTrihedron)
+{
+  myMainWindow->Repaint( theUpdateTrihedron );
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::GetScale
+*/
+void
+SVTK_ViewWindow
+::GetScale( double theScale[3] ) 
+{
+  myMainWindow->GetScale( theScale );
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::SetScale
+*/
+void
+SVTK_ViewWindow
+::SetScale( double theScale[3] ) 
+{
+  myMainWindow->SetScale( theScale );
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::IsTrihedronDisplayed
+*/
+bool
+SVTK_ViewWindow
+::isTrihedronDisplayed()
+{
+  return myMainWindow->IsTrihedronDisplayed();
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::IsCubeAxesDisplayed
+*/
+bool
+SVTK_ViewWindow
+::isCubeAxesDisplayed()
+{
+  return myMainWindow->IsCubeAxesDisplayed();
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::OnViewTrihedron
+*/
+void 
+SVTK_ViewWindow
+::onViewTrihedron()
+{
+  myMainWindow->onViewTrihedron();
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::OnViewCubeAxes
+*/
+void
+SVTK_ViewWindow
+::onViewCubeAxes()
+{
+  myMainWindow->onViewCubeAxes();
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::GetTrihedron
+*/
+VTKViewer_Trihedron* 
+SVTK_ViewWindow::
+GetTrihedron()
+{
+  return myMainWindow->GetTrihedron();
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::GetCubeAxes
+*/
+SVTK_CubeAxesActor2D* 
+SVTK_ViewWindow
+::GetCubeAxes()
+{
+  return myMainWindow->GetCubeAxes();
+}
+
+/*!
+  \return trihedron size
+*/
+vtkFloatingPointType
+SVTK_ViewWindow
+::GetTrihedronSize() const
+{
+  return myMainWindow->GetTrihedronSize();
+}
+
+/*!
+  Sets trihedron size
+  \param theSize - new trihedron size
+  \param theRelative - trihedron relativeness
+*/
+void
+SVTK_ViewWindow
+::SetTrihedronSize(const vtkFloatingPointType theSize, const bool theRelative)
+{
+  myMainWindow->SetTrihedronSize(theSize, theRelative);
+}
+
+/*! If parameter theIsForcedUpdate is true, recalculate parameters for
+ *  trihedron and cube axes, even if trihedron and cube axes is invisible.
+ */
+void
+SVTK_ViewWindow
+::AdjustTrihedrons(const bool theIsForcedUpdate)
+{
+  myMainWindow->AdjustActors();
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::OnAdjustTrihedron
+*/
+void
+SVTK_ViewWindow
+::onAdjustTrihedron()
+{   
+  myMainWindow->onAdjustTrihedron();
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::OnAdjustCubeAxes
+*/
+void
+SVTK_ViewWindow
+::onAdjustCubeAxes()
+{   
+  myMainWindow->onAdjustCubeAxes();
+}
+
+/*!
+  Emits key pressed
+*/
+void
+SVTK_ViewWindow
+::onKeyPressed(QKeyEvent* event)
+{
+  emit keyPressed( this, event );
+}
+
+/*!
+  Emits key released
+*/
+void
+SVTK_ViewWindow
+::onKeyReleased(QKeyEvent* event)
+{
+  emit keyReleased( this, event );
+}
+
+/*!
+  Emits mouse pressed
+*/
+void
+SVTK_ViewWindow
+::onMousePressed(QMouseEvent* event)
+{
+  emit mousePressed(this, event);
+}
+
+/*!
+  Emits mouse released
+*/
+void
+SVTK_ViewWindow
+::onMouseReleased(QMouseEvent* event)
+{
+  emit mouseReleased( this, event );
+}
+
+/*!
+  Emits mouse moving
+*/
+void
+SVTK_ViewWindow
+::onMouseMoving(QMouseEvent* event)
+{
+  emit mouseMoving( this, event );
+}
+
+/*!
+  Emits mouse double clicked
+*/
+void
+SVTK_ViewWindow
+::onMouseDoubleClicked( QMouseEvent* event )
+{
+  emit mouseDoubleClicked( this, event );
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::AddActor
+*/
+void
+SVTK_ViewWindow
+::AddActor( VTKViewer_Actor* theActor, 
+           bool theUpdate )
+{
+  myMainWindow->AddActor( theActor, theUpdate );
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::RemoveActor
+*/
+void
+SVTK_ViewWindow
+::RemoveActor( VTKViewer_Actor* theActor, 
+              bool theUpdate )
+{
+  myMainWindow->RemoveActor( theActor, theUpdate );
+}
+
+/*!
+  \return QImage, containing all scene rendering in window
+*/
+QImage
+SVTK_ViewWindow
+::dumpView()
+{
+  if ( myMainWindow->getToolBar()->testAttribute(Qt::WA_UnderMouse) || myDumpImage.isNull() )
+    return myMainWindow->dumpView();
+  
+  return myDumpImage;
+}
+
+/*!
+  \refresh QImage, containing all scene rendering in window
+*/
+void SVTK_ViewWindow::RefreshDumpImage()
+{
+  myDumpImage = myMainWindow->dumpView();
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::SetSelectionProp
+*/
+void
+SVTK_ViewWindow
+::SetSelectionProp(const double& theRed, 
+                  const double& theGreen, 
+                  const double& theBlue, 
+                  const int& theWidth) 
+{
+  myView->SetSelectionProp(theRed,theGreen,theBlue,theWidth);
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::SetSelectionProp
+*/
+void
+SVTK_ViewWindow
+::SetPreselectionProp(const double& theRed, 
+                     const double& theGreen, 
+                     const double& theBlue, 
+                     const int& theWidth) 
+{
+  myView->SetPreselectionProp(theRed,theGreen,theBlue,theWidth);
+}
+
+/*!
+  Redirect the request to #SVTK_Renderer::SetSelectionTolerance
+*/
+void
+SVTK_ViewWindow
+::SetSelectionTolerance(const double& theTolNodes, 
+                       const double& theTolItems)
+{
+  myView->SetSelectionTolerance(theTolNodes,theTolItems);
+}
+
+/*!
+  Performs action
+  \param accelAction - action
+*/
+bool 
+SVTK_ViewWindow
+::action( const int accelAction  )
+{
+  if ( !myMainWindow->hasFocus() )
+    return false;
+  if ( accelAction == SUIT_Accel::ZoomFit )
+    onFitAll();
+  else {
+    int anEvent = SVTK::convertAction( accelAction );
+    myMainWindow->InvokeEvent( anEvent, 0 );
+  }
+  return true;
+}
+
+// old visual parameters had 13 values.  New format added additional 
+// 76 values for graduated axes, so both numbers are processed.
+const int nNormalParams = 13;   // number of view windows parameters excluding graduated axes params
+const int nGradAxisParams = 25; // number of parameters of ONE graduated axis (X, Y, or Z)
+const int nAllParams = nNormalParams + 3*nGradAxisParams + 1; // number of all visual parameters
+
+/*! The method returns visual parameters of a graduated axis actor (x,y,z axis of graduated axes)
+ */
+QString getGradAxisVisualParams( vtkAxisActor2D* actor )
+{
+  QString params;
+  if ( !actor )
+    return params;
+
+  // Name
+  bool isVisible = actor->GetTitleVisibility();
+  QString title ( actor->GetTitle() );
+  vtkFloatingPointType color[ 3 ];
+  int font = VTK_ARIAL;
+  int bold = 0;
+  int italic = 0;
+  int shadow = 0;
+
+  vtkTextProperty* txtProp = actor->GetTitleTextProperty();
+  if ( txtProp )
+  {
+    txtProp->GetColor( color );
+    font = txtProp->GetFontFamily();
+    bold = txtProp->GetBold();
+    italic = txtProp->GetItalic();
+    shadow = txtProp->GetShadow();
+  }
+  params.sprintf( "* Graduated Axis: * Name *%u*%s*%.2f*%.2f*%.2f*%u*%u*%u*%u", isVisible, 
+                 title.toLatin1().data(), color[0], color[1], color[2], font, bold, italic, shadow );
+
+  // Labels
+  isVisible = actor->GetLabelVisibility();
+  int labels = actor->GetNumberOfLabels();
+  int offset = actor->GetTickOffset();
+  font = VTK_ARIAL;
+  bold = false;
+  italic = false;
+  shadow = false;
+
+  txtProp = actor->GetLabelTextProperty();
+  if ( txtProp )
+  {
+    txtProp->GetColor( color );
+    font = txtProp->GetFontFamily();
+    bold = txtProp->GetBold();
+    italic = txtProp->GetItalic();
+    shadow = txtProp->GetShadow();
+  }
+  params += QString().sprintf( "* Labels *%u*%u*%u*%.2f*%.2f*%.2f*%u*%u*%u*%u", isVisible, labels, offset,  
+                              color[0], color[1], color[2], font, bold, italic, shadow );
+
+  // Tick marks
+  isVisible = actor->GetTickVisibility();
+  int length = actor->GetTickLength();
+  
+  params += QString().sprintf( "* Tick marks *%u*%u", isVisible, length );
+  
+  return params;
+}
+
+/*! The method restores visual parameters of a graduated axis actor (x,y,z axis)
+ */
+void setGradAxisVisualParams( vtkAxisActor2D* actor, const QString& params )
+{
+  if ( !actor )
+    return;
+
+  QStringList paramsLst = params.split( '*' );
+
+  if ( paramsLst.size() == nGradAxisParams ) { // altogether name, lable, ticks parameters make up 25 values
+
+    // retrieve and set name parameters
+    bool isVisible = paramsLst[2].toUShort();
+    QString title = paramsLst[3];
+    vtkFloatingPointType color[3];
+    color[0] = paramsLst[4].toDouble();
+    color[1] = paramsLst[5].toDouble();
+    color[2] = paramsLst[6].toDouble();
+    int font = paramsLst[7].toInt();
+    int bold = paramsLst[8].toInt();
+    int italic = paramsLst[9].toInt();
+    int shadow = paramsLst[10].toInt();
+
+    actor->SetTitleVisibility( isVisible );
+    actor->SetTitle( title.toLatin1() );
+    vtkTextProperty* txtProp = actor->GetTitleTextProperty();
+    if ( txtProp ) {
+      txtProp->SetColor( color );
+      txtProp->SetFontFamily( font );
+      txtProp->SetBold( bold );
+      txtProp->SetItalic( italic );
+      txtProp->SetShadow( shadow );
+    }
+
+    // retrieve and set lable parameters
+    isVisible = paramsLst[12].toUShort();
+    int labels = paramsLst[13].toInt();
+    int offset = paramsLst[14].toInt();
+    color[0] = paramsLst[15].toDouble();
+    color[1] = paramsLst[16].toDouble();
+    color[2] = paramsLst[17].toDouble();
+    font = paramsLst[18].toInt();
+    bold = paramsLst[19].toInt();
+    italic = paramsLst[20].toInt();
+    shadow = paramsLst[21].toInt();
+
+    actor->SetLabelVisibility( isVisible );
+    actor->SetNumberOfLabels( labels );
+    actor->SetTickOffset( offset );
+    txtProp = actor->GetLabelTextProperty();
+    if ( txtProp ) {
+      txtProp->SetColor( color );
+      txtProp->SetFontFamily( font );
+      txtProp->SetBold( bold );
+      txtProp->SetItalic( italic );
+      txtProp->SetShadow( shadow );
+    }
+
+    // retrieve and set tick marks properties
+    isVisible = paramsLst[23].toUShort();
+    int length = paramsLst[24].toInt();
+
+    actor->SetTickVisibility( isVisible );
+    actor->SetTickLength( length );
+  }
+}
+
+/*! The method returns the visual parameters of this view as a formated string
+ */
+QString
+SVTK_ViewWindow
+::getVisualParameters()
+{
+  double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+  
+  // save position, focal point, viewUp, scale
+  vtkCamera* camera = getRenderer()->GetActiveCamera();
+  camera->GetPosition( pos );
+  camera->GetFocalPoint( focalPnt );
+  camera->GetViewUp( viewUp );
+  parScale = camera->GetParallelScale();
+  GetScale( scale );
+
+  // Parameters are given in the following format:view position (3 digits), focal point position (3 digits)
+  // view up values (3 digits), parallel scale (1 digit), scale (3 digits, 
+  // Graduated axes parameters (X, Y, Z axes parameters)
+  QString retStr;
+  retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", 
+                 pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], 
+                 viewUp[0], viewUp[1], viewUp[2], parScale, scale[0], scale[1], scale[2] );
+
+  // save graduated axes parameters
+  if ( SVTK_CubeAxesActor2D* gradAxesActor = GetCubeAxes() ) {
+    retStr += QString( "*%1" ).arg( getMainWindow()->IsCubeAxesDisplayed() );
+    retStr += ::getGradAxisVisualParams( gradAxesActor->GetXAxisActor2D() );
+    retStr += ::getGradAxisVisualParams( gradAxesActor->GetYAxisActor2D() );
+    retStr += ::getGradAxisVisualParams( gradAxesActor->GetZAxisActor2D() );
+  }
+
+  return retStr;
+}
+
+/*!
+  The method restores visual parameters of this view or postpones it untill the view is shown
+*/
+void
+SVTK_ViewWindow
+::setVisualParameters( const QString& parameters )
+{
+  SVTK_RenderWindowInteractor* anInteractor = getMainWindow()->GetInteractor();
+  if ( anInteractor->isVisible() ) {
+    doSetVisualParameters( parameters ); 
+  }
+  else {
+    myVisualParams = parameters;
+    anInteractor->installEventFilter(this);
+  }
+}
+
+/*!
+  The method restores visual parameters of this view from a formated string
+*/
+void
+SVTK_ViewWindow
+::doSetVisualParameters( const QString& parameters )
+{
+  QStringList paramsLst = parameters.split( '*' );
+  if ( paramsLst.size() >= nNormalParams ) {
+    // 'reading' list of parameters
+    double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
+    pos[0] = paramsLst[0].toDouble();
+    pos[1] = paramsLst[1].toDouble();
+    pos[2] = paramsLst[2].toDouble();
+    focalPnt[0] = paramsLst[3].toDouble();
+    focalPnt[1] = paramsLst[4].toDouble();
+    focalPnt[2] = paramsLst[5].toDouble();
+    viewUp[0] = paramsLst[6].toDouble();
+    viewUp[1] = paramsLst[7].toDouble();
+    viewUp[2] = paramsLst[8].toDouble();
+    parScale = paramsLst[9].toDouble();
+    scale[0] = paramsLst[10].toDouble();
+    scale[1] = paramsLst[11].toDouble();
+    scale[2] = paramsLst[12].toDouble();
+    
+    // applying parameters
+    vtkCamera* camera = getRenderer()->GetActiveCamera();
+    camera->SetPosition( pos );
+    camera->SetFocalPoint( focalPnt );
+    camera->SetViewUp( viewUp );
+    camera->SetParallelScale( parScale );
+    SetScale( scale );
+
+    // apply graduated axes parameters
+    SVTK_CubeAxesActor2D* gradAxesActor = GetCubeAxes();
+    if ( gradAxesActor && paramsLst.size() == nAllParams ) {
+      
+      int i = nNormalParams+1, j = i + nGradAxisParams - 1;
+      ::setGradAxisVisualParams( gradAxesActor->GetXAxisActor2D(), parameters.section( '*', i, j ) ); 
+      i = j + 1; j += nGradAxisParams;
+      ::setGradAxisVisualParams( gradAxesActor->GetYAxisActor2D(), parameters.section( '*', i, j ) ); 
+      i = j + 1; j += nGradAxisParams;
+      ::setGradAxisVisualParams( gradAxesActor->GetZAxisActor2D(), parameters.section( '*', i, j ) ); 
+
+      if ( paramsLst[13].toUShort() )
+       gradAxesActor->VisibilityOn();
+      else
+       gradAxesActor->VisibilityOff();
+    }
+  }
+}
+
+
+/*!
+  Delayed setVisualParameters
+*/
+bool SVTK_ViewWindow::eventFilter( QObject* theWatched, QEvent* theEvent )
+{
+  if ( theEvent->type() == QEvent::Show && theWatched->inherits( "SVTK_RenderWindowInteractor" ) ) {
+    SVTK_RenderWindowInteractor* anInteractor = (SVTK_RenderWindowInteractor*)theWatched;
+    if ( anInteractor->isVisible() ) {
+      doSetVisualParameters( myVisualParams );
+      anInteractor->removeEventFilter( this ); // theWatched = RenderWindowInteractor
+    }
+  }
+  return SUIT_ViewWindow::eventFilter( theWatched, theEvent );
+}
diff --git a/src/SVTK/SVTK_ViewWindow.h b/src/SVTK/SVTK_ViewWindow.h
new file mode 100755 (executable)
index 0000000..86c46a1
--- /dev/null
@@ -0,0 +1,370 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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 SVTK_VIEWWINDOW_H
+#define SVTK_VIEWWINDOW_H
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+#include "SVTK.h"
+#include "SVTK_Selection.h"
+#include "SUIT_ViewWindow.h"
+
+#include "SALOME_InteractiveObject.hxx"
+
+#include <QImage>
+
+class SUIT_Desktop;
+
+class VTKViewer_Actor;
+class VTKViewer_Trihedron;
+
+class SVTK_ViewModelBase;
+class SVTK_MainWindow;
+class SVTK_Selector;
+class SVTK_View;
+
+class SVTK_CubeAxesActor2D;
+
+class vtkRenderer;
+class vtkRenderWindow;
+class vtkRenderWindowInteractor;
+
+namespace SVTK
+{
+  SVTK_EXPORT
+    int convertAction( const int );
+}
+
+//! Define a container for SALOME VTK view window
+class SVTK_EXPORT SVTK_ViewWindow : public SUIT_ViewWindow
+{
+  Q_OBJECT;
+
+ public:
+  //! To construct #SVTK_ViewWindow instance
+  SVTK_ViewWindow(SUIT_Desktop* theDesktop);
+
+  virtual
+  ~SVTK_ViewWindow();
+  
+  //! To initialize #SVTK_ViewWindow instance
+  virtual
+  void
+  Initialize(SVTK_ViewModelBase* theModel);
+
+  //! Get #SVTK_View
+  SVTK_View* 
+  getView();
+
+  //! Get #SVTK_MainWindow
+  SVTK_MainWindow* 
+  getMainWindow();
+
+  //! Redirect the request to #SVTK_MainWindow::getRenderWindow
+  vtkRenderWindow* 
+  getRenderWindow();
+
+  //! Redirect the request to #SVTK_MainWindow::getInteractor
+  vtkRenderWindowInteractor*
+  getInteractor();
+
+  //! Redirect the request to #SVTK_MainWindow::getRenderer 
+  vtkRenderer* 
+  getRenderer();
+
+  //! Redirect the request to #SVTK_MainWindow::GetSelector 
+  SVTK_Selector* 
+  GetSelector();
+  
+  //! Redirect the request to #SVTK_Selector::SelectionMode
+  Selection_Mode
+  SelectionMode() const;
+  
+  //! Change selection mode
+  virtual
+  void
+  SetSelectionMode(Selection_Mode theMode);
+
+  //! Redirect the request to #SVTK_MainWindow::SetBackgroundColor 
+  virtual
+  void
+  setBackgroundColor( const QColor& );
+
+  //! Redirect the request to #SVTK_MainWindow::SetBackgroundColor 
+  QColor
+  backgroundColor() const;
+
+  //! Redirect the request to #SVTK_Renderer::IsTrihedronDisplayed
+  bool
+  isTrihedronDisplayed();
+
+  //! Redirect the request to #SVTK_Renderer::IsCubeAxesDisplayed
+  bool
+  isCubeAxesDisplayed();
+  /*  interactive object management */
+  //! Redirect the request to #SVTK_View::highlight (to support old code)
+  virtual
+  void
+  highlight(const Handle(SALOME_InteractiveObject)& theIO, 
+           bool theIsHighlight = true, 
+           bool theIsUpdate = true);
+
+  //! Redirect the request to #SVTK_View::unHighlightAll (to support old code)
+  virtual
+  void
+  unHighlightAll();
+
+  //! Redirect the request to #SVTK_View::isInViewer (to support old code)
+  bool
+  isInViewer(const Handle(SALOME_InteractiveObject)& theIObject);
+
+  //! Redirect the request to #SVTK_View::isVisible (to support old code)
+  bool
+  isVisible(const Handle(SALOME_InteractiveObject)& theIObject);
+
+  //! Redirect the request to #SVTK_View::FindIObject (to support old code)
+  //----------------------------------------------------------------------------
+  Handle(SALOME_InteractiveObject) 
+  FindIObject(const char* theEntry);
+  
+  /* display */                
+  //----------------------------------------------------------------------------
+  //! Redirect the request to #SVTK_View::Display (to support old code)
+  virtual
+  void
+  Display(const Handle(SALOME_InteractiveObject)& theIObject,
+         bool theImmediatly = true);
+
+  //! Redirect the request to #SVTK_View::DisplayOnly (to support old code)
+  virtual
+  void
+  DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject);
+
+  //! Redirect the request to #SVTK_View::Erase (to support old code)
+  virtual
+  void
+  Erase(const Handle(SALOME_InteractiveObject)& theIObject,
+       bool theImmediatly = true);
+
+  //! Redirect the request to #SVTK_View::DisplayAll (to support old code)
+  virtual
+  void 
+  DisplayAll();
+
+  //! Redirect the request to #SVTK_View::EraseAll (to support old code)
+  virtual
+  void 
+  EraseAll();
+
+  //! To repaint the viewer
+  virtual
+  void
+  Repaint(bool theUpdateTrihedron = true);
+
+  //----------------------------------------------------------------------------
+  //! Redirect the request to #SVTK_Renderer::SetScale
+  virtual
+  void 
+  SetScale( double theScale[3] );
+
+  //! Redirect the request to #SVTK_Renderer::GetScale
+  virtual
+  void
+  GetScale( double theScale[3] );
+
+  //! Redirect the request to #SVTK_Renderer::AddActor
+  virtual
+  void
+  AddActor(VTKViewer_Actor* theActor,
+          bool theIsUpdate = false);
+
+  //! Redirect the request to #SVTK_Renderer::RemoveActor
+  virtual
+  void
+  RemoveActor(VTKViewer_Actor* theActor,
+             bool theIsUpdate = false);
+
+  //----------------------------------------------------------------------------
+  //! Redirect the request to #SVTK_Renderer::AdjustActors
+  virtual
+  void
+  AdjustTrihedrons(const bool theIsForced);
+
+  //! Redirect the request to #SVTK_Renderer::GetTrihedron
+  VTKViewer_Trihedron*  
+  GetTrihedron();
+
+  //! Redirect the request to #SVTK_Renderer::GetCubeAxes
+  SVTK_CubeAxesActor2D* 
+  GetCubeAxes();
+
+  //! Redirect the request to #SVTK_Renderer::GetTrihedronSize
+  vtkFloatingPointType  
+  GetTrihedronSize() const;
+
+  //! Redirect the request to #SVTK_Renderer::SetTrihedronSize
+  virtual
+  void 
+  SetTrihedronSize( const vtkFloatingPointType, const bool = true );
+
+  //! Redirect the request to #SVTK_Renderer::SetSelectionProp
+  virtual
+  void
+  SetSelectionProp(const double& theRed = 1, 
+                  const double& theGreen = 1,
+                  const double& theBlue = 0, 
+                  const int& theWidth = 5);
+
+  //! Redirect the request to #SVTK_Renderer::SetPreselectionProp
+  virtual
+  void
+  SetPreselectionProp(const double& theRed = 0, 
+                     const double& theGreen = 1,
+                     const double& theBlue = 1, 
+                     const int& theWidth = 5);
+
+  //! Redirect the request to #SVTK_Renderer::SetSelectionTolerance
+  virtual
+  void
+  SetSelectionTolerance(const double& theTolNodes = 0.025, 
+                       const double& theTolCell = 0.001);
+
+  //! Methods to save/restore visual parameters of a view (pan, zoom, etc.)
+  virtual 
+  QString   
+  getVisualParameters();
+  
+  virtual
+  void
+  setVisualParameters( const QString& parameters );
+
+  virtual
+  bool
+  eventFilter( QObject*, QEvent* );
+
+  virtual
+  void RefreshDumpImage();
+  
+public slots:
+  virtual
+  void
+  onSelectionChanged();
+
+signals:
+ void selectionChanged();
+
+public slots:
+  //! Redirect the request to #SVTK_Renderer::OnFrontView
+  virtual
+  void
+  onFrontView(); 
+
+  //! Redirect the request to #SVTK_Renderer::OnBackView
+  virtual
+  void
+  onBackView(); 
+
+  //! Redirect the request to #SVTK_Renderer::OnTopView
+  virtual
+  void
+  onTopView();
+
+  //! Redirect the request to #SVTK_Renderer::OnBottomView
+  virtual
+  void
+  onBottomView();
+
+  //! Redirect the request to #SVTK_Renderer::OnRightView
+  virtual
+  void 
+  onRightView(); 
+
+  //! Redirect the request to #SVTK_Renderer::OnLeftView
+  virtual
+  void 
+  onLeftView();     
+
+  //! Redirect the request to #SVTK_Renderer::OnResetView
+  virtual
+  void
+  onResetView();     
+
+  //! Redirect the request to #SVTK_Renderer::OnFitAll
+  virtual
+  void 
+  onFitAll();
+
+  //! Redirect the request to #SVTK_Renderer::OnViewTrihedron
+  virtual
+  void
+  onViewTrihedron(); 
+
+  //! Redirect the request to #SVTK_Renderer::OnViewCubeAxes
+  virtual
+  void
+  onViewCubeAxes();
+
+  //! Redirect the request to #SVTK_Renderer::OnAdjustTrihedron
+  virtual
+  void
+  onAdjustTrihedron();
+
+  //! Redirect the request to #SVTK_Renderer::OnAdjustCubeAxes
+  virtual
+  void 
+  onAdjustCubeAxes();
+
+protected slots:
+  void onKeyPressed(QKeyEvent* event);
+  void onKeyReleased(QKeyEvent* event);
+  void onMousePressed(QMouseEvent* event);
+  void onMouseDoubleClicked(QMouseEvent* event);
+  void onMouseReleased(QMouseEvent* event);
+  void onMouseMoving(QMouseEvent* event);
+
+protected:
+  virtual
+  void
+  Initialize(SVTK_View* theView,
+            SVTK_ViewModelBase* theModel);
+
+  void
+  doSetVisualParameters( const QString& );
+
+  QImage dumpView();
+  virtual bool action( const int );
+  
+  SVTK_View* myView;
+  SVTK_MainWindow* myMainWindow;
+  SVTK_ViewModelBase* myModel;
+
+  QString myVisualParams; // used for delayed setting of view parameters 
+
+private:
+  QImage myDumpImage;
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif
diff --git a/src/SVTK/resources/SVTK_images.po b/src/SVTK/resources/SVTK_images.po
new file mode 100644 (file)
index 0000000..cb7df86
--- /dev/null
@@ -0,0 +1,43 @@
+#  VISU VISUGUI : GUI of VISU component
+#
+#  Copyright (C) 2003  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
+#
+#
+#
+#  File   : 
+#  Module : 
+
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
+"PO-Revision-Date: 2005-05-10 15:20+0400\n"
+"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+
+msgid "ICON_SVTK_SCALING"
+msgstr "view_scaling.png"
+
+msgid "ICON_GRADUATED_AXES"
+msgstr "view_graduated_axes.png"
+
+msgid "ICON_UPDATE_RATE"
+msgstr "view_update_rate.png"
diff --git a/src/SVTK/resources/SVTK_images.ts b/src/SVTK/resources/SVTK_images.ts
new file mode 100644 (file)
index 0000000..403d572
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>@default</name>
+    <message>
+        <source>ICON_GRADUATED_AXES</source>
+        <translation>view_graduated_axes.png</translation>
+    </message>
+    <message>
+        <source>ICON_SVTK_SCALING</source>
+        <translation>view_scaling.png</translation>
+    </message>
+    <message>
+        <source>ICON_UPDATE_RATE</source>
+        <translation>view_update_rate.png</translation>
+    </message>
+</context>
+</TS>
diff --git a/src/SVTK/resources/SVTK_msg_en.po b/src/SVTK/resources/SVTK_msg_en.po
new file mode 100755 (executable)
index 0000000..609f62c
--- /dev/null
@@ -0,0 +1,316 @@
+#  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+#
+#  Copyright (C) 2003  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
+#
+#
+#
+#  File   : SALOMEGUI_msg_en.po
+#  Module : SALOME
+
+msgid ""
+msgstr ""
+"Project-Id-Version: example-Qt-message-extraction\n"
+"POT-Creation-Date: 1999-02-23 15:38+0200\n"
+"PO-Revision-Date: 2005-05-31 13:25+0400\n"
+"Last-Translator: \n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+msgid "LBL_TOOLBAR_LABEL"
+msgstr "View Operations"
+
+msgid "DSC_FRONT_VIEW"
+msgstr "Front View"
+
+msgid "MNU_FRONT_VIEW"
+msgstr "Front"
+
+msgid "DSC_BACK_VIEW"
+msgstr "Back View"
+
+msgid "MNU_BACK_VIEW"
+msgstr "Back"
+
+msgid "DSC_TOP_VIEW"
+msgstr "Top View"
+
+msgid "MNU_TOP_VIEW"
+msgstr "Top"
+
+msgid "DSC_BOTTOM_VIEW"
+msgstr "Bottom View"
+
+msgid "MNU_BOTTOM_VIEW"
+msgstr "Bottom"
+
+msgid "DSC_LEFT_VIEW"
+msgstr "Left View"
+
+msgid "MNU_LEFT_VIEW"
+msgstr "Left"
+
+msgid "DSC_RIGHT_VIEW"
+msgstr "Right View"
+
+msgid "MNU_RIGHT_VIEW"
+msgstr "Right"
+
+msgid "DSC_RESET_VIEW"
+msgstr "Reset View Point"
+
+msgid "MNU_RESET_VIEW"
+msgstr "Reset"
+
+msgid "DSC_FITALL"
+msgstr "Fit all objects inside the view frame"
+
+msgid "MNU_FITALL"
+msgstr "Fit All"
+
+msgid "DSC_FITRECT"
+msgstr "Fit area within the view frame"
+
+msgid "MNU_FITRECT"
+msgstr "Fit Area"
+
+msgid "DSC_ZOOM_VIEW"
+msgstr "Zoom the view"
+
+msgid "MNU_ZOOM_VIEW"
+msgstr "Zoom"
+
+msgid "DSC_PAN_VIEW"
+msgstr "Panning the view"
+
+msgid "MNU_PAN_VIEW"
+msgstr "Panning"
+
+msgid "DSC_GLOBALPAN_VIEW"
+msgstr "Selection of a new center of the view"
+
+msgid "MNU_GLOBALPAN_VIEW"
+msgstr "Global Panning"
+
+msgid "DSC_ROTATE_VIEW"
+msgstr "Rotation of the point of view around the scene center"
+
+msgid "MNU_ROTATE_VIEW"
+msgstr "Rotation"
+
+msgid "DSC_CHANGINGROTATIONPOINT_VIEW"
+msgstr "Change the point, around which the rotation is performed"
+
+msgid "MNU_CHANGINGROTATIONPOINT_VIEW"
+msgstr "Change Rotation Point"
+
+msgid "DSC_DUMP_VIEW"
+msgstr "Saves the active view in the image file"
+
+msgid "MNU_DUMP_VIEW"
+msgstr "Dump view..."
+
+msgid "VTK_IMAGE_FILES"
+msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)"
+
+msgid "INF_APP_DUMP_VIEW"
+msgstr "Dump view"
+
+msgid "ERR_DOC_CANT_SAVE_FILE"
+msgstr "Cannot save file"
+
+msgid "ERROR"
+msgstr "Error"
+
+msgid "SVTK_Viewer::MEN_DUMP_VIEW"
+msgstr "Dump view..."
+
+msgid "SVTK_Viewer::MEN_SHOW_TOOLBAR"
+msgstr "Show toolbar"
+
+msgid "SVTK_Viewer::MEN_CHANGE_BACKGROUD"
+msgstr "Change background..."
+
+msgid "SVTK_ViewManager::VTK_VIEW_TITLE"
+msgstr "VTK scene:%1 - viewer:%2"
+
+msgid "MNU_SHOW_TRIHEDRON"
+msgstr "Show/Hide trihedron"
+
+msgid "DSC_SHOW_TRIHEDRON"
+msgstr "Show/Hide trihedron in the current view"
+
+msgid "SVTK_NonIsometricDlg::MEN_SCALING"
+msgstr "Scaling"
+
+msgid "SVTK_NonIsometricDlg::O&K"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::&Apply"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::&Cancel"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::&Reset"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::DLG_TITLE"
+msgstr "Scaling"
+
+msgid "SVTK_NonIsometricDlg::LBL_X"
+msgstr "X :"
+
+msgid "SVTK_NonIsometricDlg::LBL_Y"
+msgstr "Y :"
+
+msgid "SVTK_NonIsometricDlg::LBL_Z"
+msgstr "Z :"
+
+msgid "SVTK_MainWindow::MNU_SVTK_SCALING"
+msgstr "Scaling"
+
+msgid "SVTK_MainWindow::DSC_SVTK_SCALING"
+msgstr "Scaling"
+
+msgid "SVTK_SetRotationPointDlg::DLG_TITLE"
+msgstr "Set Rotation Point"
+
+msgid "SVTK_SetRotationPointDlg::USE_BBCENTER"
+msgstr "Use Bounding Box Center"
+
+msgid "SVTK_SetRotationPointDlg::LBL_TOORIGIN"
+msgstr "Set to Origin"
+
+msgid "SVTK_SetRotationPointDlg::LBL_SELECTPOINT"
+msgstr "Select Point from View"
+
+msgid "SVTK_SetRotationPointDlg::LBL_CENTER_OF_BOUNDING_BOX"
+msgstr "Center of bounding box"
+
+msgid "SVTK_SetRotationPointDlg::LBL_ORIGIN"
+msgstr "Origin of the coordinate system"
+
+msgid "SVTK_SetRotationPointDlg::LBL_SELECTED_POINT"
+msgstr "Selected point"
+
+msgid "SVTK_SetRotationPointDlg::LBL_X"
+msgstr "X :"
+
+msgid "SVTK_SetRotationPointDlg::LBL_Y"
+msgstr "Y :"
+
+msgid "SVTK_SetRotationPointDlg::LBL_Z"
+msgstr "Z :"
+
+msgid "SVTK_SetRotationPointDlg::RBUTTONGROUP_TITLE"
+msgstr "The rotation point type"
+
+msgid "SVTK_FontWidget::ARIAL"
+msgstr "Arial"
+
+msgid "SVTK_FontWidget::COURIER"
+msgstr "Courier"
+
+msgid "SVTK_FontWidget::TIMES"
+msgstr "Times"
+
+msgid "SVTK_FontWidget::BOLD"
+msgstr "Bold"
+
+msgid "SVTK_FontWidget::ITALIC"
+msgstr "Italic"
+
+msgid "SVTK_FontWidget::SHADOW"
+msgstr "Shadow"
+
+msgid "SVTK_CubeAxesDlg::CAPTION"
+msgstr "Graduated axes"
+
+msgid "SVTK_CubeAxesDlg::X_AXIS"
+msgstr "X axis"
+
+msgid "SVTK_CubeAxesDlg::Y_AXIS"
+msgstr "Y axis"
+
+msgid "SVTK_CubeAxesDlg::Z_AXIS"
+msgstr "Z axis"
+
+msgid "SVTK_CubeAxesDlg::IS_VISIBLE"
+msgstr "Is visible"
+
+msgid "SVTK_AxisWidget::AXIS_NAME"
+msgstr "Axis name"
+
+msgid "SVTK_AxisWidget::IS_VISIBLE"
+msgstr "Is visible"
+
+msgid "SVTK_AxisWidget::NAME"
+msgstr "Name"
+
+msgid "SVTK_AxisWidget::FONT"
+msgstr "Font"
+
+msgid "SVTK_AxisWidget::LABELS"
+msgstr "Labels"
+
+msgid "SVTK_AxisWidget::NUMBER"
+msgstr "Number"
+
+msgid "SVTK_AxisWidget::OFFSET"
+msgstr "Offset"
+
+msgid "SVTK_AxisWidget::TICK_MARKS"
+msgstr "Tick marks"
+
+msgid "SVTK_AxisWidget::LENGTH"
+msgstr "Length"
+
+msgid "SVTK_MainWindow::MNU_SVTK_GRADUATED_AXES"
+msgstr "Graduated axes"
+
+msgid "SVTK_MainWindow::DSC_SVTK_GRADUATED_AXES"
+msgstr "Graduated axes"
+
+msgid "SVTK_MainWindow::MNU_SVTK_UPDATE_RATE"
+msgstr "Update rate"
+
+msgid "SVTK_MainWindow::DSC_SVTK_UPDATE_RATE"
+msgstr "Update rate"
+
+msgid "SVTK_UpdateRateDlg::DLG_TITLE"
+msgstr "Update Rate"
+
+msgid "SVTK_UpdateRateDlg::INPUT_FRAME_TITLE"
+msgstr "Enable"
+
+msgid "SVTK_UpdateRateDlg::DESIRED"
+msgstr "Desired Update Rate, FPS"
+
+msgid "SVTK_UpdateRateDlg::STILL"
+msgstr "Still Update Rate, FPS"
+
+msgid "SVTK_UpdateRateDlg::INFORMATION_FRAME_TITLE"
+msgstr "Rendering Metrics"
+
+msgid "SVTK_UpdateRateDlg::CURRENT_FPS"
+msgstr "Current Update Rate, FPS"
+
+msgid "SVTK_UpdateRateDlg::NUMBER_CELLS"
+msgstr "Number of Cells, -"
+
diff --git a/src/SVTK/resources/SVTK_msg_en.ts b/src/SVTK/resources/SVTK_msg_en.ts
new file mode 100644 (file)
index 0000000..e04b91d
--- /dev/null
@@ -0,0 +1,392 @@
+<!DOCTYPE TS><TS>
+<context>
+    <name>@default</name>
+    <message>
+        <source>MNU_FRONT_VIEW</source>
+        <translation>Front</translation>
+    </message>
+    <message>
+        <source>ERROR</source>
+        <translation>Error</translation>
+    </message>
+    <message>
+        <source>MNU_DUMP_VIEW</source>
+        <translation>Dump view...</translation>
+    </message>
+    <message>
+        <source>DSC_TOP_VIEW</source>
+        <translation>Top View</translation>
+    </message>
+    <message>
+        <source>MNU_PAN_VIEW</source>
+        <translation>Panning</translation>
+    </message>
+    <message>
+        <source>MNU_TOP_VIEW</source>
+        <translation>Top</translation>
+    </message>
+    <message>
+        <source>DSC_GLOBALPAN_VIEW</source>
+        <translation>Selection of a new center of the view</translation>
+    </message>
+    <message>
+        <source>DSC_ROTATE_VIEW</source>
+        <translation>Rotation of the point of view around the scene center</translation>
+    </message>
+    <message>
+        <source>MNU_ZOOM_VIEW</source>
+        <translation>Zoom</translation>
+    </message>
+    <message>
+        <source>DSC_PAN_VIEW</source>
+        <translation>Panning the view</translation>
+    </message>
+    <message>
+        <source>DSC_LEFT_VIEW</source>
+        <translation>Left View</translation>
+    </message>
+    <message>
+        <source>DSC_FITALL</source>
+        <translation>Fit all objects inside the view frame</translation>
+    </message>
+    <message>
+        <source>MNU_FITALL</source>
+        <translation>Fit All</translation>
+    </message>
+    <message>
+        <source>MNU_ROTATE_VIEW</source>
+        <translation>Rotation</translation>
+    </message>
+    <message>
+        <source>DSC_SHOW_TRIHEDRON</source>
+        <translation>Show/Hide trihedron in the current view</translation>
+    </message>
+    <message>
+        <source>DSC_FRONT_VIEW</source>
+        <translation>Front View</translation>
+    </message>
+    <message>
+        <source>MNU_GLOBALPAN_VIEW</source>
+        <translation>Global Panning</translation>
+    </message>
+    <message>
+        <source>INF_APP_DUMP_VIEW</source>
+        <translation>Dump view</translation>
+    </message>
+    <message>
+        <source>MNU_BACK_VIEW</source>
+        <translation>Back</translation>
+    </message>
+    <message>
+        <source>MNU_SHOW_TRIHEDRON</source>
+        <translation>Show/Hide trihedron</translation>
+    </message>
+    <message>
+        <source>DSC_CHANGINGROTATIONPOINT_VIEW</source>
+        <translation>Change the point, around which the rotation is performed</translation>
+    </message>
+    <message>
+        <source>MNU_BOTTOM_VIEW</source>
+        <translation>Bottom</translation>
+    </message>
+    <message>
+        <source>MNU_RESET_VIEW</source>
+        <translation>Reset</translation>
+    </message>
+    <message>
+        <source>MNU_LEFT_VIEW</source>
+        <translation>Left</translation>
+    </message>
+    <message>
+        <source>DSC_RIGHT_VIEW</source>
+        <translation>Right View</translation>
+    </message>
+    <message>
+        <source>MNU_CHANGINGROTATIONPOINT_VIEW</source>
+        <translation>Change Rotation Point</translation>
+    </message>
+    <message>
+        <source>DSC_FITRECT</source>
+        <translation>Fit area within the view frame</translation>
+    </message>
+    <message>
+        <source>MNU_FITRECT</source>
+        <translation>Fit Area</translation>
+    </message>
+    <message>
+        <source>DSC_BOTTOM_VIEW</source>
+        <translation>Bottom View</translation>
+    </message>
+    <message>
+        <source>DSC_DUMP_VIEW</source>
+        <translation>Saves the active view in the image file</translation>
+    </message>
+    <message>
+        <source>DSC_ZOOM_VIEW</source>
+        <translation>Zoom the view</translation>
+    </message>
+    <message>
+        <source>VTK_IMAGE_FILES</source>
+        <translation>Images Files (*.bmp *.png *.jpg *.jpeg)</translation>
+    </message>
+    <message>
+        <source>DSC_RESET_VIEW</source>
+        <translation>Reset View Point</translation>
+    </message>
+    <message>
+        <source>ERR_DOC_CANT_SAVE_FILE</source>
+        <translation>Cannot save file</translation>
+    </message>
+    <message>
+        <source>MNU_RIGHT_VIEW</source>
+        <translation>Right</translation>
+    </message>
+    <message>
+        <source>LBL_TOOLBAR_LABEL</source>
+        <translation>View Operations</translation>
+    </message>
+    <message>
+        <source>DSC_BACK_VIEW</source>
+        <translation>Back View</translation>
+    </message>
+</context>
+<context>
+    <name>SVTK_AxisWidget</name>
+    <message>
+        <source>FONT</source>
+        <translation>Font</translation>
+    </message>
+    <message>
+        <source>NAME</source>
+        <translation>Name</translation>
+    </message>
+    <message>
+        <source>TICK_MARKS</source>
+        <translation>Tick marks</translation>
+    </message>
+    <message>
+        <source>LABELS</source>
+        <translation>Labels</translation>
+    </message>
+    <message>
+        <source>LENGTH</source>
+        <translation>Length</translation>
+    </message>
+    <message>
+        <source>NUMBER</source>
+        <translation>Number</translation>
+    </message>
+    <message>
+        <source>OFFSET</source>
+        <translation>Offset</translation>
+    </message>
+    <message>
+        <source>IS_VISIBLE</source>
+        <translation>Is visible</translation>
+    </message>
+    <message>
+        <source>AXIS_NAME</source>
+        <translation>Axis name</translation>
+    </message>
+</context>
+<context>
+    <name>SVTK_CubeAxesDlg</name>
+    <message>
+        <source>X_AXIS</source>
+        <translation>X axis</translation>
+    </message>
+    <message>
+        <source>Y_AXIS</source>
+        <translation>Y axis</translation>
+    </message>
+    <message>
+        <source>Z_AXIS</source>
+        <translation>Z axis</translation>
+    </message>
+    <message>
+        <source>CAPTION</source>
+        <translation>Graduated axes</translation>
+    </message>
+    <message>
+        <source>IS_VISIBLE</source>
+        <translation>Is visible</translation>
+    </message>
+</context>
+<context>
+    <name>SVTK_FontWidget</name>
+    <message>
+        <source>BOLD</source>
+        <translation>Bold</translation>
+    </message>
+    <message>
+        <source>ARIAL</source>
+        <translation>Arial</translation>
+    </message>
+    <message>
+        <source>TIMES</source>
+        <translation>Times</translation>
+    </message>
+    <message>
+        <source>ITALIC</source>
+        <translation>Italic</translation>
+    </message>
+    <message>
+        <source>SHADOW</source>
+        <translation>Shadow</translation>
+    </message>
+    <message>
+        <source>COURIER</source>
+        <translation>Courier</translation>
+    </message>
+</context>
+<context>
+    <name>SVTK_MainWindow</name>
+    <message>
+        <source>DSC_SVTK_UPDATE_RATE</source>
+        <translation>Update rate</translation>
+    </message>
+    <message>
+        <source>DSC_SVTK_SCALING</source>
+        <translation>Scaling</translation>
+    </message>
+    <message>
+        <source>MNU_SVTK_SCALING</source>
+        <translation>Scaling</translation>
+    </message>
+    <message>
+        <source>MNU_SVTK_GRADUATED_AXES</source>
+        <translation>Graduated axes</translation>
+    </message>
+    <message>
+        <source>DSC_SVTK_GRADUATED_AXES</source>
+        <translation>Graduated axes</translation>
+    </message>
+    <message>
+        <source>MNU_SVTK_UPDATE_RATE</source>
+        <translation>Update rate</translation>
+    </message>
+</context>
+<context>
+    <name>SVTK_NonIsometricDlg</name>
+    <message>
+        <source>LBL_X</source>
+        <translation>X :</translation>
+    </message>
+    <message>
+        <source>LBL_Y</source>
+        <translation>Y :</translation>
+    </message>
+    <message>
+        <source>LBL_Z</source>
+        <translation>Z :</translation>
+    </message>
+    <message>
+        <source>MEN_SCALING</source>
+        <translation>Scaling</translation>
+    </message>
+    <message>
+        <source>DLG_TITLE</source>
+        <translation>Scaling</translation>
+    </message>
+</context>
+<context>
+    <name>SVTK_SetRotationPointDlg</name>
+    <message>
+        <source>LBL_X</source>
+        <translation>X :</translation>
+    </message>
+    <message>
+        <source>LBL_Y</source>
+        <translation>Y :</translation>
+    </message>
+    <message>
+        <source>LBL_Z</source>
+        <translation>Z :</translation>
+    </message>
+    <message>
+        <source>LBL_CENTER_OF_BOUNDING_BOX</source>
+        <translation>Center of bounding box</translation>
+    </message>
+    <message>
+        <source>RBUTTONGROUP_TITLE</source>
+        <translation>The rotation point type</translation>
+    </message>
+    <message>
+        <source>USE_BBCENTER</source>
+        <translation>Use Bounding Box Center</translation>
+    </message>
+    <message>
+        <source>LBL_ORIGIN</source>
+        <translation>Origin of the coordinate system</translation>
+    </message>
+    <message>
+        <source>LBL_SELECTED_POINT</source>
+        <translation>Selected point</translation>
+    </message>
+    <message>
+        <source>LBL_TOORIGIN</source>
+        <translation>Set to Origin</translation>
+    </message>
+    <message>
+        <source>LBL_SELECTPOINT</source>
+        <translation>Select Point from View</translation>
+    </message>
+    <message>
+        <source>DLG_TITLE</source>
+        <translation>Set Rotation Point</translation>
+    </message>
+</context>
+<context>
+    <name>SVTK_UpdateRateDlg</name>
+    <message>
+        <source>INFORMATION_FRAME_TITLE</source>
+        <translation>Rendering Metrics</translation>
+    </message>
+    <message>
+        <source>STILL</source>
+        <translation>Still Update Rate, FPS</translation>
+    </message>
+    <message>
+        <source>INPUT_FRAME_TITLE</source>
+        <translation>Enable</translation>
+    </message>
+    <message>
+        <source>NUMBER_CELLS</source>
+        <translation>Number of Cells, -</translation>
+    </message>
+    <message>
+        <source>DESIRED</source>
+        <translation>Desired Update Rate, FPS</translation>
+    </message>
+    <message>
+        <source>CURRENT_FPS</source>
+        <translation>Current Update Rate, FPS</translation>
+    </message>
+    <message>
+        <source>DLG_TITLE</source>
+        <translation>Update Rate</translation>
+    </message>
+</context>
+<context>
+    <name>SVTK_ViewManager</name>
+    <message>
+        <source>VTK_VIEW_TITLE</source>
+        <translation>VTK scene:%1 - viewer:%2</translation>
+    </message>
+</context>
+<context>
+    <name>SVTK_Viewer</name>
+    <message>
+        <source>MEN_DUMP_VIEW</source>
+        <translation>Dump view...</translation>
+    </message>
+    <message>
+        <source>MEN_SHOW_TOOLBAR</source>
+        <translation>Show toolbar</translation>
+    </message>
+    <message>
+        <source>MEN_CHANGE_BACKGROUD</source>
+        <translation>Change background...</translation>
+    </message>
+</context>
+</TS>
diff --git a/src/Style/Style.h b/src/Style/Style.h
new file mode 100644 (file)
index 0000000..10bc1f7
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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
+//
+// File   : Style.h
+// Author : Natalia Ermolaeva, Open CASCADE S.A.S.
+//
+
+#ifndef STYLE_H
+#define STYLE_H
+
+#if defined WIN32
+#  if defined STYLE_SALOME_EXPORTS
+#    define STYLE_SALOME_EXPORT _declspec( dllexport )
+#  else
+#    define STYLE_SALOME_EXPORT _declspec( dllimport )
+#  endif
+#else
+#  define STYLE_SALOME_EXPORT  
+#endif
+
+#endif // STYLE_H
diff --git a/src/Style/Style.pro b/src/Style/Style.pro
new file mode 100644 (file)
index 0000000..87c7e24
--- /dev/null
@@ -0,0 +1,23 @@
+TEMPLATE = lib
+
+DESTDIR =  ../../$(CONFIG_ID)/lib
+MOC_DIR =  ../../moc
+OBJECTS_DIR =  ../../$(CONFIG_ID)/obj/$$TARGET
+
+INCLUDEPATH =  ../../include
+LIBS += -L ../../$(CONFIG_ID)/lib -lQtx
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += STYLE_SALOME_EXPORTS
+
+HEADERS = *.h
+
+SOURCES = *.cxx
+
+includes.files = $$HEADERS
+includes.path =  ../../include
+
+INSTALLS += includes
diff --git a/src/Style/Style_Model.cxx b/src/Style/Style_Model.cxx
new file mode 100644 (file)
index 0000000..eb34b94
--- /dev/null
@@ -0,0 +1,695 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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
+//
+// File   : Style_Model.cxx
+// Author : Natalia Ermolaeva, Open CASCADE S.A.S.
+//
+
+#include "Style_Model.h"
+#include <QtxResourceMgr.h>
+#include <QtxPreferenceMgr.h>
+#include <QtxPagePrefMgr.h>
+
+#include <QColor>
+#include <QApplication>
+#include <QPalette>
+#include <QFont>
+#include <QStyle>
+
+
+Style_Model::Style_Model()
+{
+  // grp_style group
+  fillValue( defined_style,    "defined-style",    "Style:", grp_style, Selector );
+  myPStyles<<"Default"<<"Steel-blue"<<"Dark-green";
+  // grp_colors group
+  fillValue( bg_clr,         "bg-color",        "Window", grp_color );
+  fillValue( pal_base_clr,   "base-color",      "Base", grp_color );
+  fillValue( header_clr,     "header-color",    "Header", grp_color );
+
+  fillValue( pal_text_clr,   "text-color",      "Text", grp_color );
+  fillValue( pal_btext_clr,  "text-button-color", "Text button", grp_color );
+  fillValue( pal_wtext_clr,  "text-window-color", "Text window", grp_color );
+
+  fillValue( slider_clr,     "slider-color",    "Slider", grp_color );
+  fillValue( button_clr,     "button-color",    "Button", grp_color );
+  fillValue( prbar_clr,      "progress-bar-color", "Progress bar", grp_color );
+
+  fillValue( checked_clr,    "checked-color",    "Checked", grp_color );
+  fillValue( pointer_clr,    "pointer-color",   "Pointer", grp_color );
+  fillValue( tbl_grline_clr, "table-grid-color", "Table grid", grp_color );
+
+  fillValue( ttip_is_change, "ttip-is-change", "Change ToolTip", grp_color, Bool );
+  fillValue( ttip_bg_clr,    "ttip-bg-color",   "Background", grp_color );
+  fillValue( ttip_text_clr,  "ttip-text-color", "Text color", grp_color );
+
+  fillValue( highlight_wdg, "is-highlight-widget", "Highlight widget", grp_color, Bool );
+  fillValue( high_wdg_clr,   "highlight-widget-color", "Widget center", grp_color );
+  fillValue( high_brd_wdg_clr, "highligh-brd-widget-color", "Widget border", grp_color );
+
+  fillValue( auto_raising_wdg, "is-raising-widget", "Auto raising widget", grp_color, Bool );
+  fillValue( pal_high_clr,   "highlight-color", "Highlight", grp_color );
+  fillValue( pal_high_text_clr, "highlight-text-color", "Highlight text", grp_color );
+  // grp_col_values group
+  fillValue( fld_light_clr,  "fld-light-color", "Field light", grp_col_values );
+  fillValue( fld_dark_clr,   "fld-dark-color",  "Field dark", grp_col_values );
+  fillValue( pal_light_clr,  "light-color",     "Light", grp_col_values );
+  fillValue( pal_dark_clr,   "dark-color",      "Dark", grp_col_values );
+
+  fillValue( border_top_clr, "brd-top-color",   "Border top", grp_col_values );
+  fillValue( border_bot_clr, "brd-bottom-color", "Border bottom", grp_col_values );
+  fillValue( border_tab_top_clr, "brd-tab-top-color", "Border widget top", grp_col_values );
+  fillValue( border_tab_bot_clr, "brd-tab-bottom-color", "Border widget bottom", grp_col_values );
+
+  // lines group
+  fillValue( is_lines,       "is-lines",     "Draw lines", grp_lines, Bool );
+  fillValue( lines_type,     "lines-type",   "Type",       grp_lines, Selector );
+  myLines<<"Horizontal"<<"Incline";
+  fillValue( lines_clr,     "lines-color",   "Color",      grp_lines, Color );
+  fillValue( lines_transp,  "lines-transp",  "Transparency", grp_lines, DblSpin );
+
+  // grp_font group
+  fillValue( font_value,    "app-font", "Font", grp_font, Font );
+  // grp_values group
+  fillValue( edit_rad,      "edit-rad", "Rounding of edit", grp_value, DblSpin );
+  fillValue( btn_rad,       "button-rad", "Rounding of button", grp_value, DblSpin );
+  fillValue( frame_rad,     "frame-rad", "Rounding of frame", grp_value, DblSpin ); 
+  fillValue( slider_rad,    "slider-rad", "Rounding of slider", grp_value, DblSpin );
+  fillValue( hor_handle_delta, "hor-hadle-delta", "Hor spacinig of handle ", grp_value, DblSpin );
+  fillValue( ver_handle_delta, "ver-handle-delta", "Ver spacing of handle", grp_value, DblSpin );
+  fillValue( split_handle_len, "split-handle-len", "Length of splitter handle", grp_value, DblSpin );
+  fillValue( slider_increase, "slider-increase", "Slider increase", grp_value, IntSpin );
+  fillValue( all_antialized, "all-antialized", "All borders antialized", grp_value, Bool );
+
+  fillGroup( grp_style,      tab_value, "Predefined style", 1 );
+  fillGroup( grp_color,      tab_color, "Colors", 3 );
+  fillGroup( grp_col_values, tab_color, "ColorValues", 2 );
+  fillGroup( grp_lines,      tab_value, "Lines", 2 );
+  fillGroup( grp_font,       tab_value, "Font", 1 );
+  fillGroup( grp_value,      tab_value, "Values", 2 );
+
+  myTabs[tab_color] = QString( "Colors" );
+  myTabs[tab_value] = QString( "Values" );
+}
+
+Style_Model::~Style_Model()
+{
+}
+
+QString Style_Model::sectionName()
+{
+  return "Theme"; 
+}
+
+void Style_Model::reset()
+{
+  ValuesMap::iterator anIt = myValues.begin(), anEnd = myValues.end();
+  int anId;
+  for ( ; anIt != anEnd; ++anIt ) {
+    anId = anIt.key();
+    myValues[anId].myValue = myValues[anId].myDefValue;
+  }
+}
+
+void Style_Model::setDefaults( QApplication* app )
+{
+  setDefValue( defined_style,    QVariant( 0 ) );
+
+  QPalette aPal = app->palette();
+  setDefValue( bg_clr,         QVariant( aPal.color( QPalette::Window ) ) );
+  setDefValue( pal_base_clr,   aPal.color ( QPalette::Base ) );
+  setDefValue( header_clr,     QVariant( aPal.color( QPalette::Button ) ) );
+  setDefValue( pal_text_clr,   aPal.color( QPalette::Text ) );
+  setDefValue( pal_btext_clr,  aPal.color( QPalette::ButtonText ) );
+  setDefValue( pal_wtext_clr,  aPal.color( QPalette::WindowText ) );
+
+  setDefValue( slider_clr,     QVariant( aPal.color( QPalette::Button ) ) );
+  setDefValue( button_clr,     QVariant( aPal.color( QPalette::Button ) ) );
+  setDefValue( prbar_clr,       QVariant( aPal.color( QPalette::Highlight ) ) );
+
+  setDefValue( checked_clr,    QVariant( aPal.color( QPalette::Base ) ) );
+  setDefValue( pointer_clr,     QVariant( QColor( Qt::black ) ) );
+  setDefValue( tbl_grline_clr,  QVariant( aPal.color( QPalette::Mid ) ) );
+
+  setDefValue( ttip_is_change,  QVariant( false ) );
+  setDefValue( ttip_bg_clr,     myValues[bg_clr].myValue );
+  setDefValue( ttip_text_clr,   myValues[pal_text_clr].myValue );
+
+  setDefValue( highlight_wdg,  QVariant( false ) );
+  setDefValue( high_wdg_clr,   myValues[button_clr].myValue );
+  setDefValue( high_brd_wdg_clr, myValues[high_wdg_clr].myValue );
+
+  setDefValue( pal_high_clr,   aPal.color( QPalette::Highlight ) );
+  setDefValue( pal_high_text_clr, aPal.color( QPalette::HighlightedText ) );
+
+  setDefValue( fld_light_clr,   QVariant( aPal.color( QPalette::Light ) ) );
+  setDefValue( fld_dark_clr,    QVariant( aPal.color( QPalette::Mid ).light( 125 ) ) );
+  setDefValue( pal_light_clr,  aPal.color( QPalette::Light ) );
+  setDefValue( pal_dark_clr,   aPal.color( QPalette::Dark ) );
+
+  QColor aDark = aPal.color( QPalette::Dark );
+  setDefValue( border_top_clr, QVariant( aDark.light() ) );
+  setDefValue( border_bot_clr, QVariant( aDark.dark() ) );
+  setDefValue( border_tab_top_clr, QVariant( aDark.light().light().light() ) );
+  setDefValue( border_tab_bot_clr, QVariant( aDark.dark().dark() ) );
+
+  setDefValue( is_lines,       QVariant( false ) );
+  setDefValue( lines_type,     QVariant( 0 ) );
+  setDefValue( lines_clr,      QVariant( aPal.color( QPalette::Mid ) ) );
+
+  // not color settings
+  QFont aFont = app->font();
+  setDefValue( font_value,      QVariant( aFont ) );
+
+  setDefValue( slider_rad,     QVariant( 0 ) );
+  setDefValue( edit_rad,       QVariant( 0 ) );
+  setDefValue( btn_rad,        QVariant( 0 ) );
+  setDefValue( frame_rad,      QVariant( 0 ) );
+  setDefValue( slider_increase,QVariant( 2 ) );
+  setDefValue( all_antialized, QVariant( false ) );
+  setDefValue( highlight_wdg,   QVariant( false ) );
+  setDefValue( auto_raising_wdg, QVariant( false ) );
+  setDefValue( hor_handle_delta, QVariant( 3 ) );
+  setDefValue( ver_handle_delta, QVariant( 3 ) );
+  setDefValue( split_handle_len, QVariant( 20 ) );
+}
+
+void Style_Model::initFromResource( QtxResourceMgr* theResMgr )
+{
+  ValuesMap::iterator anIt = myValues.begin(), anEnd = myValues.end();
+  for ( ; anIt != anEnd; ++anIt )
+    setValueFrom( theResMgr, anIt.key() );
+}
+
+void Style_Model::updateFromResource( QtxPagePrefMgr* thePrefMgr, const QString& thePropName )
+{
+  QtxResourceMgr* aResMgr = thePrefMgr->resourceMgr();
+  if ( !aResMgr )
+    return;
+  ValuesMap::iterator anIt = myValues.begin(), anEnd = myValues.end();
+  int anId = -1;
+  for ( ; anIt != anEnd && anId == -1; ++anIt )
+    if ( anIt.value().myName == thePropName )
+      anId = anIt.key();
+  if ( anId == -1 )
+    return;
+  setValueFrom( aResMgr, anId );
+  if ( anId == defined_style ) {
+    setPredefinedStyle( getIntValue( defined_style ) );
+    // update for resources all datas
+    for ( anIt = myValues.begin(); anIt != anEnd; ++anIt ) {
+      //if ( anIt.key() != anId )
+        getValueTo( aResMgr, anIt.key(), false );
+    }
+    thePrefMgr->retrieve();
+  }
+  qApp->style()->polish( qApp );
+}
+
+void Style_Model::updateFromResource( QtxPagePrefMgr* thePrefMgr )
+{
+  QtxResourceMgr* aResMgr = thePrefMgr->resourceMgr();
+  if ( !aResMgr )
+    return;
+  int aDefId = defined_style;
+  int aPrevStyle = getIntValue( aDefId );
+  setValueFrom( aResMgr, aDefId );
+  ValuesMap::iterator anIt = myValues.begin(), anEnd = myValues.end();
+  if ( aPrevStyle == getIntValue( aDefId ) ) {
+    // predefined style wasn't changed
+    for ( ; anIt != anEnd; ++anIt )
+      setValueFrom( aResMgr, anIt.key() );
+  }
+  else {
+    // predefined style was changed
+    // set predefined values
+    setPredefinedStyle( getIntValue( defined_style ) );
+    for ( ; anIt != anEnd; ++anIt )
+      // change resource for predefined style
+      getValueTo( aResMgr, anIt.key(), false );
+    // rebuild dialog
+    thePrefMgr->retrieve();
+  }
+  qApp->style()->polish( qApp );
+}
+
+void Style_Model::fillPreferences( QtxPagePrefMgr* thePrefMgr, const int theFromId )
+{
+  QString aSection = sectionName();
+
+  QtxPreferenceItem* aParentItem = thePrefMgr->findItem( theFromId, true );
+  QtxPagePrefFrameItem* aFrameItem = new QtxPagePrefFrameItem( aSection, aParentItem );
+  QtxPagePrefTabsItem* aTabItem = new QtxPagePrefTabsItem( "ThemeTab", aFrameItem );
+
+  QtxResourceMgr* aResMgr = thePrefMgr->resourceMgr();
+  initFromResource( aResMgr );
+
+  QList<int> aTabLst = getTabs();
+  QList<int>::iterator aTabIt = aTabLst.begin(), aTabEnd = aTabLst.end();
+  QList<int> aGrpLst, aPropLst;
+  QList<int>::iterator anIt, anEnd, aPropIt, aPropEnd;
+  int aGrpId, aPropId;
+
+  QtxPreferenceItem* anItem;
+  for ( ; aTabIt != aTabEnd; ++aTabIt ) {
+    QList<int> aGrpLst = getGroups( *aTabIt );
+    QtxPagePrefFrameItem* aFrItem = new QtxPagePrefFrameItem( getTabTitle( *aTabIt ), aTabItem );
+    for( anIt = aGrpLst.begin(), anEnd = aGrpLst.end(); anIt != anEnd; ++anIt ) {
+      aGrpId = *anIt;
+      QtxPagePrefGroupItem* aGrpItem = new QtxPagePrefGroupItem( getGroupTitle( aGrpId ), aFrItem );
+      aGrpItem->setOption( "columns", getGroupNbColumns( aGrpId ) );
+      aPropLst = getGroupProps( aGrpId );
+      for( aPropIt = aPropLst.begin(), aPropEnd = aPropLst.end(); aPropIt != aPropEnd; ++aPropIt ) {
+        aPropId = *aPropIt;
+        Style_Model::PropType aType = getPropType( aPropId );
+        QString aPropTitle = getPropTitle( aPropId );
+        QString aPropName = getPropName( aPropId );
+        switch( aType ) {
+          case Bool:
+            anItem = new QtxPagePrefCheckItem( aPropTitle, aGrpItem, aSection, aPropName );
+            break;
+          case Color:
+            anItem = new QtxPagePrefColorItem( aPropTitle, aGrpItem, aSection, aPropName );
+            break;
+          case String:
+            anItem = new QtxPagePrefEditItem( QtxPagePrefEditItem::String, aPropTitle,
+                                              aGrpItem, aSection, aPropName );
+            break;
+          case IntSpin:
+            anItem = new QtxPagePrefSpinItem( QtxPagePrefSpinItem::Integer, aPropTitle,
+                                              aGrpItem, aSection, aPropName );
+            break;
+          case DblSpin:
+            anItem = new QtxPagePrefSpinItem( QtxPagePrefSpinItem::Double, aPropTitle,
+                                              aGrpItem, aSection, aPropName );
+            break;
+          case Selector: {
+            anItem = new QtxPagePrefSelectItem( aPropTitle, aGrpItem, aSection, aPropName );
+            break;
+          }
+          case Font:
+            anItem = new QtxPagePrefFontItem( aPropTitle, aGrpItem, aSection, aPropName );
+            break;
+          default: continue;
+        }
+        getValueTo( aResMgr, aPropId, true );//set default values into resource
+        if ( aType == Selector ) {
+          QStringList lst;
+          QList<QVariant> ids;
+          getSelector( aPropId, lst, ids );
+          anItem->setOption( "strings", lst );
+          anItem->setOption( "indexes", ids );
+        }
+        if ( aPropId == defined_style ) {
+
+       }
+      }
+    }
+  }
+  thePrefMgr->retrieve();
+}
+
+void Style_Model::getValueTo( QtxResourceMgr* theResMgr, int theId, bool theIsDef )
+{
+  if ( !theResMgr )
+    return;
+  QString aSection = sectionName(),
+          aPropName = getPropName( theId );
+  switch( getPropType( theId ) ) {
+    case Bool: {
+      bool aValue;
+      if ( !theIsDef || !theResMgr->value( aSection, aPropName, aValue ) )
+        theResMgr->setValue( aSection, aPropName, getBoolValue( theId, theIsDef ) );
+      break;
+    }
+    case Color: {
+      QColor aColor;
+      if ( !theIsDef || !theResMgr->value( aSection, aPropName, aColor ) )
+        theResMgr->setValue( aSection, aPropName, getColorValue( theId, theIsDef ) );
+      break; 
+    }
+    case String: {
+      QString aStr;
+      if ( !theIsDef || !theResMgr->value( aSection, aPropName, aStr ) )
+        theResMgr->setValue( aSection, aPropName, getStringValue( theId, theIsDef ) );
+      break;
+    }
+    case IntSpin: {
+      int aValue;
+      if ( !theIsDef || !theResMgr->value( aSection, aPropName, aValue ) )
+        theResMgr->setValue( aSection, aPropName, getIntValue( theId, theIsDef ) );
+      break;
+    }
+    case DblSpin: {
+      double aValue;
+      if ( !theIsDef || !theResMgr->value( aSection, aPropName, aValue ) )
+        theResMgr->setValue( aSection, aPropName, getDblValue( theId, theIsDef ) );
+      break;
+    }
+    case Selector: {
+      int aValue;
+      if ( !theIsDef || !theResMgr->value( aSection, aPropName, aValue ) )
+        theResMgr->setValue( aSection, aPropName, getIntValue( theId, theIsDef ) );
+      break;
+    }
+  case Font: {
+      QFont aFont;
+      if ( !theIsDef || !theResMgr->value( aSection, aPropName, aFont ) )
+        theResMgr->setValue( aSection, aPropName, getFontValue( theId, theIsDef ) );
+      break;
+    }
+    default: break;
+  }
+}
+
+void Style_Model::setValueFrom( QtxResourceMgr* theResMgr, int theId )
+{
+  if ( !theResMgr )
+    return;
+  QString aSection = sectionName(),
+          aPropName = getPropName( theId );
+  QVariant aValue = myValues[theId].myDefValue;
+  switch( getPropType( theId ) ) {
+    case Bool:
+      aValue = theResMgr->booleanValue( aSection, aPropName, getBoolValue( theId, true ) );
+    break;
+    case Color:
+      aValue = theResMgr->colorValue( aSection, aPropName, getColorValue( theId , true ) );
+    break; 
+    case String:
+      aValue = theResMgr->stringValue( aSection, aPropName, getStringValue( theId, true ) );
+    break;
+    case IntSpin:
+      aValue = theResMgr->integerValue( aSection, aPropName, getIntValue( theId, true ) );
+    break;
+    case DblSpin:
+      aValue = theResMgr->doubleValue( aSection, aPropName, getDblValue( theId, true ) );
+    break;
+    case Selector:
+      aValue = theResMgr->integerValue( aSection, aPropName, getIntValue( theId, true ) );
+    break;
+    case Font:
+      aValue = theResMgr->fontValue( aSection, aPropName, getFontValue( theId, true ) );
+    break;
+    default: break;
+  }
+  myValues[theId].myValue = aValue;
+}
+
+void Style_Model::setPredefinedStyle( int theType )
+{
+  reset();
+  setValue( defined_style, QVariant( theType ) );
+  switch ( theType ) {
+    case 0: {
+      setValue( slider_rad, QVariant( 3 ) );
+      setValue( slider_increase,  QVariant( 5 ) );
+      setValue( auto_raising_wdg, QVariant( true ) );
+      break;
+    }
+    case 1: {
+      //light blue variant
+      setValue( bg_clr,        QVariant( QColor( "lightsteelblue" ) ) );
+      setValue( lines_type,  QVariant( 0 ) );
+      setValue( lines_clr, QVariant( QColor( "blue" ) ) );
+      setValue( checked_clr,   QVariant( QColor( "cornflowerblue" ) ) );
+      setValue( header_clr,    QVariant( QColor( "silver" ) ) );
+      setValue( slider_clr,    QVariant( QColor( "cornflowerblue" ) ) );
+      setValue( button_clr,    QVariant( QColor( "silver" ) ) );
+      setValue( pointer_clr,   QVariant( QColor( "midnightblue" ) ) );
+      setValue( fld_light_clr, QVariant( QColor( "whitesmoke" ) ) );
+      setValue( fld_dark_clr,  QVariant( QColor( "grey" ).light( 145 ) ) );
+      setValue( prbar_clr,     QVariant( QColor ("cornflowerblue" ) ) );
+      setValue( slider_rad,    QVariant( 3 ) );
+      setValue( edit_rad,      QVariant( 6 ) );
+      setValue( btn_rad,       QVariant( 10 ) );
+      setValue( frame_rad,     QVariant( 10 ) );
+      setValue( slider_increase, QVariant( 5 ) );
+      setValue( all_antialized, QVariant( false ) ); // true
+
+      setValue( highlight_wdg, QVariant( true ) );
+      setValue( high_wdg_clr,  QVariant("skyblue") );
+      setValue( high_brd_wdg_clr, QVariant("cornflowerblue") );
+      setValue( pal_base_clr,  QVariant( QColor( "white" ) ) );
+      //setValue( auto_raising_wdg, QVariant( true ) );
+      break;
+    }
+    case 2: {
+      QColor aDarkGreen  = QColor( "darkgreen" ).dark(195);
+      setValue( bg_clr,        QVariant( QColor( "black" ) ) );
+      setValue( lines_type,  QVariant( 0 ) );
+      setValue( checked_clr,   QVariant( QColor( "black" ) ) );
+      setValue( header_clr,    QVariant( aDarkGreen ) );
+      setValue( slider_clr,    QVariant( QColor( "goldenrod" ) ) );
+      setValue( button_clr,    QVariant( aDarkGreen ) );
+
+      setValue( border_top_clr, QVariant( "goldenrod" ) );
+      setValue( border_bot_clr, QVariant( "saddlebrown" ) );
+      setValue( border_tab_top_clr, QVariant( "goldenrod" ) );
+      setValue( border_tab_bot_clr, QVariant( "saddlebrown" ) );
+
+      setValue( pointer_clr,   QVariant( QColor( "gold" ) ) );
+      setValue( fld_light_clr, QVariant( QColor( "green" ) ) );
+      setValue( fld_dark_clr,  QVariant( aDarkGreen ) );
+      setValue( prbar_clr,     QVariant( QColor( "goldenrod" ) ) );
+      setValue( tbl_grline_clr,QVariant( "saddlebrown" ) );
+      setValue( ttip_is_change,QVariant( true ) );
+      setValue( ttip_bg_clr,   QVariant( "green" ) );
+
+      setValue( pal_text_clr,  QVariant( QColor( "white" ) ) );
+      setValue( pal_btext_clr, QVariant( QColor( "gold" ) ) );
+      setValue( pal_wtext_clr, QVariant( QColor( "gold" ) ) );
+      setValue( pal_base_clr,  QVariant( QColor( "black" ) ) );
+      setValue( pal_high_clr,  QVariant( QColor( "gold" ) ) );
+      setValue( pal_high_text_clr, QVariant( QColor( "goldenrod" ) ) );
+      setValue( pal_light_clr, QVariant( QColor( "goldenrod" ) ) );
+      setValue( pal_dark_clr,  QVariant( QColor( "saddlebrown" ) ) );
+
+      setValue( slider_rad,    QVariant( 3 ) );
+      setValue( edit_rad,      QVariant( 6 ) );
+      setValue( frame_rad,       QVariant( 10 ) );
+      setValue( btn_rad,       QVariant( 10 ) );
+      setValue( slider_increase, QVariant( 6 ) );
+      setValue( all_antialized, QVariant( false ) );
+
+      setValue( highlight_wdg, QVariant( true ) );
+      setValue( high_wdg_clr,  QVariant("green") );
+      setValue( high_brd_wdg_clr, QVariant( aDarkGreen ) );
+      break;
+    }
+    default:
+      return;
+  }
+}
+
+double Style_Model::getDblValue( int theId, const bool theIsDef ) const
+{
+  double aRes = 0;
+  QVariant aValue;
+  if ( myValues.contains(theId) && myValues[theId].myType == DblSpin ) {
+    if ( theIsDef )
+      aValue =  myValues[theId].myDefValue;
+    else
+      aValue =  myValues[theId].myValue;
+    if ( aValue.canConvert( QVariant::Double ) )
+      aRes = myValues[theId].myValue.toDouble();
+  }
+  return aRes;
+}
+
+int Style_Model::getIntValue( int theId, const bool theIsDef ) const
+{
+  int aRes = 0;
+  QVariant aValue;
+  if ( myValues.contains(theId) && ( myValues[theId].myType == IntSpin
+                                     || myValues[theId].myType == Selector ) ) {
+    if ( theIsDef )
+      aValue =  myValues[theId].myDefValue;
+    else
+      aValue =  myValues[theId].myValue;
+    if ( aValue.canConvert( QVariant::Int ) )
+      aRes = myValues[theId].myValue.toInt();
+  }
+  return aRes;
+}
+
+bool Style_Model::getBoolValue( int theId, const bool theIsDef ) const
+{
+  bool aRes = false;
+  QVariant aValue;
+  if ( myValues.contains(theId) && myValues[theId].myType == Bool ) {
+    if ( theIsDef )
+      aValue =  myValues[theId].myDefValue;
+    else
+      aValue =  myValues[theId].myValue;
+    if ( aValue.canConvert( QVariant::Bool ) )
+      aRes = myValues[theId].myValue.toBool();
+  }
+  return aRes;
+}
+
+QColor Style_Model::getColorValue( int theId, const bool theIsDef ) const
+{
+  QColor aColor = Qt::gray;
+  QVariant aValue;
+  if ( myValues.contains(theId) && myValues[theId].myType == Color ) {
+    if ( theIsDef )
+      aValue =  myValues[theId].myDefValue;
+    else
+      aValue =  myValues[theId].myValue;
+
+   if ( aValue.canConvert( QVariant::Color ) )
+     aColor = myValues[theId].myValue.value<QColor>();
+  }
+  return aColor;
+}
+
+QString Style_Model::getStringValue( int theId, const bool theIsDef ) const
+{
+  QString aRes = false;
+  QVariant aValue;
+  if ( myValues.contains(theId) && myValues[theId].myType == String ) {
+    if ( theIsDef )
+      aValue =  myValues[theId].myDefValue;
+    else
+      aValue =  myValues[theId].myValue;
+    if ( aValue.canConvert( QVariant::String ) )
+      aRes = myValues[theId].myValue.toString();
+  }
+  return aRes;
+}
+
+QFont Style_Model::getFontValue( int theId, const bool theIsDef ) const
+{
+  QFont aFont;
+  QVariant aValue;
+  if ( myValues.contains(theId) && myValues[theId].myType == Font ) {
+    if ( theIsDef )
+      aValue =  myValues[theId].myDefValue;
+    else
+      aValue =  myValues[theId].myValue;
+    if ( aValue.canConvert( QVariant::Font ) )
+      aFont = myValues[theId].myValue.value<QFont>();
+  }
+  return aFont;
+}
+
+QList<int> Style_Model::getTabs() const
+{
+  return myTabs.keys();
+}
+
+QString Style_Model::getTabTitle( int theId ) const
+{
+  return myTabs.contains( theId ) ? myTabs[theId] : "";
+}
+
+QList<int> Style_Model::getGroups( int theId ) const
+{
+  QList<int> groups;
+  GroupMap::const_iterator anIt = myGroups.begin(), anEnd = myGroups.end();
+  for ( ; anIt != anEnd; ++anIt )
+    if ( anIt.value().myTabType == theId )
+      groups.append( anIt.key() );
+  return groups;
+}
+
+QString Style_Model::getGroupTitle( int theId ) const
+{
+  return myGroups.contains( theId ) ? myGroups[theId].myTitle : "";
+}
+
+int Style_Model::getGroupNbColumns( int theId ) const
+{
+  return myGroups.contains( theId ) ? myGroups[theId].myNbColumns : 1;
+}
+
+QList<int> Style_Model::getGroupProps( int theId ) const
+{
+  QList<int> values;
+  ValuesMap::const_iterator anIt = myValues.begin(), anEnd = myValues.end();
+  for ( ; anIt != anEnd; ++anIt )
+    if ( anIt.value().myGroupId == theId )
+      values.append( anIt.key() );
+  return values;
+}
+
+QString Style_Model::getPropTitle( int theId ) const
+{
+  return myValues.contains( theId ) ? myValues[theId].myTitle : ""; 
+}
+
+Style_Model::PropType Style_Model::getPropType( int theId ) const
+{
+  return myValues.contains( theId ) ? myValues[theId].myType : None; 
+}
+
+QString Style_Model::getPropName( int theId ) const
+{
+  return myValues.contains( theId ) ? myValues[theId].myName : ""; 
+}
+
+void Style_Model::getSelector( int theId, QStringList& theLst, QList<QVariant>& theIds ) const
+{
+  theLst.clear();
+  theIds.clear();
+  switch ( theId ) {
+    case defined_style: theLst = myPStyles; break;
+    case lines_type:    theLst = myLines; break;
+    default: break;
+  }
+  QStringList::iterator anIt = theLst.begin(), anEnd = theLst.end();
+  int i = 0;
+  for ( ; anIt != anEnd; ++anIt )
+    theIds.append( QVariant( i++ ) );
+}
+
+void Style_Model::setDefValue( Properties theId, const QVariant& theValue )
+{
+  myValues[theId].myDefValue = theValue;
+  setValue( theId, theValue );
+}
+
+void Style_Model::setValue( Properties theId, const QVariant& theValue )
+{
+  myValues[theId].myValue = theValue;
+}
+
+void Style_Model::fillValue( Properties theId, const QString& theName,
+                            const QString& theTitle, Groups theGroupId, PropType theType )
+{
+  StyleValue aValue;
+  aValue.myName = theName;
+  aValue.myTitle = theTitle;
+  aValue.myGroupId = theGroupId;
+  aValue.myType = theType;
+  aValue.myValue = QVariant();
+
+  myValues[theId] = aValue;
+}
+
+void Style_Model::fillGroup( Groups theId, Tabs theTab, const QString& theTitle, int theNbCols )
+{
+  GroupValue aValue;
+  aValue.myTabType = theTab;
+  aValue.myTitle = theTitle;
+  aValue.myNbColumns = theNbCols;
+
+  myGroups[theId] = aValue;
+}
+
diff --git a/src/Style/Style_Model.h b/src/Style/Style_Model.h
new file mode 100644 (file)
index 0000000..4dd8533
--- /dev/null
@@ -0,0 +1,138 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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
+//
+// File   : Style_Model.h
+// Author : Natalia Ermolaeva, Open CASCADE S.A.S.
+//
+
+#ifndef STYLE_MODEL_H
+#define STYLE_MODEL_H
+
+#include "Style.h"
+
+#include <QMap>
+#include <QString>
+#include <QVariant>
+#include <QStringList>
+
+class QtxResourceMgr;
+class QtxPagePrefMgr;
+class QApplication;
+class QColor;
+class QFont;
+
+class STYLE_SALOME_EXPORT Style_Model
+{
+public:
+  Style_Model();
+  virtual ~Style_Model();
+
+  static QString sectionName();
+
+  typedef enum { tab_value, tab_color } Tabs;
+  typedef enum { grp_style, grp_color, grp_col_values, grp_lines, grp_font, grp_value } Groups;
+  typedef enum { None, Bool, Color, String, IntSpin, DblSpin, Selector, Font } PropType;
+  typedef enum { // grp_style
+                 defined_style, 
+                 // grp colors
+                 bg_clr, pal_base_clr, header_clr,
+                 pal_text_clr, pal_btext_clr, pal_wtext_clr,
+                 slider_clr, button_clr, prbar_clr,
+                 checked_clr, pointer_clr, tbl_grline_clr,
+                 ttip_is_change, ttip_bg_clr, ttip_text_clr,
+                 highlight_wdg, high_wdg_clr, high_brd_wdg_clr,
+                 auto_raising_wdg, pal_high_clr, pal_high_text_clr,
+                 // grp_col_values
+                 fld_light_clr, fld_dark_clr, pal_light_clr, pal_dark_clr,
+                 border_top_clr, border_bot_clr, border_tab_top_clr, border_tab_bot_clr,
+                 // grp_lines 
+                 is_lines, lines_type, lines_clr, lines_transp,
+                 // grp_font
+                 font_value,
+                 // grp_values
+                 edit_rad, btn_rad, frame_rad, slider_rad,
+                 hor_handle_delta, ver_handle_delta,
+                 split_handle_len, slider_increase, all_antialized } Properties;
+
+  void           reset();
+  void           setDefaults( QApplication* );
+  void           initFromResource( QtxResourceMgr* );
+  void           updateFromResource( QtxPagePrefMgr*, const QString& );
+  void           updateFromResource( QtxPagePrefMgr* );
+
+  void           fillPreferences( QtxPagePrefMgr*, const int );
+
+  void           getValueTo( QtxResourceMgr*, int, bool );
+  void           setValueFrom( QtxResourceMgr*, int );
+
+  void           setPredefinedStyle( int );
+
+  double         getDblValue( int, const bool = false ) const;
+  int            getIntValue( int, const bool = false ) const;
+  bool           getBoolValue( int, const bool = false ) const;
+  QColor         getColorValue( int, const bool = false ) const;
+  QString        getStringValue( int, const bool = false ) const;
+  QFont          getFontValue( int, const bool = false ) const;
+
+  QList<int>     getTabs() const;
+  QString        getTabTitle( int ) const;
+  QList<int>     getGroups( int ) const;
+  QString        getGroupTitle( int ) const;
+  int            getGroupNbColumns( int ) const;
+  QList<int>     getGroupProps( int ) const;
+  QString        getPropTitle( int ) const;
+  PropType       getPropType( int ) const;
+  QString        getPropName( int ) const;
+  void           getSelector( int, QStringList&, QList<QVariant>& ) const;
+
+private:
+  void           setDefValue( Properties, const QVariant& );
+  void           setValue( Properties, const QVariant& );
+
+  void           fillValue( Properties, const QString&, const QString&,
+                            Groups, PropType = Color ); 
+  void           fillGroup( Groups, Tabs, const QString&, int );
+
+private:
+  typedef struct {
+    QString    myName;
+    QString    myTitle;
+    Groups     myGroupId;
+    PropType   myType;
+    QVariant   myValue;
+    QVariant   myDefValue;
+  } StyleValue;
+
+  typedef struct {
+    Tabs      myTabType;
+    QString   myTitle;
+    int       myNbColumns;
+  } GroupValue;
+
+  typedef QMap<int, StyleValue> ValuesMap;
+  typedef QMap<int, GroupValue> GroupMap;
+  typedef QMap<int, QString> StringMap;
+  ValuesMap   myValues;
+  GroupMap    myGroups;
+  StringMap   myTabs;
+
+  QStringList myPStyles;
+  QStringList myLines;
+};
+
+#endif // STYLE_MODEL_H
diff --git a/src/Style/Style_Salome.cxx b/src/Style/Style_Salome.cxx
new file mode 100644 (file)
index 0000000..88a893a
--- /dev/null
@@ -0,0 +1,2263 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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
+//
+// File   : Style_Salome.cxx
+// Author : Natalia Ermolaeva, Open CASCADE S.A.S.
+//
+
+#include "Style_Salome.h"
+#include "Style_Tools.h"
+#include "Style_Model.h"
+
+#include <QApplication>
+#include <QPainter>
+#include <QMap>
+#include <QVariant>
+#include <QPainterPath>
+#include <QWidget>
+#include <QComboBox>
+#include <QStyleOptionFrame>
+#include <QStyleOptionComplex>
+#include <QStyleOptionSpinBox>
+#include <QStyleOptionButton>
+#include <QStyleOptionTab>
+#include <QStyleOptionToolButton>
+#include <QStyleOption>
+#include <QSize>
+#include <QToolBar>
+#include <QMenuBar>
+#include <QToolButton>
+#include <QTabWidget>
+#include <QTabBar>
+#include <QToolTip>
+#include <QDockWidget>
+#include <QTextEdit>
+#include <QTreeView>
+#include <QListView>
+#include <QHeaderView>
+#include <QRadioButton>
+#include <QCheckBox>
+#include <QPushButton>
+#include <QAbstractSpinBox>
+#include <QLineEdit>
+#include <QScrollBar>
+#include <QSlider>
+#include <QMainWindow>
+
+#define SHADOW          1
+#define LINE_GR_MARGIN  10
+#define HIGH_WDG_MARGIN 10
+
+#define BUT_PERCENT_COL 125
+#define BUT_PERCENT_ON  115
+
+#define DELTA_H_TAB     1
+#define DELTA_SLIDER    3
+
+static const char* const hole_xpm[] = {
+"3 3 3 1",
+". c None",
+"a c #999999",
+"b c #FFFFFF",
+"aa.",
+"aab",
+".bb"
+};
+
+static const char* const cross_xpm[] = {
+"12 12 4 1",
+". c None",
+"a c #000000",
+"b c #FFFFFF",
+"c c #666666",
+"............",
+"............",
+"............",
+".aaaa..aaaa.",
+"..abbaabba..",
+"...abbbba...",
+"....abba....",
+"...abbbba...",
+"..abbaabba..",
+".aaaa..aaaa.",
+"............",
+"............"
+};
+
+static const char* const maximize_xpm[] = {
+"12 12 4 1",
+". c None",
+"a c #000000",
+"b c #FFFFFF",
+"c c #666666",
+"............",
+".aaaaaaaaaa.",
+".acccccccca.",
+".acccccccca.",
+".abbbbbbbba.",
+".abbbbbbbba.",
+".abbbbbbbba.",
+".abbbbbbbba.",
+".abbbbbbbba.",
+".abbbbbbbba.",
+".aaaaaaaaaa.",
+"............"
+};
+
+static const char* const normal_xpm[] = {
+"12 12 4 1",
+". c None",
+"a c #000000",
+"b c #FFFFFF",
+"c c #666666",
+"............",
+"...aaaaaaaa.",
+"...acccccca.",
+"...abbbbbba.",
+"...aaaaaaba.",
+".aaaaaaaaba.",
+".accccccaba.",
+".abbbbbbaaa.",
+".abbbbbba...",
+".abbbbbba...",
+".aaaaaaaa...",
+"............"
+};
+
+static const char* const minimize_xpm[] = {
+"12 12 4 1",
+". c None",
+"a c #000000",
+"b c #FFFFFF",
+"c c #666666",
+"............",
+"............",
+"............",
+"............",
+"............",
+"............",
+"............",
+"............",
+"aaaaaaaaaaaa",
+"abbbbbbbbbba",
+"aaaaaaaaaaaa",
+"............"
+};
+
+
+Style_Salome::Style_Salome()
+  : QWindowsStyle()
+{
+  myModel = new Style_Model();
+  myModel->setDefaults( qApp );
+
+  QPalette ttipPal = QToolTip::palette(); // from current system
+  myTTipWnd = ttipPal.color( QPalette::Window );
+  myTTipText = ttipPal.color( QPalette::Text );
+}
+
+Style_Salome::~Style_Salome()
+{
+}
+
+Style_Model* Style_Salome::getModel() const
+{
+  return myModel;
+}
+
+void Style_Salome::updateSettings( QApplication* app )
+{
+  updatePaletteColors();
+  QFont aFont = myModel->getFontValue( Style_Model::font_value );
+  app->setFont( aFont );
+  updateAllWidgets( app );
+}
+
+void Style_Salome::polish ( QApplication* app )
+{
+  QWindowsStyle::polish( app );
+  updateSettings( app );
+}
+
+void Style_Salome::polish ( QWidget* w )
+{
+  if ( !w )
+    return;
+  if ( w && hasHover() ) {
+    if ( qobject_cast<QPushButton*>(w) || qobject_cast<QToolButton*>(w) ||
+         qobject_cast<QCheckBox*>(w) || qobject_cast<QRadioButton*>(w) ||
+         qobject_cast<QComboBox*>(w) || qobject_cast<QAbstractSpinBox*>(w) ||
+         qobject_cast<QLineEdit*>(w) || qobject_cast<QScrollBar*>(w) ||
+         qobject_cast<QTabBar*>(w) || qobject_cast<QSlider*>(w) ||
+         qobject_cast<QMenuBar*>(w) || qobject_cast<QDockWidget*>(w) )
+      w->setAttribute( Qt::WA_Hover );
+  }
+  QWindowsStyle::polish( w );
+}
+
+void Style_Salome::unpolish( QWidget* w )
+{
+  if ( w && hasHover() ) {
+    if ( qobject_cast<QPushButton*>(w) || qobject_cast<QToolButton*>(w)||
+         qobject_cast<QCheckBox*>(w) || qobject_cast<QRadioButton*>(w) ||
+         qobject_cast<QComboBox*>(w) || qobject_cast<QAbstractSpinBox*>(w) ||
+         qobject_cast<QLineEdit*>(w) || qobject_cast<QScrollBar*>(w) ||
+         qobject_cast<QTabBar*>(w) || qobject_cast<QSlider*>(w) ||
+         qobject_cast<QMenuBar*>(w) || qobject_cast<QDockWidget*>(w) )
+      w->setAttribute( Qt::WA_Hover, false );
+  }
+  QWindowsStyle::unpolish( w );
+}
+
+void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComplex* opt,
+                                      QPainter* p, const QWidget* w ) const
+{
+  const QPalette& pal = w->palette();
+  switch( cc ) {
+    case CC_SpinBox:
+      if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
+        bool hover = hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver);
+        QRect optr = opt->rect, arUp =   subControlRect( cc, spin, SC_SpinBoxUp, w );
+        optr.setWidth( arUp.x()-optr.x()+1 );
+        double aRad = getDblValue( Style_Model::edit_rad );
+        bool antialized = getBoolValue( Style_Model::all_antialized );
+        QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+               aBrdBotCol = getColor( Style_Model::border_bot_clr );
+        if ( hover )
+          drawHoverRect(p, optr, opt->palette.color( QPalette::Window ), aRad, Style_Tools::Left, true);
+        else
+          Style_Tools::shadowRect( p, optr, aRad, LINE_GR_MARGIN, SHADOW, Style_Tools::Left,
+                                   getColor( Style_Model::fld_light_clr ),
+                                   getColor( Style_Model::fld_dark_clr ), aBrdTopCol,
+                                   aBrdBotCol, antialized, false );
+        QRect aBtnRect = QRect( QPoint( arUp.x(), optr.y() ), QPoint( arUp.right(), optr.bottom() ) );
+        QColor aBtnCol = opt->palette.color( QPalette::Button );
+        bool aStateOn = opt->state & ( State_Sunken | State_On );
+        if ( hover )
+          drawHoverRect(p, aBtnRect, opt->palette.color( QPalette::Window ), aRad, Style_Tools::Right, true);
+        else
+          Style_Tools::shadowRect( p, aBtnRect, aRad, 0.0, SHADOW, Style_Tools::Right,
+                                  aBtnCol.light( BUT_PERCENT_COL ), aBtnCol.dark( BUT_PERCENT_COL ),
+                                  aBrdTopCol, aBrdBotCol, antialized, true, aStateOn );
+        State flags = State_None;
+        QStyleOptionSpinBox copy;
+        PrimitiveElement pe;
+        if (spin->subControls & SC_SpinBoxUp) {
+          copy.subControls = SC_SpinBoxUp;
+          QPalette pal2 = spin->palette;
+          if (!(spin->stepEnabled & QAbstractSpinBox::StepUpEnabled) ||
+              !(spin->state & State_Enabled)) {
+            pal2.setCurrentColorGroup(QPalette::Disabled);
+            copy.state &= ~State_Enabled;
+          }
+          else
+            copy.state |= State_Enabled;
+          copy.palette = pal2;
+          if ( spin->activeSubControls == SC_SpinBoxUp && ( spin->state & State_Sunken ) ) {
+            copy.state |= State_On;
+            copy.state |= State_Sunken;
+          } else {
+            copy.state |= State_Raised;
+            copy.state &= ~State_Sunken;
+          }
+          pe = (spin->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
+               : PE_IndicatorSpinUp);
+          copy.rect = aBtnRect;
+          drawPrimitive(PE_IndicatorSpinUp, &copy, p, w);
+        }
+        if (spin->subControls & SC_SpinBoxDown) {
+          copy.subControls = SC_SpinBoxDown;
+          copy.state = spin->state;
+          QPalette pal2 = spin->palette;
+          if (!(spin->stepEnabled & QAbstractSpinBox::StepDownEnabled) ||
+               !(spin->state & State_Enabled)) {
+            pal2.setCurrentColorGroup(QPalette::Disabled);
+            copy.state &= ~State_Enabled;
+          }
+          else
+            copy.state |= State_Enabled;
+          copy.palette = pal2;
+          if (spin->activeSubControls == SC_SpinBoxDown && (spin->state & State_Sunken)) {
+             copy.state |= State_On;
+             copy.state |= State_Sunken;
+          } else {
+            copy.state |= State_Raised;
+            copy.state &= ~State_Sunken;
+          }
+          pe = (spin->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus
+               : PE_IndicatorSpinDown);
+          copy.rect = aBtnRect;
+          drawPrimitive(pe, &copy, p, w);
+        }
+       break;
+     }
+     case CC_ComboBox: {
+      if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
+        bool hover = hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver);
+        QRect optr = opt->rect,
+              ar = subControlRect( cc, cmb, SC_ComboBoxArrow, w );
+        optr.setY( ar.y() );
+        optr.setHeight( ar.height() );
+        optr.setWidth( ar.x()-optr.x()+1 );
+        bool antialized = getBoolValue( Style_Model::all_antialized );
+        double aRad = getDblValue( Style_Model::edit_rad );
+        QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+               aBrdBotCol = getColor( Style_Model::border_bot_clr );
+        if ( hover )
+          drawHoverRect(p, optr, opt->palette.color( QPalette::Window ), aRad, Style_Tools::Left, true);
+        else
+          Style_Tools::shadowRect( p, optr, aRad, LINE_GR_MARGIN, SHADOW, Style_Tools::Left,
+                                   getColor( Style_Model::fld_light_clr ),
+                                   getColor( Style_Model::fld_dark_clr ), aBrdTopCol,
+                                   aBrdBotCol, antialized, false );
+        if (cmb->subControls & SC_ComboBoxArrow) {
+          State flags = State_None;
+          QColor aBtnCol = opt->palette.color( QPalette::Button );
+          bool aStateOn = opt->state & ( State_Sunken | State_On );
+          if ( hover )
+            drawHoverRect(p, ar, opt->palette.color( QPalette::Window ), aRad, Style_Tools::Right, true);
+          else
+            Style_Tools::shadowRect( p, ar, aRad, 0.0, SHADOW, Style_Tools::Right,
+                                     aBtnCol.light( BUT_PERCENT_COL ), aBtnCol.dark( BUT_PERCENT_COL ),
+                                     aBrdTopCol, aBrdBotCol, antialized, true, aStateOn );
+          if (opt->state & State_Enabled)
+            flags |= State_Enabled;
+          if (cmb->activeSubControls == SC_ComboBoxArrow)
+            flags |= State_Sunken;
+          QStyleOption arrowOpt(0);
+          arrowOpt.rect = ar;
+          arrowOpt.palette = cmb->palette;
+          arrowOpt.state = flags;
+          drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, w);
+        }
+        if (cmb->subControls & SC_ComboBoxEditField) {
+          bool hi = cmb->state & State_HasFocus && !cmb->editable;
+          if( hi ) {
+            Style_Tools::shadowRect( p, optr, aRad, 0.0, SHADOW, Style_Tools::Left,
+                                     pal.color( QPalette::Highlight ),
+                                     pal.color( QPalette::Highlight ), aBrdTopCol, aBrdBotCol,
+                                     antialized, false );
+            p->setPen(cmb->palette.highlightedText().color());
+          }
+          else
+           p->setPen(cmb->palette.text().color());
+        }
+        break;
+      }
+    }
+    case CC_Slider: {
+        if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
+            QRect groove = subControlRect(CC_Slider, slider, SC_SliderGroove, w);
+            QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, w);
+
+            if( hasHover() && (slider->state & State_Enabled) &&
+                         (slider->state & State_MouseOver) ) {
+             QRect moderated = w->rect();
+                drawHoverRect(p, moderated, opt->palette.color( QPalette::Window ),
+                              getDblValue( Style_Model::btn_rad ), Style_Tools::All, false);
+            }
+
+            if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
+              QStyleOptionSlider tmpSlider = *slider;
+              tmpSlider.subControls = SC_SliderGroove;
+              QWindowsStyle::drawComplexControl(cc, &tmpSlider, p, w);
+            }
+            if (slider->subControls & SC_SliderTickmarks) {
+              QStyleOptionSlider tmpSlider = *slider;
+              tmpSlider.subControls = SC_SliderTickmarks;
+              QCommonStyle::drawComplexControl(cc, &tmpSlider, p, w);
+            }
+            if (slider->subControls & SC_SliderHandle) {
+              if (slider->state & State_HasFocus) {
+                QStyleOptionFocusRect fropt;
+                fropt.QStyleOption::operator=(*slider);
+                fropt.rect = subElementRect(SE_SliderFocusRect, slider, w);
+                drawPrimitive(PE_FrameFocusRect, &fropt, p, w);
+              }
+              int x = handle.x(), y = handle.y(), wi = handle.width(), he = handle.height();
+              bool horiz = slider->orientation == Qt::Horizontal;
+              bool tickAbove = slider->tickPosition == QSlider::TicksAbove;
+              bool tickBelow = slider->tickPosition == QSlider::TicksBelow;
+              QColor aBtnCol = getColor( Style_Model::slider_clr ),
+                     aBrdTopCol = getColor( Style_Model::border_top_clr ),
+                     aBrdBotCol = getColor( Style_Model::border_bot_clr );
+              // rect was changed on +/-DELTA_SLIDER value for correct painting Antialised border of slider
+              int aDelta = DELTA_SLIDER-1;
+              QRect slRect = QRect(x+aDelta, y+aDelta, wi-aDelta, he-aDelta);
+              int aXAdd = (int)(slRect.width()/6), aYAdd = (int)(slRect.height()/6);
+              Style_Tools::SliderType type = Style_Tools::SlNone;
+              if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow))
+                type = Style_Tools::SlNone;
+              else {
+                if (horiz)
+                  if (tickAbove) {
+                    type = Style_Tools::SlUp;
+                    slRect.setTop( slRect.top()-aYAdd );
+                  }
+                  else {
+                    type = Style_Tools::SlDown;
+                    slRect.setBottom( slRect.bottom()+aYAdd );
+                  }
+                else
+                  if (tickAbove) {
+                    type = Style_Tools::SlLeft;
+                    slRect.setLeft( slRect.left()-aXAdd );
+                  }
+                  else {
+                    type = Style_Tools::SlRight;
+                    slRect.setRight( slRect.right()+aXAdd );
+                 }
+              }
+              Style_Tools::drawSlider( p, slRect, getDblValue( Style_Model::slider_rad ), type,
+                                       aBtnCol.light( BUT_PERCENT_COL ),
+                                       aBtnCol.dark( BUT_PERCENT_COL ), aBrdTopCol, aBrdBotCol );
+              QRect aHRect = handle;
+              int aXRect = (int)(aHRect.width()/5),
+                  aYRect = (int)(aHRect.height()/5);
+              aHRect = QRect( aHRect.x()+aXRect, aHRect.y()+aYRect,
+                              aHRect.width()-2*aXRect, aHRect.height()-2*aYRect );
+              drawHandle( p, aHRect, horiz );
+            }
+            break;
+        }
+    }
+    case CC_ToolButton: {
+      if (const QStyleOptionToolButton *toolbutton
+           = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
+        QRect button, menuArea;
+        button = subControlRect(cc, toolbutton, SC_ToolButton, w);
+        menuArea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, w);
+
+        if (w && qobject_cast<QToolBar *>(w->parentWidget())) {
+          QWindowsStyle::drawComplexControl( cc, opt, p, w );
+          return;
+        }
+        int aMinDelta = (int)getDblValue( Style_Model::btn_rad );
+        if ( !toolbutton->icon.isNull() )
+          aMinDelta = Style_Tools::getMinDelta( toolbutton->rect, toolbutton->iconSize, aMinDelta );
+        bool aStateOn = opt->state & ( State_Sunken | State_On );
+        QColor aBtnCol = opt->palette.color( QPalette::Button ),
+               top    = aBtnCol.light( BUT_PERCENT_COL ),
+               bottom = aBtnCol.dark( BUT_PERCENT_COL );
+        bool isMenuBtn = toolbutton->features == QStyleOptionToolButton::Menu;
+        bool antialized = getBoolValue( Style_Model::all_antialized );
+        bool isAutoRaising = getBoolValue( Style_Model::auto_raising_wdg );
+        bool isHighWdg = getBoolValue( Style_Model::highlight_wdg );
+        bool hover = hasHover() && (opt->state & State_Enabled) && ( opt->state & State_MouseOver );
+        QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+               aBrdBotCol = getColor( Style_Model::border_bot_clr );
+        QRect aRect = button;
+        int aType = isMenuBtn ? Style_Tools::Left : Style_Tools::All;
+        if ( toolbutton->subControls & SC_ToolButton ) {
+          if ( isAutoRaising && hover && !aStateOn )
+            Style_Tools::shadowRect( p, aRect, aMinDelta, -1, SHADOW, aType, bottom, top, aBrdTopCol,
+                                     aBrdBotCol, antialized, true, aStateOn );
+          else if ( isHighWdg && hover && !aStateOn )
+            drawHoverRect( p, aRect, opt->palette.color( QPalette::Window ), aMinDelta, aType, true );
+          else
+            Style_Tools::shadowRect( p, aRect, aMinDelta, -1, SHADOW, aType, top, bottom,
+                                     aBrdTopCol, aBrdBotCol, antialized, true, aStateOn );
+       }
+        if (toolbutton->subControls & SC_ToolButtonMenu) {
+          p->save();
+          if ( aMinDelta > menuArea.height()/2 )
+            aMinDelta = menuArea.height()/2;
+          if ( aMinDelta > menuArea.width()/2 )
+            aMinDelta = menuArea.width()/2;
+          aRect = menuArea;
+          aType = isMenuBtn ? Style_Tools::Right : Style_Tools::All;
+          if ( isAutoRaising && hover && !aStateOn )
+            Style_Tools::shadowRect( p, aRect, aMinDelta, -1, SHADOW, aType, bottom, top,
+                                     aBrdTopCol, aBrdBotCol, antialized, true, aStateOn );
+          else if ( isHighWdg && hover && !aStateOn )
+            drawHoverRect( p, aRect, opt->palette.color( QPalette::Window ), aMinDelta, aType, true );
+          else
+            Style_Tools::shadowRect( p, aRect, aMinDelta, -1, SHADOW, aType, top, bottom,
+                                     aBrdTopCol, aBrdBotCol, antialized, true, aStateOn );
+          QStyleOption tool(0);
+          tool.palette = toolbutton->palette;
+          tool.rect = menuArea;
+          State bflags = toolbutton->state;
+          if (bflags & State_AutoRaise) {
+              if (!(bflags & State_MouseOver)) {
+                  bflags &= ~State_Raised;
+              }
+          }
+          State mflags = bflags;
+            if (toolbutton->activeSubControls & SC_ToolButton)
+                bflags |= State_Sunken;
+            if (toolbutton->activeSubControls & SC_ToolButtonMenu)
+                mflags |= State_Sunken;
+          tool.state = mflags;
+          drawPrimitive(PE_IndicatorArrowDown, &tool, p, w);
+          p->restore();
+        }
+
+        if (toolbutton->state & State_HasFocus) {
+          QStyleOptionFocusRect fr;
+          fr.QStyleOption::operator=(*toolbutton);
+          fr.rect.adjust(3, 3, -3, -3);
+          if (toolbutton->features & QStyleOptionToolButton::Menu)
+            fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator, toolbutton, w), 0);
+         Style_Tools::drawFocus( p, fr.rect, aMinDelta-1,  isMenuBtn ? Style_Tools::Left :
+                                  Style_Tools::All, aBrdBotCol );
+        }
+        QStyleOptionToolButton label = *toolbutton;
+        int fw = pixelMetric( PM_DefaultFrameWidth, opt, w );
+        label.rect = button.adjusted( fw, fw, -fw, -fw );
+        drawControl( CE_ToolButtonLabel, &label, p, w );
+
+        break;
+      }
+    }
+    case CC_TitleBar: {
+      QWindowsStyle::drawComplexControl( cc, opt, p, w );
+      break;
+    }
+    case CC_GroupBox:
+      if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const 
+                                                 QStyleOptionGroupBox *>(opt)) {
+        // Draw frame
+        QRect textRect = subControlRect( cc, opt, SC_GroupBoxLabel, w );
+        QRect checkBoxRect = subControlRect( cc, opt, SC_GroupBoxCheckBox, w);
+        if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
+          QRect aRect = subControlRect( cc, opt, SC_GroupBoxFrame, w);
+          QColor aBrdTopCol = getColor( Style_Model::border_tab_top_clr ),
+                 aBrdBotCol = getColor( Style_Model::border_tab_bot_clr );
+          Style_Tools::shadowRect( p, aRect, getDblValue( Style_Model::frame_rad ), 0.,
+                                   SHADOW, Style_Tools::All,
+                                   getColor( Style_Model::fld_light_clr ),
+                                   getColor( Style_Model::fld_dark_clr ), aBrdTopCol,
+                                   aBrdBotCol, false, false, false, false);
+        }
+        // Draw title
+        if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
+          QColor textColor = groupBox->textColor;
+          if (textColor.isValid())
+            p->setPen(textColor);
+          int alignment = int(groupBox->textAlignment);
+          if (!styleHint(QStyle::SH_UnderlineShortcut, opt, w))
+            alignment |= Qt::TextHideMnemonic;
+          QColor aColor = opt->palette.color( QPalette::Window );
+          Style_Tools::arrowRect( p, textRect, opt->palette.color( QPalette::Dark ),
+                                 aColor.dark(BUT_PERCENT_COL), aColor );
+          drawItemText(p, textRect,  Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
+                       pal, groupBox->state & State_Enabled, groupBox->text,
+                       textColor.isValid() ? QPalette::NoRole : QPalette::WindowText);
+          if (groupBox->state & State_HasFocus) {
+            QStyleOptionFocusRect fropt;
+            fropt.QStyleOption::operator=(*groupBox);
+            fropt.rect = textRect;
+            drawPrimitive(PE_FrameFocusRect, &fropt, p, w);
+          }
+        }
+        // Draw checkbox
+        if (groupBox->subControls & SC_GroupBoxCheckBox) {
+            QStyleOptionButton box;
+          box.QStyleOption::operator=(*groupBox);
+          box.rect = checkBoxRect;
+          drawPrimitive(PE_IndicatorCheckBox, &box, p, w);
+        }
+        break;
+      }
+    case CC_Dial: {
+      QWindowsStyle::drawComplexControl( cc, opt, p, w );
+      break;
+    }
+    default:
+      QWindowsStyle::drawComplexControl( cc, opt, p, w );
+  }
+}
+
+void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt,
+                               QPainter* p, const QWidget* w ) const
+{
+  switch ( ce ) {
+    case CE_PushButton:
+      if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
+        drawControl(CE_PushButtonBevel, btn, p, w);
+        QStyleOptionButton subopt = *btn;
+        subopt.rect = subElementRect(SE_PushButtonContents, btn, w);
+        drawControl(CE_PushButtonLabel, &subopt, p, w);
+        if (btn->state & State_HasFocus) {
+          QRect aRect = subElementRect( SE_PushButtonFocusRect, btn, w );
+         Style_Tools::drawFocus( p, aRect, getDblValue(Style_Model:: btn_rad ),
+                                  Style_Tools::All, getColor( Style_Model::border_bot_clr ) );
+        }
+       break;
+      }
+    case CE_PushButtonBevel:
+      if ( qstyleoption_cast<const QStyleOptionButton *>(opt) ) {
+        double aRad = getDblValue( Style_Model::btn_rad );
+        bool aStateOn = opt->state & ( State_Sunken | State_On );
+        bool isAutoRaising = getBoolValue( Style_Model::auto_raising_wdg );
+        bool isHighWdg = getBoolValue( Style_Model::highlight_wdg );
+        bool enabled = opt->state & State_Enabled;
+        bool hover = hasHover() && enabled && ( opt->state & State_MouseOver );
+
+        QColor aBtnCol = opt->palette.color( QPalette::Button );
+        QColor top = aBtnCol.light( BUT_PERCENT_COL ),
+              bottom = aBtnCol.dark( BUT_PERCENT_COL );
+        QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+              aBrdBotCol = getColor( Style_Model::border_bot_clr );
+        QRect r = opt->rect;
+        bool antialized = getBoolValue( Style_Model::all_antialized );
+        if ( isAutoRaising && hover && !aStateOn )
+          Style_Tools::shadowRect( p, r, aRad, -1, SHADOW, Style_Tools::All, bottom, top,
+                                   aBrdTopCol, aBrdBotCol, antialized, true, aStateOn );
+        else if ( isHighWdg && hover && !aStateOn )
+          drawHoverRect( p, r, opt->palette.color( QPalette::Window ), aRad, Style_Tools::All, true );
+       else
+          Style_Tools::shadowRect( p, r, aRad, -1, SHADOW, Style_Tools::All, top, bottom,
+                                   aBrdTopCol, aBrdBotCol, antialized, true, aStateOn );
+       break;
+      }
+      case CE_DockWidgetTitle:
+        if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) {
+          bool floating = false;
+          int menuOffset = 0; //used to center text when floated
+          QColor inactiveCaptionTextColor = opt->palette.color( QPalette::HighlightedText );
+          const QDockWidget *dockWidget = qobject_cast<const QDockWidget *>(w);
+          //Titlebar gradient
+          if (dockWidget) {
+            if ( dockWidget->isFloating() && dwOpt->movable) {
+              floating = true;
+              QColor top = opt->palette.color( QPalette::Highlight ).light();
+              QColor bottom = opt->palette.color( QPalette::Highlight );
+              menuOffset = 2;
+              QBrush fillBrush(bottom);
+              if (top != bottom) {
+                QPoint p1(dwOpt->rect.x(), dwOpt->rect.y());
+                QPoint p2(dwOpt->rect.x(), dwOpt->rect.bottom() );
+                QLinearGradient lg(p1, p2);
+                lg.setColorAt(0, top);
+                lg.setColorAt(1, bottom);
+                fillBrush = lg;
+              }
+              p->fillRect(dwOpt->rect.adjusted(0, 0, 0, -3), fillBrush);
+            }
+            else {
+              QRect r = dwOpt->rect.adjusted(0, 0, -1, -1); 
+              QColor bottom = opt->palette.color( QPalette::Window ),
+                     top =    bottom.dark( BUT_PERCENT_COL );
+              QRect aRect = dwOpt->rect;
+              QLinearGradient gr( aRect.x(), aRect.y(), aRect.x(), aRect.y()+aRect.height() );
+              gr.setColorAt( 0.0, top );
+              gr.setColorAt( 0.4, bottom );
+              gr.setColorAt( 0.6, bottom );
+              gr.setColorAt( 1.0, top );
+              p->fillRect( r, gr );
+
+              QColor aBrdTopCol = getColor( Style_Model::border_tab_top_clr ),
+                     aBrdBotCol = getColor( Style_Model::border_tab_bot_clr );
+              p->setPen( aBrdTopCol );
+              p->drawLine( r.x(), r.bottom(), r.x(), r.y() );
+              p->drawLine( r.x(), r.y(), r.right(), r.y() );
+              p->setPen( aBrdBotCol );
+              p->drawLine( r.x(), r.bottom(), r.right(), r.bottom() );
+              p->drawLine( r.right(), r.bottom(), r.right(), r.y() );
+            }
+          }
+          p->setPen(dwOpt->palette.color(QPalette::Light));
+
+          QString aTitle = dwOpt->title;
+          if (!aTitle.isEmpty()) {
+            int aMargin  = pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, w);
+            const int indent = p->fontMetrics().descent();
+            QRect r = dwOpt->rect.adjusted(indent + 1, - menuOffset, -indent - 1, -1);
+            QPixmap aPxm = standardPixmap( SP_DockWidgetCloseButton, opt, w);
+            int aWidth = r.width() - aPxm.width()-2/*button margins*/;
+            aPxm = standardPixmap( SP_TitleBarNormalButton, opt, w);
+            aWidth = aWidth - aPxm.width()-2/*button margins*/;
+            r = QRect( r.x(), r.y(), aWidth-aMargin-2/*buttons separator*/-2/*margin from text*/, r.height() );
+
+            QFont oldFont = p->font();
+            QFont font = oldFont;
+            if (floating) {
+              font.setBold(true);
+              p->setFont(font);
+            }
+            aTitle = titleText( aTitle, r.width(), r.height(), font );
+
+            QPalette palette = dwOpt->palette;
+            palette.setColor(QPalette::Window, inactiveCaptionTextColor);
+            bool active = dwOpt->state & State_Active;
+            //const int indent = p->fontMetrics().descent();
+            drawItemText(p, r, Qt::AlignLeft | Qt::AlignVCenter, palette,
+                         dwOpt->state & State_Enabled, aTitle,
+                         floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText);
+            p->setFont(oldFont);
+         }
+         break;
+        }
+    case CE_Splitter: {
+      QWindowsStyle::drawControl( ce, opt, p, w );
+      QRect r = opt->rect;
+      bool horiz = r.width() > r.height();
+      int aLen = (int)getDblValue( Style_Model::split_handle_len );
+      if ( horiz )
+        r = QRect( r.x() +(int)((r.width()-aLen)/2), r.y(), aLen, r.height());
+      else
+        r = QRect( r.x(), r.y() +(int)((r.height()-aLen)/2), r.width(), aLen);
+      drawHandle( p, r, horiz, true );
+      break;
+    }
+    case CE_TabBarTabShape:
+      if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
+        if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast ||
+            tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::RoundedWest) {
+          p->save();
+          QRect tabRect = opt->rect;
+          // line under selected tab bar object
+          bool isSelected = opt->state & State_Selected;
+          bool isLast = tab->position == QStyleOptionTab::End;
+         QColor aColor = opt->palette.color( QPalette::Window ),
+                 aDarkColor = aColor.dark( BUT_PERCENT_ON );
+          QColor aBrdTopCol = getColor( Style_Model::border_tab_top_clr ),
+                 aBrdBotCol = getColor( Style_Model::border_tab_bot_clr );
+
+          bool isHover = hasHover() && (opt->state & State_Enabled) &&
+                                       (opt->state & State_MouseOver);
+          if ( isHover && !isSelected && !getBoolValue( Style_Model::auto_raising_wdg ) &&
+               getBoolValue( Style_Model::highlight_wdg) ) {
+            aColor = getColor( Style_Model::high_wdg_clr );
+            aDarkColor = getColor( Style_Model::high_brd_wdg_clr );
+          }
+          Style_Tools::tabRect( p, tabRect, (int)tab->shape,
+                                getDblValue( Style_Model::frame_rad ),
+                                DELTA_H_TAB, aColor, aDarkColor,
+                                aBrdTopCol, aBrdBotCol, isSelected, isLast, isHover );
+          p->restore();
+       } else
+           QCommonStyle::drawControl(ce, opt, p, w);
+        break;
+      }
+    case CE_TabBarTabLabel:
+      if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
+       if ( tab->position == QStyleOptionTab::End ) {
+          QRect oldRect = opt->rect;
+          int aDelta = 0;
+          if ( tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedSouth ) {
+            aDelta = (int)(opt->rect.height()*DELTA_H_TAB/2);
+            oldRect = QRect( oldRect.topLeft(), QPoint( oldRect.right()-aDelta, oldRect.bottom() ) );
+          }
+         else {
+            aDelta = (int)(opt->rect.width()*DELTA_H_TAB/2);
+            oldRect = QRect( oldRect.topLeft(), QPoint( oldRect.right(), oldRect.bottom()-aDelta ) );
+         }
+          QStyleOptionTab* copyTab = (QStyleOptionTab*)tab;
+          copyTab->rect = oldRect;
+          QWindowsStyle::drawControl( ce, copyTab, p, w );
+       }
+        else
+          QWindowsStyle::drawControl( ce, opt, p, w );
+        break;
+      }
+    case CE_MenuBarItem:
+      if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
+        if ( w )
+          drawBackground( p, w->rect(), opt->palette.color( QPalette::Window ), true, true, true );
+        bool active = mbi->state & State_Selected;
+        bool hasFocus = mbi->state & State_HasFocus;
+        bool down = mbi->state & State_Sunken;
+        QStyleOptionMenuItem newMbi = *mbi;
+        if (active || hasFocus) {
+          QBrush b( opt->palette.color( QPalette::Window ) );
+          if (active && down)
+            p->setBrushOrigin(p->brushOrigin() + QPoint(1, 1));
+          if ( active && hasFocus) {
+            bool aStateOn = opt->state & (State_Sunken | State_On);
+            QColor aBtnCol = opt->palette.color( QPalette::Window ),
+                   top =    aBtnCol.light( BUT_PERCENT_ON ),
+                   bottom = aBtnCol.dark( BUT_PERCENT_ON );
+            QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+                   aBrdBotCol = getColor( Style_Model::border_bot_clr );
+            bool aHighWdg = hasHover() && !getBoolValue( Style_Model::auto_raising_wdg ) &&
+                            getBoolValue( Style_Model::highlight_wdg );
+            if ( !aStateOn && aHighWdg && (opt->state & State_Enabled) &&
+                 (opt->state & State_Selected) )
+              drawHoverRect(p, opt->rect, opt->palette.color( QPalette::Window ), 0, Style_Tools::All, true);
+            else {
+              Style_Tools::shadowRect( p, opt->rect, 0, 0., SHADOW, Style_Tools::All, top, bottom,
+                                   aBrdTopCol, aBrdBotCol,
+                                   getBoolValue( Style_Model::all_antialized ), true, aStateOn );
+            }
+          }
+          if (active && down) {
+            newMbi.rect.translate(pixelMetric(PM_ButtonShiftHorizontal, mbi, w),
+                                  pixelMetric(PM_ButtonShiftVertical, mbi, w));
+            p->setBrushOrigin(p->brushOrigin() - QPoint(1, 1));
+          }
+        }
+        QCommonStyle::drawControl(ce, &newMbi, p, w);
+        break;
+      }
+    case CE_MenuBarEmptyArea:
+      drawBackground( p, opt->rect, opt->palette.color( QPalette::Window ), true, true, true );
+      break;
+    case CE_ProgressBarGroove: {
+      QColor aBgColor = opt->palette.color( QPalette::Window ),
+       top =    aBgColor.light( BUT_PERCENT_ON ),
+        bottom = aBgColor.dark( BUT_PERCENT_ON );
+      QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+             aBrdBotCol = getColor( Style_Model::border_bot_clr );
+      Style_Tools::shadowRect( p, opt->rect, getDblValue( Style_Model::edit_rad ), -1,
+                               SHADOW, Style_Tools::All, top, bottom, aBrdTopCol, aBrdBotCol,
+                               getBoolValue( Style_Model::all_antialized ), true );
+      break;
+      }
+    case CE_ProgressBarLabel:
+      if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
+        // implementation from qplastiquestyle
+        // The busy indicator doesn't draw a label
+        if (bar->minimum == 0 && bar->maximum == 0)
+          return;
+        p->save();
+        QRect rect = bar->rect;
+        QRect leftRect;
+        p->setPen(bar->palette.text().color());
+
+        bool vertical = false;
+        bool inverted = false;
+        bool bottomToTop = false;
+        // Get extra style options if version 2
+        if (const QStyleOptionProgressBarV2 *bar2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(opt)) {
+          vertical = (bar2->orientation == Qt::Vertical);
+          inverted = bar2->invertedAppearance;
+          bottomToTop = bar2->bottomToTop;
+        }
+        if (vertical) {
+          rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
+          QMatrix m;
+          if (bottomToTop) {
+            m.translate(0.0, rect.width());
+            m.rotate(-90);
+          } else {
+            m.translate(rect.height(), 0.0);
+            m.rotate(90);
+          }
+          p->setMatrix(m);
+        }
+        int progressIndicatorPos = int(((bar->progress - bar->minimum) / double(bar->maximum - bar->minimum)) * rect.width());
+        bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted)
+                    || ((bar->direction == Qt::LeftToRight) && inverted))) || (vertical && ((!inverted && !bottomToTop) || (inverted && bottomToTop)));
+        if (flip) {
+          int indicatorPos = rect.width() - progressIndicatorPos;
+          if (indicatorPos >= 0 && indicatorPos <= rect.width()) {
+            p->setPen(bar->palette.base().color());
+            leftRect = QRect(rect.left(), rect.top(), indicatorPos, rect.height());
+          } else if (indicatorPos > rect.width()) {
+            p->setPen(bar->palette.text().color());
+          } else {
+            p->setPen(bar->palette.base().color());
+          }
+        } else {
+          if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width()) {
+            leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height());
+          } else if (progressIndicatorPos > rect.width()) {
+            p->setPen(bar->palette.base().color());
+          } else {
+            p->setPen(bar->palette.text().color());
+          }
+        }
+
+        p->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
+        if (!leftRect.isNull()) {
+          p->setPen(flip ? bar->palette.text().color() : bar->palette.base().color());
+          p->setClipRect(leftRect, Qt::IntersectClip);
+          p->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
+        }
+        p->restore();
+      }
+      break;
+    case CE_ProgressBarContents:
+      if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
+        QRect rect = pb->rect;
+        bool vertical = false;
+        bool inverted = false;
+        // Get extra style options if version 2
+        const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(opt);
+        if (pb2) {
+          vertical = (pb2->orientation == Qt::Vertical);
+          inverted = pb2->invertedAppearance;
+        }
+        QMatrix m;
+        if (vertical) {
+          rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
+          m.translate(rect.height(), 0.0);
+          m.rotate(90);
+        }
+        QPalette pal2 = pb->palette;
+        // Correct the highlight color if it is the same as the background
+        if (pal2.highlight() == pal2.background())
+            pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active,
+                                                                 QPalette::Highlight));
+        bool reverse = ((!vertical && (pb->direction == Qt::RightToLeft)) || vertical);
+        if (inverted)
+          reverse = !reverse;
+        int fw = 2;
+        int width = rect.width() - 2 * fw;
+        if (pb->minimum == 0 && pb->maximum == 0) {
+          // draw busy indicator
+          int x = (pb->progress - pb->minimum) % (width * 2);
+          if (x > width)
+            x = 2 * width - x;
+          x = reverse ? rect.right() - x : x + rect.x();
+          p->setPen(QPen(pal2.highlight().color(), 4));
+          p->drawLine(x, rect.y() + 1, x, rect.height() - fw);
+        } else {
+          const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, pb, w);
+          int u;
+          if (unit_width > 1)
+            u = (rect.width() + unit_width / 3) / unit_width;
+          else
+            u = width / unit_width;
+
+          int p_v = pb->progress - pb->minimum;
+          int t_s = pb->maximum - pb->minimum ? pb->maximum - pb->minimum : 1;
+
+          if (u > 0 && p_v >= INT_MAX / u && t_s >= u) {
+            // scale down to something usable.
+            p_v /= u;
+            t_s /= u;
+          }
+
+          // nu < tnu, if last chunk is only a partial chunk
+          int tnu, nu;
+          tnu = nu = p_v * u / t_s;
+
+          if (nu * unit_width > width)
+            --nu;
+
+          // Draw nu units out of a possible u of unit_width
+          // width, each a rectangle bordered by background
+          // color, all in a sunken panel with a percentage text
+          // display at the end.
+          int x = 0;
+          int x0 = reverse ? rect.right() - ((unit_width > 1) ? unit_width : fw)
+                           : rect.x() + fw;
+          QStyleOptionProgressBarV2 pbBits = *pb;
+          pbBits.rect = rect;
+          pbBits.palette = pal2;
+          int myY = pbBits.rect.y();
+          int myHeight = pbBits.rect.height();
+          pbBits.state = State_None;
+          QRect aRect;
+          QColor aColor = getColor( Style_Model::prbar_clr ),
+           top =    aColor.light( BUT_PERCENT_COL ),
+            bottom = aColor.dark( BUT_PERCENT_COL );
+          int aType;
+          for (int i = 0; i <= nu; ++i) {
+            aType = Style_Tools::None;
+            if ( i < nu ) { // not last element
+              aRect = QRect(x0 + x, myY, unit_width, myHeight);
+              if ( i == 0 ) {
+                if ( reverse )
+                  aRect.setRight( aRect.right()-fw );
+                if ( vertical )
+                  aType = reverse ? Style_Tools::BottomLeft | Style_Tools::BottomRight
+                                  : Style_Tools::TopLeft | Style_Tools::TopRight;
+                else
+                  aType = reverse ? Style_Tools::Right : Style_Tools::Left;
+              }
+            }
+            else { // last element if it's necessary
+              if ( nu >= tnu )
+                break;
+              int pixels_left = width - (nu * unit_width);
+              int offset = reverse ? x0 + x + unit_width-pixels_left : x0 + x;
+              aRect = QRect(offset, myY, pixels_left, myHeight);
+              if ( vertical )
+                aType = reverse ? Style_Tools::TopLeft | Style_Tools::TopRight
+                                : Style_Tools::BottomLeft | Style_Tools::BottomRight;
+              else
+                aType = reverse ? Style_Tools::Left : Style_Tools::Right;
+            }
+            // display
+            aRect = m.mapRect(aRect);
+            if ( vertical )
+              aRect = QRect(aRect.x(), aRect.y()+fw, aRect.width(), aRect.height());
+
+            if ( !vertical )
+              aRect = QRect(aRect.x()+1, aRect.y()+2, aRect.width()-1,
+                            aRect.height()-4);
+            else
+              aRect = QRect(aRect.x()+1, aRect.y()-1, aRect.width()-5, aRect.height()-1);
+            QColor aTopClr = aColor, aBotClr = aColor;
+            if ( unit_width > 1 ) {
+              aTopClr = aColor.light();
+              aBotClr = aColor.dark();
+           }
+            Style_Tools::shadowRect( p, aRect, getDblValue( Style_Model::edit_rad ), -1, 0,
+                                     aType, top, bottom, aTopClr, aBotClr, false, true );
+            x += reverse ? -unit_width : unit_width;
+          }
+        }
+      }
+      break;
+    case CE_MenuItem:
+      if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
+        const int windowsItemFrame    =  2; // definitions from qwindowstyle.cpp file
+        const int windowsItemHMargin  =  3;
+        const int windowsItemVMargin  =  2;
+        const int windowsRightBorder  = 15;
+        const int windowsArrowHMargin =  6;
+        int x, y, width, h;
+        menuitem->rect.getRect(&x, &y, &width, &h);
+        int tab = menuitem->tabWidth;
+        bool dis = !(menuitem->state & State_Enabled);
+        bool checked = menuitem->checkType != QStyleOptionMenuItem::NotCheckable
+                       ? menuitem->checked : false;
+        bool act = menuitem->state & State_Selected;
+
+        // windows always has a check column, regardless whether we have an icon or not
+        int checkcol = qMax(menuitem->maxIconWidth, 20);
+
+        QColor aBgColor = opt->palette.color( QPalette::Window );
+        double aMargin = LINE_GR_MARGIN;
+        QLinearGradient gr(x,y,menuitem->rect.right(),y);
+        gr.setColorAt( 0.0, aBgColor );
+        gr.setColorAt( aMargin/width, getColor( Style_Model::fld_light_clr ) );
+        gr.setColorAt( 1.0, getColor( Style_Model::fld_light_clr ) );
+        QBrush fill;
+        if ( act )
+          fill = menuitem->palette.brush( QPalette::Highlight );
+        else
+          fill = QBrush( gr );
+        p->fillRect(menuitem->rect, fill);
+        if (menuitem->menuItemType == QStyleOptionMenuItem::Separator){
+          int yoff = y-1 + h / 2;
+          QColor aBrdTopCol = getColor( Style_Model::border_tab_top_clr ),
+                 aBrdBotCol = getColor( Style_Model::border_tab_bot_clr );
+          p->setPen( aBrdBotCol );
+          p->drawLine(x + 2, yoff, x + width - 4, yoff);
+          p->setPen( aBrdTopCol );
+          p->drawLine(x + 2, yoff + 1, x + width - 4, yoff + 1);
+          return;
+        }
+        QRect vCheckRect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x(),
+                                      menuitem->rect.y(), checkcol, menuitem->rect.height()));
+        if (checked) {
+          if (act && !dis)
+            qDrawShadePanel(p, vCheckRect, menuitem->palette, true, 1, new QBrush(aBgColor));
+          else {
+            QColor aCol = aBgColor;
+            aCol.setAlpha( 80 );
+            QBrush fill(aCol);
+            qDrawShadePanel(p, vCheckRect, menuitem->palette, true, 1, &fill);
+          }
+        } else if (!act)
+          p->fillRect(vCheckRect, QBrush( gr ) );
+        // On Windows Style, if we have a checkable item and an icon we
+        // draw the icon recessed to indicate an item is checked. If we
+        // have no icon, we draw a checkmark instead.
+        if (!menuitem->icon.isNull()) {
+          QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
+          if (act && !dis)
+            mode = QIcon::Active;
+          QPixmap pixmap;
+          if (checked)
+            pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode, QIcon::On);
+          else
+            pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode);
+          int pixw = pixmap.width();
+          int pixh = pixmap.height();
+          if (act && !dis && !checked)
+            qDrawShadePanel(p, vCheckRect,  menuitem->palette, false, 1,
+                            new QBrush(aBgColor));
+          QRect pmr(0, 0, pixw, pixh);
+          pmr.moveCenter(vCheckRect.center());
+          p->setPen(menuitem->palette.text().color());
+          p->drawPixmap(pmr.topLeft(), pixmap);
+        } else if (checked) {
+          QStyleOptionMenuItem newMi = *menuitem;
+          newMi.state = State_None;
+          if (!dis)
+            newMi.state |= State_Enabled;
+          if (act)
+            newMi.state |= State_On;
+          newMi.rect = visualRect(opt->direction, menuitem->rect,
+          QRect(menuitem->rect.x() + windowsItemFrame, menuitem->rect.y() + windowsItemFrame,
+                checkcol - 2 * windowsItemFrame, menuitem->rect.height() - 2*windowsItemFrame));
+          drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, w);
+        }
+        p->setPen(act ? menuitem->palette.highlightedText().color() :
+                        menuitem->palette.buttonText().color());
+        QColor discol;
+        if (dis) {
+          discol = menuitem->palette.text().color();
+          p->setPen(discol);
+        }
+        int xm = windowsItemFrame + checkcol + windowsItemHMargin;
+        int xpos = menuitem->rect.x() + xm;
+        QRect textRect(xpos, y + windowsItemVMargin, width - xm - windowsRightBorder - tab + 1,
+                       h - 2 * windowsItemVMargin);
+        QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);
+        QString s = menuitem->text;
+        if (!s.isEmpty()) {                     // draw text
+          p->save();
+          int t = s.indexOf(QLatin1Char('\t'));
+          int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip |
+                           Qt::TextSingleLine;
+          if (!styleHint(SH_UnderlineShortcut, menuitem, w))
+            text_flags |= Qt::TextHideMnemonic;
+          text_flags |= Qt::AlignLeft;
+          if (t >= 0) {
+            QRect vShortcutRect = visualRect(opt->direction, menuitem->rect, 
+            QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
+            if (dis && !act) {
+               p->setPen(menuitem->palette.light().color());
+               p->drawText(vShortcutRect.adjusted(1,1,1,1), text_flags, s.mid(t + 1));
+               p->setPen(discol);
+             }
+             p->drawText(vShortcutRect, text_flags, s.mid(t + 1));
+             s = s.left(t);
+          }
+          QFont font = menuitem->font;
+          if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
+            font.setBold(true);
+            p->setFont(font);
+            if (dis && !act) {
+              p->setPen(menuitem->palette.light().color());
+              p->drawText(vTextRect.adjusted(1,1,1,1), text_flags, s.left(t));
+              p->setPen(discol);
+            }
+            p->drawText(vTextRect, text_flags, s.left(t));
+            p->restore();
+          }
+          if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
+            int dim = (h - 2 * windowsItemFrame) / 2;
+            PrimitiveElement arrow;
+            arrow = (opt->direction == Qt::RightToLeft) ? PE_IndicatorArrowLeft :
+                     PE_IndicatorArrowRight;
+            xpos = x + width - windowsArrowHMargin - windowsItemFrame - dim;
+            QRect  vSubMenuRect = visualRect(opt->direction, menuitem->rect,
+                                             QRect(xpos, y + h / 2 - dim / 2, dim, dim));
+            QStyleOptionMenuItem newMI = *menuitem;
+            newMI.rect = vSubMenuRect;
+            newMI.state = dis ? State_None : State_Enabled;
+            if (act)
+              newMI.palette.setColor(QPalette::ButtonText,
+                                     newMI.palette.highlightedText().color());
+            drawPrimitive(arrow, &newMI, p, w);
+          }
+        }
+      break;
+    case CE_HeaderSection: {
+      bool aStateOn = opt->state & State_On;
+      QColor aColor = getColor( Style_Model::header_clr );
+      QColor  top =    aColor.light( BUT_PERCENT_COL ),
+             bottom =  aColor.dark( BUT_PERCENT_COL );
+      QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+             aBrdBotCol = getColor( Style_Model::border_bot_clr );
+      Style_Tools::shadowRect( p, opt->rect, 0, -1, 0, Style_Tools::All, top, bottom, aBrdTopCol,
+                       aBrdBotCol, getBoolValue( Style_Model::all_antialized ), true, aStateOn );
+      break;
+    }
+    case CE_ComboBoxLabel:
+      if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
+        QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, w);
+        p->save();
+        p->setClipRect(editRect);
+        if (!cb->currentIcon.isNull()) {
+          QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
+                                                       : QIcon::Disabled;
+          QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
+          QRect iconRect(editRect);
+          iconRect.setWidth(cb->iconSize.width() + 4);
+          QRect alignRect = editRect;
+          if ( cb->editable ) {
+            int aHalfRect = (int)Style_Tools::getMaxRect( iconRect, 
+                               (int)getDblValue( Style_Model::edit_rad )/2 );
+            alignRect.setLeft( alignRect.left() + aHalfRect );
+            alignRect.setRight( alignRect.right() - aHalfRect );
+          }
+          iconRect = alignedRect(QApplication::layoutDirection(),
+                                 Qt::AlignLeft | Qt::AlignVCenter,
+                                 iconRect.size(), alignRect);
+         // Here's absent filling of pixmap on basic color for editable comboBox
+          drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap);
+
+          if (cb->direction == Qt::RightToLeft)
+            editRect.translate(-4 - cb->iconSize.width(), 0);
+          else
+            editRect.translate(cb->iconSize.width() + 4, 0);
+        }
+        if (!cb->currentText.isEmpty() && !cb->editable) {
+          drawItemText(p, editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, cb->palette,
+                       cb->state & State_Enabled, cb->currentText);
+        }
+        p->restore();
+      }
+      break;
+    case CE_ScrollBarSubLine:
+    case CE_ScrollBarAddLine: {
+        bool aStateOn = opt->state & ( State_Sunken | State_On );
+        QColor aBtnCol = opt->palette.color( QPalette::Button );
+        QColor top =    aBtnCol.light( BUT_PERCENT_COL ),
+               bottom = aBtnCol.dark( BUT_PERCENT_COL );
+        QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+               aBrdBotCol = getColor( Style_Model::border_bot_clr );
+        Style_Tools::shadowRect( p, opt->rect, 0, -1, 0, Style_Tools::All, top, bottom, aBrdTopCol,
+                                 aBrdBotCol, false, true, aStateOn, true );
+      PrimitiveElement arrow;
+      if (opt->state & State_Horizontal) {
+        if (ce == CE_ScrollBarAddLine)
+          arrow = opt->direction == Qt::LeftToRight ? PE_IndicatorArrowRight : PE_IndicatorArrowLeft;
+        else
+          arrow = opt->direction == Qt::LeftToRight ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
+      } else {
+        if (ce == CE_ScrollBarAddLine)
+          arrow = PE_IndicatorArrowDown;
+        else
+          arrow = PE_IndicatorArrowUp;
+      }
+      drawPrimitive(arrow, opt, p, w);
+      break;
+    }
+    case CE_ScrollBarSlider:
+      if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
+        p->save();
+        p->setRenderHint( QPainter::Antialiasing, true );
+        bool enabled = opt->state & State_Enabled;
+        bool horiz = scrollbar->orientation == Qt::Horizontal;
+        double aRad = getDblValue( Style_Model::btn_rad );
+        if ( hasHover() && enabled && (opt->state & State_MouseOver) )
+         drawHoverRect(p, opt->rect, opt->palette.color( QPalette::Window ), aRad, Style_Tools::All, false);
+        else {
+          QColor aColor = getColor( Style_Model::slider_clr );
+          if ( !enabled )
+            aColor = opt->palette.button().color();
+         QColor top =    aColor.light( BUT_PERCENT_ON ),
+                 bottom = aColor.dark( BUT_PERCENT_ON );
+          QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+                 aBrdBotCol = getColor( Style_Model::border_bot_clr );
+          QRect r = opt->rect;
+          QPainterPath path = Style_Tools::roundRect( r, aRad,
+                                                      Style_Tools::All );
+          QLinearGradient gr;
+          if (horiz)
+            gr = QLinearGradient(r.x(), r.y(), r.x(), r.bottom());
+          else
+            gr = QLinearGradient(r.x(), r.y(), r.right(), r.y());
+          gr.setColorAt( 0.0, bottom );
+          gr.setColorAt( 0.5, top );
+          gr.setColorAt( 1.0, bottom );
+
+          p->fillPath( path, gr );
+          p->strokePath( path, aBrdTopCol );
+      }
+      p->setRenderHint( QPainter::Antialiasing, false );
+      // draw handle
+      QRect aRect = opt->rect;
+      int aWidth = aRect.width(), aHeight = aRect.height();
+      if ( aWidth > aHeight + aRad )
+        aRect = QRect( aRect.x() + (int)((aWidth-aHeight)/2),
+                       aRect.y(), aHeight, aHeight );
+      else if ( aHeight > aWidth + aRad )
+        aRect = QRect( aRect.x(), aRect.y() + (int)((aHeight-aWidth)/2),
+                       aWidth, aWidth );
+      else {
+        int aRad2 = (int)(aRad/3);
+        aRect = QRect( aRect.x()+aRad2, aRect.y()+aRad2, aRect.width()-2*aRad2, aRect.height()-2*aRad2  );
+      }
+      drawHandle( p, aRect, horiz, true );
+
+      p->restore();
+      break;
+    }
+  case CE_ToolBar: {
+    QRect r = w->rect();
+    bool horiz = opt->state & State_Horizontal;
+    drawBackground( p, r, opt->palette.color( QPalette::Window ), true, true, horiz );
+    p->setRenderHint( QPainter::Antialiasing, false );
+    drawBorder( p, r, horiz );
+    break;
+  }
+  default:
+      QWindowsStyle::drawControl( ce, opt, p, w );
+  }
+}
+
+void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt,
+                                 QPainter* p, const QWidget* w ) const
+{
+  const QPalette& pal = opt->palette;
+  bool doRestore = false;
+  switch ( pe ) {
+    case PE_FrameMenu:
+      if (qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
+        QColor aBtnCol = opt->palette.color( QPalette::Window ),
+               top =    aBtnCol.light( BUT_PERCENT_ON ),
+               bottom = aBtnCol.dark( BUT_PERCENT_ON );
+        QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+               aBrdBotCol = getColor( Style_Model::border_bot_clr );
+        Style_Tools::shadowRect( p, opt->rect, 0, 0., SHADOW, Style_Tools::All, top,
+                                 bottom, aBrdTopCol, aBrdBotCol, false, false, false, false );
+        break;
+      }
+    case PE_PanelButtonTool : {
+      if ( w && ( opt->state & State_Enabled ) && 
+           ( ( qobject_cast<QToolBar*>( w->parentWidget() ) ) ||
+            ( w->inherits("QDockWidgetTitleButton") ) ||
+             ( w->inherits("QtxWorkstackAreaTitleButton") ) ) ) {
+        bool aStateOn = opt->state & (State_Sunken | State_On);
+        bool aHighWdg = hasHover() && !getBoolValue( Style_Model::auto_raising_wdg ) &&
+                        getBoolValue( Style_Model::highlight_wdg );
+        if ( !aStateOn && aHighWdg && (opt->state & State_Enabled) &&
+             (opt->state & State_MouseOver) )
+          drawHoverRect(p, opt->rect, opt->palette.color( QPalette::Window ), 0, Style_Tools::All, true);
+        else {
+          QColor aBtnCol = opt->palette.color( QPalette::Window );
+          QColor aBrdTopCol = getColor( Style_Model::border_tab_top_clr ),
+                 aBrdBotCol = getColor( Style_Model::border_tab_bot_clr );
+          QColor top =    aBtnCol.light( BUT_PERCENT_COL ),
+                 bottom = aBtnCol.dark( BUT_PERCENT_COL );
+          Style_Tools::shadowRect( p, opt->rect, 0.0, 0, SHADOW, Style_Tools::All, top, bottom,
+           aBrdTopCol, aBrdBotCol, getBoolValue( Style_Model::all_antialized ), true, aStateOn );
+       }
+       break;
+      }
+      else
+        QWindowsStyle::drawPrimitive( pe, opt, p, w );
+    }
+    break;
+    case PE_FrameFocusRect: {
+      if (w && qobject_cast<QTabBar*>((QWidget*)w)) {
+        QTabBar* tabBar = qobject_cast<QTabBar*>((QWidget*)w);
+        QColor aBrdTopCol = getColor( Style_Model::border_tab_top_clr ),
+               aBrdBotCol = getColor( Style_Model::border_tab_bot_clr );
+        bool isHover = hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver);
+        Style_Tools::tabRect( p, opt->rect, (int)tabBar->shape(),
+                              getDblValue( Style_Model::frame_rad ), DELTA_H_TAB,
+                              pal.color( QPalette::Window ),
+                              getColor( Style_Model::border_bot_clr ),
+                              aBrdTopCol, aBrdBotCol, false, false, isHover, true );
+        break;
+      }
+      else
+        QWindowsStyle::drawPrimitive( pe, opt, p, w );
+      break;
+    }
+    case PE_IndicatorArrowRight:
+    case PE_IndicatorArrowLeft:
+    case PE_IndicatorArrowUp:
+    case PE_IndicatorArrowDown:
+    case PE_IndicatorSpinUp:
+    case PE_IndicatorSpinDown: {
+      QRect rect = opt->rect;
+      QColor pen, brush;
+      if ( opt->state & State_Enabled ) {
+        pen = getColor( Style_Model::pointer_clr );
+       brush = opt->palette.color( QPalette::Button );
+        if ( ( opt->state & State_Sunken ) && (opt->state & State_Enabled ) )
+          rect.moveTo( rect.x()+1, rect.y()+1 );
+      } else {
+        pen = opt->palette.mid().color();
+       brush = pen;
+      }
+      Style_Tools::drawArrow( pe, p, rect, pen, brush );
+      break;
+    }
+    case PE_IndicatorCheckBox: {
+      if ( hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver) )
+        drawHoverRect(p, w->rect(), opt->palette.color( QPalette::Window ), getDblValue( Style_Model::edit_rad ),
+                      Style_Tools::All, false);
+      QBrush fill;
+      if (opt->state & State_NoChange)
+        fill = QBrush( opt->palette.color( QPalette::Base ), Qt::Dense4Pattern);
+      else if (opt->state & ( State_Sunken | !State_Enabled ) )
+        fill = opt->palette.color( QPalette::Window );
+      else if (opt->state & State_Enabled) {
+        if (!(opt->state & State_Off) )
+          fill = QBrush( getColor( Style_Model::checked_clr ) );
+        else
+          fill = QBrush( opt->palette.color( QPalette::Base ) );
+      }
+      else
+        fill = opt->palette.color( QPalette::Window );
+      p->save();
+      doRestore = true;
+      QColor color = fill.color();
+      QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+             aBrdBotCol = getColor( Style_Model::border_bot_clr );
+      if ( getBoolValue( Style_Model::all_antialized ) )
+        p->setRenderHint( QPainter::Antialiasing, true );
+
+     // make sure the indicator is square
+      QRect ir = opt->rect;
+      if (opt->rect.width() < opt->rect.height()) {
+        ir.setTop(opt->rect.top() + (opt->rect.height() - opt->rect.width()) / 2);
+        ir.setHeight(opt->rect.width());
+      } else if (opt->rect.height() < opt->rect.width()) {
+        ir.setLeft(opt->rect.left() + (opt->rect.width() - opt->rect.height()) / 2);
+        ir.setWidth(opt->rect.height());
+      }
+
+      Style_Tools::shadowCheck( p, ir, 2., Style_Tools::All,
+                                color, color.dark( BUT_PERCENT_ON ), aBrdTopCol, aBrdBotCol );
+      if ( getBoolValue( Style_Model::all_antialized ) )
+        p->setRenderHint( QPainter::Antialiasing, false );
+      if (opt->state & State_NoChange)
+        p->setPen(opt->palette.dark().color());
+      else
+        p->setPen(opt->palette.text().color());
+     } // Fall through!
+    case PE_IndicatorViewItemCheck:
+    case PE_Q3CheckListIndicator: {
+      if (!doRestore) {
+        p->save();
+        doRestore = true;
+      }
+      if (pe == PE_Q3CheckListIndicator || pe == PE_IndicatorViewItemCheck) {
+        const QStyleOptionViewItem *itemViewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt);
+        p->setPen(itemViewOpt && itemViewOpt->showDecorationSelected
+                  && opt->state & State_Selected ? opt->palette.highlightedText().color()
+                  : opt->palette.text().color());
+        if (opt->state & State_NoChange)
+          p->setBrush( opt->palette.color( QPalette::Button ) );
+        p->drawRect(opt->rect.x() + 1, opt->rect.y() + 1, 11, 11);
+      }
+      if (!(opt->state & State_Off)) {
+        QLineF lines[11];
+        int i, xx, yy;
+        xx = opt->rect.x() + 4;
+        yy = opt->rect.y() + 5;
+        for (i = 0; i < 3; ++i) {
+          lines[i] = QLineF(xx, yy, xx, yy + 2);
+          ++xx;
+          ++yy;
+        }
+        yy -= 2;
+        for (i = 3; i < 11; ++i) {
+          lines[i] = QLineF(xx, yy, xx, yy+2);
+          ++xx;
+          --yy;
+        }
+        QColor aColor = getColor( Style_Model::pointer_clr );
+        if ( !(opt->state & State_Enabled ) )
+          aColor = opt->palette.mid().color();
+        if ( opt->state & State_Selected )
+          aColor = opt->palette.highlightedText().color();
+
+        p->setPen( QPen( aColor ) );
+        p->drawLines(lines, 11);
+      }
+
+      if (doRestore)
+          p->restore();
+      break;
+    }
+    case PE_IndicatorRadioButton: {
+      if ( hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver) )
+        drawHoverRect(p, w->rect(), opt->palette.color( QPalette::Window ), getDblValue( Style_Model::btn_rad ),
+                      Style_Tools::All, false);
+#define PTSARRLEN(x) sizeof(x)/(sizeof(QPoint))
+      static const QPoint pts_border[] = {              // border line
+        QPoint(1, 9),  QPoint(1, 8),  QPoint(0, 7),  QPoint(0, 4),  QPoint(1, 3),  QPoint(1, 2),
+        QPoint(2, 1),  QPoint(3, 1),  QPoint(4, 0),  QPoint(7, 0),  QPoint(8, 1),  QPoint(9, 1),
+        QPoint(10, 2), QPoint(10, 3), QPoint(11, 4), QPoint(11, 7), QPoint(10, 8), QPoint(10, 9), 
+        QPoint(9, 10), QPoint(8, 10), QPoint(7, 11), QPoint(4, 11), QPoint(3, 10), QPoint(2, 10)
+      };
+     // make sure the indicator is square
+      QRect ir = opt->rect;
+      if (opt->rect.width() < opt->rect.height()) {
+        ir.setTop(opt->rect.top() + (opt->rect.height() - opt->rect.width()) / 2);
+        ir.setHeight(opt->rect.width());
+      } else if (opt->rect.height() < opt->rect.width()) {
+        ir.setLeft(opt->rect.left() + (opt->rect.width() - opt->rect.height()) / 2);
+        ir.setWidth(opt->rect.height());
+      }
+      p->save();
+      bool down = opt->state & State_Sunken;
+      bool enabled = opt->state & State_Enabled;
+      bool on = opt->state & State_On;
+      QPolygon a;
+      p->translate(ir.x(), ir.y());
+
+      if ( down || !enabled ) {
+        QColor fillColor = opt->palette.color( QPalette::Window );
+        p->setPen( fillColor );
+        p->setBrush( fillColor );
+      }
+      else {
+        QColor fillColor =  opt->palette.color( QPalette::Base );
+        if ( enabled && on )
+           fillColor = getColor( Style_Model::checked_clr );
+        QLinearGradient gr( 3, 3, 8, 8 );
+        gr.setColorAt( 0.0, fillColor.dark( BUT_PERCENT_ON ) );
+        gr.setColorAt( 1.0, fillColor );
+        p->setPen( fillColor.dark( BUT_PERCENT_ON ) );
+        p->setBrush( gr );
+      }
+      p->drawPolygon(pts_border, PTSARRLEN(pts_border));
+      int aSize = PTSARRLEN(pts_border),
+          aHalfSize = (int)aSize/2;
+      if ( getBoolValue( Style_Model::all_antialized ) )
+        p->setRenderHint( QPainter::Antialiasing, true );
+      p->setPen( getColor( Style_Model::border_top_clr ) );
+      p->drawPolyline(pts_border, aHalfSize);
+
+      p->setPen( getColor( Style_Model::border_bot_clr ) );
+      QPolygon aPolygon;
+      for ( int i = aHalfSize; i < aSize; i++ )
+        aPolygon << pts_border[i];
+      p->drawPolyline( aPolygon );
+      if ( getBoolValue( Style_Model::all_antialized ) )
+        p->setRenderHint( QPainter::Antialiasing, false );
+
+      if (on) {
+        QColor aPointerCol = getColor( Style_Model::pointer_clr );
+        if ( !enabled )
+          aPointerCol = opt->palette.mid().color();
+        p->setPen( Qt::NoPen );
+        p->setBrush( aPointerCol );
+        p->drawRect( 5, 4, 2, 4 );
+        p->drawRect( 4, 5, 4, 2 );
+      }
+
+      p->translate(-ir.x(), -ir.y()); // restore translate
+      p->restore();
+      break;
+    }
+    case PE_FrameDockWidget:
+      if ( qstyleoption_cast<const QStyleOptionFrame *>(opt))
+        QCommonStyle::drawPrimitive( pe, opt, p, w );
+      break;
+    case PE_FrameLineEdit:
+    case PE_PanelLineEdit: {
+      if ( w ) {
+        if ( qobject_cast<const QComboBox*>( w->parentWidget() ) ||
+             qobject_cast<const QAbstractSpinBox*>( w->parentWidget() ) )
+          break;
+      }
+      if ( pe == PE_FrameLineEdit ) {
+       QColor aBrdTopCol = getColor( Style_Model::border_top_clr ),
+               aBrdBotCol = getColor( Style_Model::border_bot_clr );
+        bool hover = hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver);
+        double aRad = getDblValue(Style_Model::edit_rad);
+        if ( hover )
+          drawHoverRect(p, opt->rect, opt->palette.color( QPalette::Window ), aRad, Style_Tools::All, true);
+        else {
+          Style_Tools::shadowRect( p, opt->rect, aRad, LINE_GR_MARGIN, SHADOW,
+                                   Style_Tools::All, getColor( Style_Model::fld_light_clr ),
+                                   getColor( Style_Model::fld_dark_clr ), aBrdTopCol, aBrdBotCol,
+                                   getBoolValue( Style_Model::all_antialized ), false );
+        }
+      }
+      else {
+        if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
+          QRect rect = panel->rect.adjusted( panel->lineWidth,  panel->lineWidth,
+                                             -panel->lineWidth, -panel->lineWidth);
+          if (panel->lineWidth > 0) // QLineEdit
+            drawPrimitive( PE_FrameLineEdit, panel, p, w );
+          else // not QLineEdit
+            p->fillRect(rect, panel->palette.brush(QPalette::Base));
+         }
+      }
+      break;
+    }
+    case PE_FrameTabWidget: {
+      if (w && qobject_cast<QTabWidget*>((QWidget*)w)) {
+        QTabWidget* tabW = qobject_cast<QTabWidget*>((QWidget*)w);
+        int aRoundType = Style_Tools::BottomRight;
+        QTabWidget::TabPosition aTabPos = tabW->tabPosition();
+        if ( aTabPos != QTabWidget::North && aTabPos != QTabWidget::West )
+          aRoundType = aRoundType | Style_Tools::TopLeft;
+        if ( aTabPos != QTabWidget::South )
+          aRoundType = aRoundType | Style_Tools::BottomLeft;
+        if ( aTabPos != QTabWidget::East )
+          aRoundType = aRoundType | Style_Tools::TopRight;
+        QColor aBrdTopCol = getColor( Style_Model::border_tab_top_clr ),
+               aBrdBotCol = getColor( Style_Model::border_tab_bot_clr );
+        Style_Tools::shadowRect( p, opt->rect, getDblValue( Style_Model::frame_rad ),
+                                 0., SHADOW, aRoundType,
+                                 getColor( Style_Model::fld_light_clr ),
+                                 opt->palette.color( QPalette::Dark ),
+                                 aBrdTopCol, aBrdBotCol, false, false, false, false );
+        break;
+      }
+    }
+    case PE_IndicatorToolBarHandle: {
+      p->save();
+      QRect r = opt->rect;
+      bool horiz = opt->state & State_Horizontal;
+      QLinearGradient gr( r.x(), r.y(), horiz ? r.x() : r.right(), horiz ? r.bottom() : r.y() );
+      QColor aBgCol = opt->palette.color( QPalette::Window );
+      gr.setColorAt( 0.0, aBgCol.light( BUT_PERCENT_ON ) );
+      gr.setColorAt( 1.0, aBgCol );
+      p->fillRect( r, gr );
+      QRect aRect = QRect( r.x(), r.y(), r.width(), r.height() );
+      drawHandle( p, r, horiz, false );
+      p->restore();
+      break;
+    }
+    case PE_Widget: {
+      QWindowsStyle::drawPrimitive( pe, opt, p, w );
+      if ( !w )
+        break;
+      if( w->parent() && !qobject_cast<QMenuBar*>((QWidget*)w) )
+         break;
+      drawBackground( p, w->rect(), opt->palette.color( QPalette::Window ), false );
+      break;
+    }
+    case PE_FrameTabBarBase:
+      // for a tabbar that isn't part of a tab widget(dockWidgets for example).
+      if (const QStyleOptionTabBarBase *tbb
+          = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
+        if (tbb->shape != QTabBar::RoundedNorth && tbb->shape != QTabBar::RoundedEast &&
+           tbb->shape != QTabBar::RoundedSouth && tbb->shape != QTabBar::RoundedWest) {
+          QWindowsStyle::drawPrimitive( pe, opt, p, w );
+          break;
+        }
+        QRect aSelRect = tbb->selectedTabRect;
+        // line under selected tab bar object
+        bool isSelected = opt->state & State_Selected;
+        QTabBar* tabBar = qobject_cast<QTabBar*>((QWidget*)w);
+        bool isLast = false;
+        if ( tabBar )
+          isLast = tabBar->currentIndex() == tabBar->count() -1;
+        QColor aColor = opt->palette.color( QPalette::Window );
+        QColor aBrdTopCol = getColor( Style_Model::border_tab_top_clr ),
+               aBrdBotCol = getColor( Style_Model::border_tab_bot_clr );
+        bool isHover = hasHover() && (opt->state & State_Enabled) &&
+                                     (opt->state & State_MouseOver);
+        QPainterPath aSelPath = Style_Tools::tabRect( p, aSelRect, (int)tbb->shape,
+                            getDblValue( Style_Model::frame_rad ), DELTA_H_TAB, aColor, aColor,
+                            aColor, aColor, isSelected, isLast, isHover, false, false );
+        if ( !aSelPath.isEmpty() )
+          aSelRect = aSelPath.controlPointRect().toRect();
+        QStyleOptionTabBarBase* copyOpt = (QStyleOptionTabBarBase*)tbb;
+        copyOpt->selectedTabRect = aSelRect;
+       QCommonStyle::drawPrimitive( pe, copyOpt, p, w );
+        break;
+      }
+    case PE_IndicatorBranch: {
+        // This is _way_ too similar to the common style.
+        static const int decoration_size = 9;
+        int mid_h = opt->rect.x() + opt->rect.width() / 2;
+        int mid_v = opt->rect.y() + opt->rect.height() / 2;
+        int bef_h = mid_h;
+        int bef_v = mid_v;
+        int aft_h = mid_h;
+        int aft_v = mid_v;
+        if (opt->state & State_Children) {
+            int delta = decoration_size / 2;
+            bef_h -= delta;
+            bef_v -= delta;
+            aft_h += delta;
+            aft_v += delta;
+            p->drawLine(bef_h + 2, bef_v + 4, bef_h + 6, bef_v + 4);
+            if (!(opt->state & State_Open))
+                p->drawLine(bef_h + 4, bef_v + 2, bef_h + 4, bef_v + 6);
+            QPen oldPen = p->pen();
+            p->setPen(opt->palette.dark().color());
+            p->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1);
+            p->setPen(oldPen);
+        }
+        QBrush brush(opt->palette.dark().color(), Qt::Dense4Pattern);
+        if (opt->state & State_Item) {
+            if (opt->direction == Qt::RightToLeft)
+                p->fillRect(opt->rect.left(), mid_v, bef_h - opt->rect.left(), 1, brush);
+            else
+                p->fillRect(aft_h, mid_v, opt->rect.right() - aft_h + 1, 1, brush);
+        }
+        if (opt->state & State_Sibling)
+            p->fillRect(mid_h, aft_v, 1, opt->rect.bottom() - aft_v + 1, brush);
+        if (opt->state & (State_Open | State_Children | State_Item | State_Sibling))
+            p->fillRect(mid_h, opt->rect.y(), 1, bef_v - opt->rect.y(), brush);
+        break;
+      }
+    case PE_IndicatorDockWidgetResizeHandle: {
+      QRect r = opt->rect;
+      drawBorder( p, r, opt->state & State_Horizontal );
+      bool hover = hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver);
+      if ( hover )
+          drawHoverRect(p, r, opt->palette.color( QPalette::Window ), 0, Style_Tools::All, false);
+      bool horiz = r.width() > r.height();
+      int aLen = (int)getDblValue( Style_Model::split_handle_len );
+      if ( horiz )
+        r = QRect( r.x() +(int)((r.width()-aLen)/2), r.y(), aLen, r.height());
+      else
+        r = QRect( r.x(), r.y() +(int)((r.height()-aLen)/2), r.width(), aLen);
+      drawHandle( p, r, horiz, true );
+      break;
+    }
+    case PE_Frame: {
+      QWidget* aWdg = (QWidget*)w;
+      if ( qobject_cast<QTextEdit*>(aWdg) || qobject_cast<QTreeView*>(aWdg) ||
+           qobject_cast<QListView*>(aWdg) ) {
+        QRect r = opt->rect;
+        if ( qobject_cast<QTreeView*>(aWdg) ) {
+          QTreeView* trView = qobject_cast<QTreeView*>(aWdg);
+          QHeaderView* aHeader = trView->header();
+          if ( aHeader ) {
+            int aHeight = aHeader->contentsRect().height();
+            r = QRect( r.x(), r.y()+aHeight, r.width(), r.height()-aHeight );
+          }
+        }
+        QPalette aPal = aWdg->palette();
+        double aMarg = LINE_GR_MARGIN;
+        QColor base = getColor( Style_Model::pal_base_clr ),
+              light = base,
+               light_alt = base.dark(110),//AlternateBase color
+               dark  = getColor( Style_Model::fld_dark_clr );
+        light.setAlpha( 0 );
+        QLinearGradient gr_h(r.x(), r.y(), r.right(), r.y());
+        gr_h.setColorAt( 0.0, dark );
+        gr_h.setColorAt( aMarg / r.width(), light );
+        gr_h.setColorAt( 1.0, light );
+        QLinearGradient gr_v(r.x(), r.y(), r.x(), r.bottom() );
+        gr_v.setColorAt( 0.0, dark );
+        gr_v.setColorAt( aMarg / r.height(), light );
+        gr_v.setColorAt( 1.0, light );
+        // draw frame
+        p->fillRect( r, base );
+        p->fillRect( r, gr_h );
+        p->fillRect( r, gr_v );
+        aPal.setBrush( QPalette::Base, QBrush( light ) );
+
+        QLinearGradient gr_alt(r.x(), r.y(), r.right(), r.y());
+        gr_alt.setColorAt( 0.0, dark );
+        gr_alt.setColorAt( (aMarg)*2/3/r.width(), light_alt );
+        gr_alt.setColorAt( 1.0, light_alt );
+        aPal.setBrush( QPalette::AlternateBase, QBrush( gr_alt ) );
+        aWdg->setPalette( aPal );
+      }
+      QWindowsStyle::drawPrimitive( pe, opt, p, w );
+      break;
+    }
+    default:
+      QWindowsStyle::drawPrimitive( pe, opt, p, w );
+  }
+}
+
+int Style_Salome::pixelMetric( PixelMetric metric, const QStyleOption* opt,
+                              const QWidget* w ) const
+{
+  int aRes = QWindowsStyle::pixelMetric( metric, opt, w );
+  switch( metric ) {
+    case PM_SliderLength: {
+      aRes += (int)(getIntValue( Style_Model::slider_increase )/2);
+      break;
+    }
+    case PM_DockWidgetFrameWidth:
+      aRes = 1;
+    break;
+    case PM_DockWidgetSeparatorExtent:
+      aRes = 8;
+    break;
+    case PM_DockWidgetTitleMargin:
+      aRes = 2;
+    break;
+    case PM_SplitterWidth:
+      aRes = 6;
+    break;
+    default:
+    break;
+  }
+  return aRes;
+}
+
+QSize Style_Salome::sizeFromContents( ContentsType ct, const QStyleOption* opt,
+                                      const QSize& contentsSize, const QWidget* w ) const
+{
+  QSize sz = QWindowsStyle::sizeFromContents( ct, opt, contentsSize, w );
+  switch (ct) {
+    case CT_TabBarTab:
+      if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
+        if ( tab->position == QStyleOptionTab::End ) {
+          if ( tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedSouth ) {
+            int aDelta = (int)(opt->rect.height()*DELTA_H_TAB/2);
+            sz.setWidth( sz.width() + aDelta );
+         }
+          if ( tab->shape == QTabBar::RoundedEast || tab->shape == QTabBar::RoundedWest ) {
+            int aDelta = (int)(opt->rect.width()*DELTA_H_TAB/2);
+            sz.setHeight( sz.height() + aDelta );
+         }
+        }
+        break;
+      }
+      break;
+      case CT_Slider: {
+        int aValue = getIntValue( Style_Model::slider_increase );
+        sz.setWidth( sz.width() + aValue );
+        sz.setHeight( sz.height() + aValue );
+        break;
+      }
+      case CT_ComboBox:
+        if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
+          QRect res = QRect( 0, 0, sz.width(), sz.height() );
+          int aHalfRect = (int)Style_Tools::getMaxRect( res, 
+                             (int)getDblValue( Style_Model::edit_rad )/2 ); // left value
+          QRect old_arrow = QWindowsStyle::subControlRect( CC_ComboBox, cmb,
+                                                           SC_ComboBoxArrow, w );
+          int aDelta = res.height() - old_arrow.width(); // right value
+          if ( cmb->editable )
+            aDelta += aHalfRect; // for right of line edit internal
+          sz.setWidth( res.width() + aDelta + aHalfRect );
+        }
+       break;
+      default:
+      break;
+  }
+  return sz;
+}
+
+QPixmap Style_Salome::standardPixmap(StandardPixmap stPixmap, const QStyleOption *opt,
+                                     const QWidget *w) const
+{
+  switch ( stPixmap )
+  {
+  case SP_DockWidgetCloseButton:
+  case SP_TitleBarCloseButton:
+    return QPixmap( cross_xpm );
+  case SP_TitleBarMaxButton:
+    return QPixmap( maximize_xpm );
+  case SP_TitleBarNormalButton:
+    return QPixmap( normal_xpm );
+  case SP_TitleBarMinButton:
+    return QPixmap( minimize_xpm );
+  default:
+    return QWindowsStyle::standardPixmap( stPixmap, opt, w );
+  }
+}
+
+int Style_Salome::styleHint( StyleHint hint, const QStyleOption* opt, const QWidget* widget,
+                            QStyleHintReturn* returnData ) const
+{
+  int aRes = QWindowsStyle::styleHint( hint, opt, widget, returnData );
+  switch( hint ) {
+    case SH_Table_GridLineColor: {
+      if ( opt )
+        aRes = getColor( Style_Model::tbl_grline_clr  ).rgb();
+      else
+        return aRes;
+      break;
+    }
+    default:
+      break;
+  }
+  return aRes;
+}
+
+QRect Style_Salome::subControlRect( ComplexControl cc, const QStyleOptionComplex* opt,
+                                   SubControl sc, const QWidget* wid ) const
+{
+  QRect res = QWindowsStyle::subControlRect( cc, opt, sc, wid );
+  switch ( cc ) {
+    case CC_SpinBox: {
+      int x = res.x(), w = res.width(), h = res.height();
+      if ( sc==SC_SpinBoxUp || sc==SC_SpinBoxDown ) {
+        QRect frame_r = QWindowsStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid );
+        h = frame_r.height();
+        res.setX( x+w-h );
+        res.setWidth( h );
+      }
+      else if ( sc==QStyle::SC_SpinBoxEditField ) {
+        res.setWidth( w-h );
+        res.setTopLeft( QPoint( res.x(), res.y()-SHADOW ) );
+      }
+      break;
+    }
+    case CC_ComboBox: {
+      if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
+        res = cb->rect;
+        int aHalfRect = (int)Style_Tools::getMaxRect( res, (int)getDblValue( Style_Model::edit_rad )/2 );
+        int x = res.x(), w = res.width(), h = res.height();
+        switch( sc ) {
+          case SC_ComboBoxEditField: {
+            res.setWidth( w-h );
+            int aX = res.x();
+            if ( !cb->editable )
+              aX += aHalfRect;
+            res.setTopLeft( QPoint( aX, res.y()-SHADOW ) );
+            break;
+          }
+          case SC_ComboBoxArrow: {
+            res.setX( x+w-h );
+            res.setWidth( h );
+            break;
+          }
+        }
+      }
+      break;
+    }
+    case CC_ScrollBar:
+      if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
+        QRect slider_r = QWindowsStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid );
+        int aRect = Style_Tools::getMaxRect( slider_r, (int)getDblValue( Style_Model::btn_rad ) );
+        switch( sc ) {
+          case SC_ScrollBarSubPage:            // between top/left button and slider
+            if (scrollbar->orientation == Qt::Horizontal)
+              res.setRight( res.right()+aRect+1 );
+            else
+              res.setBottom( res.bottom()+aRect+1 );
+            break;
+          case SC_ScrollBarAddPage:            // between bottom/right button and slider
+            if (scrollbar->orientation == Qt::Horizontal)
+              res.setLeft( res.left() - aRect - 1 );
+            else
+              res.setTop( res.top() - aRect - 1);
+          break;
+         default:
+           break;
+        }
+        break;
+      }
+    case CC_Slider: {
+      if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
+        switch ( sc ) {
+          case SC_SliderGroove: {
+            if ( slider->orientation == Qt::Horizontal ) {
+              res.setLeft( res.left()+DELTA_SLIDER );
+              res.setRight( res.right()-DELTA_SLIDER );
+            }
+            else {
+              res.setTop( res.top()+DELTA_SLIDER );
+              res.setBottom( res.bottom()-DELTA_SLIDER );
+            }
+            break;
+          }
+        }
+      }
+    }
+  }
+  return res;
+}
+
+QRect Style_Salome::subElementRect( SubElement se, const QStyleOption* opt,
+                                   const QWidget* wid ) const
+{
+  QRect res = QWindowsStyle::subElementRect( se, opt, wid );
+  int aHalfRect = (int)Style_Tools::getMaxRect( res, (int)getDblValue( Style_Model::edit_rad )/2 );
+  int w = res.width(), h = res.height();
+  switch ( se ) {
+    case SE_ComboBoxFocusRect: {
+      QRect old_r = QWindowsStyle::subControlRect( CC_ComboBox,
+                     qstyleoption_cast<const QStyleOptionComplex*>( opt ),
+                     SC_ComboBoxArrow, wid );
+      int old_w = old_r.width();
+      res.setWidth( w-h+old_w-2 );
+      break;
+    }
+    case SE_LineEditContents: {
+      res.setTopLeft( QPoint( res.x()+aHalfRect, res.y()-SHADOW ) );
+      res.setTopRight( QPoint( res.right()-aHalfRect, res.y() ) );
+      break;
+    }
+    case SE_ProgressBarLabel:
+    case SE_ProgressBarContents:
+    case SE_ProgressBarGroove:
+      return opt->rect;
+  }
+  if( qobject_cast<const QRadioButton*>(wid) ||
+      qobject_cast<const QCheckBox*>(wid) ) {
+      if( hasHover() )
+        res = res.adjusted(0, 0, 2, 0);
+  }
+  return res;
+}
+
+void Style_Salome::updatePaletteColors()
+{
+  QPalette aPal = QApplication::palette();
+  aPal.setColor( QPalette::WindowText, getColor( Style_Model::pal_wtext_clr ) );
+  aPal.setColor( QPalette::Button, getColor( Style_Model::button_clr ) );
+  aPal.setColor( QPalette::Light, getColor( Style_Model::pal_light_clr ) );
+  aPal.setColor( QPalette::Midlight, getColor( Style_Model::pal_light_clr ).light(115) );
+  aPal.setColor( QPalette::Dark, getColor( Style_Model::pal_dark_clr ) );
+  aPal.setColor( QPalette::Mid, aPal.button().color().dark(150) );
+  aPal.setColor( QPalette::Text, getColor( Style_Model::pal_text_clr ) );
+  //aPal.setColor( QPalette::BrightText, );
+  aPal.setColor( QPalette::ButtonText, getColor( Style_Model::pal_btext_clr ) );
+  aPal.setColor( QPalette::Base, getColor( Style_Model::pal_base_clr ) );
+  aPal.setColor( QPalette::AlternateBase,getColor( Style_Model::pal_base_clr ).dark( 110 )  );
+  aPal.setColor( QPalette::Window, getColor( Style_Model::bg_clr ) );
+  //aPal.setColor( QPalette::Shadow, );
+  aPal.setColor( QPalette::Highlight, getColor( Style_Model::pal_high_clr ) );
+  aPal.setColor( QPalette::HighlightedText, getColor( Style_Model::pal_high_text_clr ) );
+  //aPal.setColor( QPalette::Link, Qt::blue );
+  //aPal.setColor( QPalette::LinkVisited, Qt::magenta );
+
+  // dependence colors
+  aPal.setColor(QPalette::Inactive, QPalette::Button, aPal.button().color());
+  aPal.setColor(QPalette::Inactive, QPalette::Window, aPal.background().color());
+  aPal.setColor(QPalette::Inactive, QPalette::Light, aPal.light().color());
+  aPal.setColor(QPalette::Inactive, QPalette::Dark, aPal.dark().color());
+  if (aPal.midlight() == aPal.button())
+    aPal.setColor(QPalette::Midlight, aPal.button().color().light(110));
+  if (aPal.background() != aPal.base()) {
+    aPal.setColor(QPalette::Inactive, QPalette::Highlight, aPal.color(QPalette::Inactive, QPalette::Window));
+    aPal.setColor(QPalette::Inactive, QPalette::HighlightedText, aPal.color(QPalette::Inactive, QPalette::Text));
+  }
+
+  const QColor bg = aPal.background().color();
+  const QColor fg = aPal.foreground().color(), btn = aPal.button().color();
+  QColor disabled((fg.red()+btn.red())/2,(fg.green()+btn.green())/2,
+                  (fg.blue()+btn.blue())/2);
+  aPal.setColorGroup(QPalette::Disabled, aPal.foreground(), aPal.button(), aPal.light(),
+      aPal.dark(), aPal.mid(), aPal.text(), aPal.brightText(), aPal.base(), aPal.background() );
+  aPal.setColor(QPalette::Disabled, QPalette::WindowText, disabled);
+  aPal.setColor(QPalette::Disabled, QPalette::Text, disabled);
+  aPal.setColor(QPalette::Disabled, QPalette::ButtonText, disabled);
+  aPal.setColor(QPalette::Disabled, QPalette::Highlight, aPal.highlight().color() );
+  aPal.setColor(QPalette::Disabled, QPalette::HighlightedText, aPal.highlightedText().color() );
+  aPal.setColor(QPalette::Disabled, QPalette::Base, bg);
+  QApplication::setPalette( aPal );
+
+  QColor aWndCol = myTTipWnd,
+         aTextCol = myTTipText;
+  if( getBoolValue( Style_Model::ttip_is_change ) ) {
+    if ( getColor( Style_Model::ttip_bg_clr ).isValid() )
+      aWndCol = getColor( Style_Model::ttip_bg_clr );
+    if ( getColor( Style_Model::ttip_text_clr ).isValid() )
+      aTextCol  = getColor( Style_Model::ttip_text_clr );
+  }
+  QPalette tiplabel  = QToolTip::palette();
+  bool isChangeWnd = aWndCol != tiplabel.color( QPalette::Window ),
+       isChangeTxt = aTextCol != tiplabel.color( QPalette::Text );
+  if ( isChangeWnd || isChangeTxt ) {
+    if ( isChangeWnd ) {
+      tiplabel.setColor(QPalette::Window, aWndCol);
+      tiplabel.setColor(QPalette::Button, aWndCol);
+    }
+    if ( isChangeTxt ) {
+      tiplabel.setColor(QPalette::Text, aTextCol);
+      tiplabel.setColor(QPalette::WindowText, aTextCol);
+      tiplabel.setColor(QPalette::ButtonText, aTextCol);
+    }
+    const QColor fg = tiplabel.foreground().color(), btn = tiplabel.button().color();
+    QColor disabled((fg.red()+btn.red())/2,(fg.green()+btn.green())/2,
+                    (fg.blue()+btn.blue())/2);
+    tiplabel.setColor(QPalette::Disabled, QPalette::WindowText, disabled);
+    tiplabel.setColor(QPalette::Disabled, QPalette::Text, disabled);
+    tiplabel.setColor(QPalette::Disabled, QPalette::Base, Qt::white);
+    tiplabel.setColor(QPalette::Disabled, QPalette::BrightText, Qt::white);
+    QToolTip::setPalette(tiplabel);
+  }
+}
+
+void Style_Salome::updateAllWidgets( QApplication* app )
+{
+  if ( !app )
+    return;
+  QWidgetList all = app->allWidgets();
+  QWidget* w;
+  for (QWidgetList::ConstIterator it2 = all.constBegin(); it2 != all.constEnd(); ++it2) {
+    w = *it2;
+    if (w->windowType() != Qt::Desktop && w->testAttribute(Qt::WA_WState_Polished)
+        && !w->testAttribute(Qt::WA_SetStyle)) {
+      QEvent e(QEvent::StyleChange);
+      QApplication::sendEvent(w, &e);
+      polish( w );
+      w->update();
+    }
+  }
+}
+
+bool Style_Salome::hasHover() const
+{
+  return getBoolValue( Style_Model::auto_raising_wdg ) ||
+         getBoolValue( Style_Model::highlight_wdg );
+}
+
+void Style_Salome::drawHoverRect( QPainter* p, const QRect& r, const QColor& bgCol, const double rad,
+                                  const int type, const bool border ) const
+{
+  if ( !hasHover() )
+    return;
+  bool isAutoRaising = getBoolValue( Style_Model::auto_raising_wdg );
+  bool isHighWdg = getBoolValue( Style_Model::highlight_wdg );
+  QColor aBorder = getColor( Style_Model::border_bot_clr ),
+         aCol, aBrdCol;
+  double aMargin = HIGH_WDG_MARGIN;
+  if  ( isAutoRaising ) {
+    aCol = bgCol;
+    aBrdCol = aCol.dark(BUT_PERCENT_ON);
+    if ( !border )
+      aBorder = aCol;
+    aMargin = 0;
+  }
+  else if ( isHighWdg ) {
+    aCol = getColor( Style_Model::high_wdg_clr );
+    aBrdCol = getColor( Style_Model::high_brd_wdg_clr );
+    if ( !border )
+      aBorder = aBrdCol;
+  }
+  Style_Tools::highlightRect( p, r, rad, type, aMargin, aCol, aBrdCol, aBorder );
+}
+
+void Style_Salome::drawHandle( QPainter* p, const QRect& r, bool horiz, bool isRect ) const
+{
+  QPixmap hole( (const char**)hole_xpm );
+  int i, j;
+  double d_hor = getDblValue( Style_Model::hor_handle_delta );
+  double d_ver = getDblValue( Style_Model::ver_handle_delta );
+  if ( !d_hor || !d_ver || !r.width() || !r.height() )
+    return;
+  int c_hor = (int)(r.width()/d_hor)-1;
+  int c_ver = (int)(r.height()/d_ver)-1;
+  if ( c_hor+1 <= 0 || c_ver+1 <= 0 )
+    return;
+  // correction for delta value
+  d_hor = r.width()/(c_hor+1);
+  d_ver = r.height()/(c_ver+1);
+
+  double dd_hor = 0, dd_ver = 0;
+  if ( horiz ) {
+    for ( i = 0; i < c_hor; i++ ) {
+      for ( j = 0; j < c_ver; j++ ) {
+          p->drawPixmap( (int)( r.x() + dd_hor + ( i + 1 ) * d_hor  - 1 ),
+                         (int)( r.y() + dd_ver + ( j + 1 ) * d_ver - 1 ), hole );
+      }
+      if ( !isRect ) {
+        dd_ver += (int(d_ver)/2) + (int(d_ver)%2);
+        c_ver = c_ver - 1;
+      }
+    }
+  }
+  else {
+    for ( j = 0; j < c_ver; j++ ) {
+      for ( i = 0; i < c_hor; i++ ) {
+          p->drawPixmap( (int)( r.x() + dd_hor + ( i + 1 ) * d_hor  - 1 ),
+                         (int)( r.y() + dd_ver + ( j + 1 ) * d_ver - 1 ), hole );
+      }
+      if ( !isRect ) {
+        dd_hor += (int(d_hor)/2) + (int(d_hor)%2);
+        c_hor = c_hor - 1;
+      }
+    }
+  }
+}
+
+void Style_Salome::drawBackground( QPainter* p, const QRect& r, const QColor& bgCol,
+                                   const bool fill, const bool grad, const bool horiz ) const
+{
+  if ( fill ) {
+    if ( !grad )
+      p->fillRect( r, bgCol );
+    else {
+      QLinearGradient gr( r.x(), r.y(), horiz ? r.x() : r.right(), horiz ? r.bottom() : r.y() );
+      gr.setColorAt( 0.0, bgCol.light( BUT_PERCENT_ON ) );
+      gr.setColorAt( 1.0, bgCol );
+      p->fillRect( r, gr );
+    }
+  }
+  if ( !getBoolValue( Style_Model::is_lines ) )
+    return;
+  QColor c = getColor( Style_Model::lines_clr );
+  int anAlpha = (int)( 255*( 1 - getDblValue( Style_Model::lines_transp )/100 ) ); 
+
+  c.setAlpha( anAlpha );
+  p->setPen( c );
+  p->setRenderHint( QPainter::Antialiasing );
+  int aLines = getIntValue( Style_Model::lines_type );
+  int x = r.x(), y = r.y(), left = r.left(), top = r.top();
+  int w = r.width(), h = r.height();
+  QVector<QLine> lines;
+  if ( aLines == 0 ) { // horizontal lines
+    const int d = 3;
+    for( int i=0; i<=h; i+=d )
+      lines.append( QLine( x, y+i, w, r.y()+i ) );
+  }
+  else if ( aLines == 1 ) {
+    const int d = 5;
+    w = w/d*d;
+    h = h/d*d;
+    for( int i=0; i<=w; i+=d )
+      lines.append( QLine( x+i, y, x, y+i ) );
+    for( int i=0; i<h; i+=d )
+      lines.append( QLine( left+w-i, top+h, left+w, top+h-i ) );
+  }
+  p->drawLines( lines );
+}
+
+void Style_Salome::drawBorder( QPainter* p, const QRect& r, bool horiz ) const 
+{
+  QPen oldPen = p->pen();
+  QColor aBrdTopCol = getColor( Style_Model::border_tab_top_clr ),
+         aBrdBotCol = getColor( Style_Model::border_tab_bot_clr );
+  p->setPen( aBrdTopCol );
+  if (horiz) {
+    p->drawLine(r.left(),  r.top(), r.right(), r.top());
+    p->setPen(aBrdBotCol);
+    p->drawLine(r.left(), r.bottom(), r.right(), r.bottom());
+  }
+  else {
+    p->drawLine(r.left(), r.top(), r.left(), r.bottom());
+    p->setPen(aBrdBotCol);
+    p->drawLine(r.right(), r.top(), r.right(), r.bottom());
+  }
+  p->setPen(oldPen);
+}
+
+QColor Style_Salome::getColor( int type ) const
+{
+  return myModel->getColorValue( type );
+}
+
+double Style_Salome::getDblValue( int type ) const
+{
+  return myModel->getDblValue( type );
+}
+
+int Style_Salome::getIntValue( int type ) const
+{
+  return myModel->getIntValue( type );
+}
+
+bool Style_Salome::getBoolValue( int type ) const
+{
+  return myModel->getBoolValue( type );
+}
+
+QString Style_Salome::getStringValue( int type ) const
+{
+  return myModel->getStringValue( type );
+}
+
+/*!
+  \return corrected title text  \param txt - title text
+  \param w - possible width
+  \param fm - font metrics
+*/
+QString Style_Salome::titleText( const QString& txt, const int W, const int H, QFont& f ) const
+{
+  QString res = txt.trimmed();
+
+  QFontMetrics fm( f );
+  while( fm.height() > H && f.pointSize()>1 )
+  {
+    f.setPointSize( f.pointSize()-1 );
+    fm = QFontMetrics( f );
+  }
+
+  if ( fm.width( res ) > W )
+  {
+    QString end( "..." );
+    while ( !res.isEmpty() && fm.width( res + end ) > W )
+      res.remove( res.length() - 1, 1 );
+
+    if ( !res.isEmpty() )
+      res += end;
+  }
+
+  return res;
+}
diff --git a/src/Style/Style_Salome.h b/src/Style/Style_Salome.h
new file mode 100644 (file)
index 0000000..67e6472
--- /dev/null
@@ -0,0 +1,95 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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
+//
+// File   : Style_Salome.h
+// Author : Natalia Ermolaeva, Open CASCADE S.A.S.
+//
+
+#ifndef STYLE_SALOME_H
+#define STYLE_SALOME_H
+
+#include "Style.h"
+
+#include <QWindowsStyle>
+#include <QMap>
+
+class Style_Model;
+
+class QApplication;
+class QWidget;
+class QStyleOption;
+class QPainter;
+class QSize;
+class QVariant;
+
+class STYLE_SALOME_EXPORT Style_Salome : public QWindowsStyle
+{
+  Q_OBJECT
+public:
+  Style_Salome();
+  virtual ~Style_Salome();
+
+  Style_Model*    getModel() const;
+
+  void            updateSettings( QApplication* );
+
+  virtual void    polish( QApplication* );
+  virtual void    polish( QWidget* );
+  virtual void    unpolish( QWidget* );
+  virtual void    drawComplexControl( ComplexControl, const QStyleOptionComplex*,
+                                     QPainter*, const QWidget* = 0 ) const;
+  
+  virtual void    drawControl( ControlElement, const QStyleOption*, QPainter*, const QWidget* ) const;
+  virtual void    drawPrimitive( PrimitiveElement, const QStyleOption*,
+                                QPainter*, const QWidget* = 0 ) const;
+  virtual int     pixelMetric( PixelMetric, const QStyleOption* = 0,
+                              const QWidget* = 0 ) const;
+  virtual QSize   sizeFromContents ( ContentsType, const QStyleOption*,
+                                    const QSize&, const QWidget* = 0 ) const;
+  virtual QPixmap standardPixmap( StandardPixmap, const QStyleOption*,
+                                 const QWidget* = 0) const;
+  virtual int     styleHint( StyleHint, const QStyleOption* = 0,
+                            const QWidget* = 0, QStyleHintReturn* = 0 ) const;
+  virtual QRect   subControlRect( ComplexControl, const QStyleOptionComplex*,
+                                 SubControl, const QWidget* = 0 ) const;
+  virtual QRect   subElementRect( SubElement, const QStyleOption*, const QWidget* = 0 ) const;
+
+private:
+  void            updatePaletteColors();
+  void            updateAllWidgets( QApplication* );
+  bool            hasHover() const;
+  void            drawHoverRect( QPainter*, const QRect&, const QColor&, const double,
+                                 const int, const bool ) const;
+  void            drawHandle( QPainter*, const QRect&, bool, bool = true ) const;
+  void            drawBackground( QPainter*, const QRect&, const QColor&, const bool,
+                                 const bool = false, const bool = true ) const;
+  void            drawBorder( QPainter*, const QRect&, bool ) const;
+
+  QColor          getColor( int ) const;
+  double          getDblValue( int ) const;
+  int             getIntValue( int ) const;
+  bool            getBoolValue( int ) const;
+  QString         getStringValue( int ) const;
+  QString         titleText( const QString&, const int, const int, QFont& ) const;
+
+private:
+  Style_Model*    myModel;
+  QColor          myTTipWnd, myTTipText;
+};
+
+#endif // STYLE_SALOME_H
diff --git a/src/Style/Style_Tools.cxx b/src/Style/Style_Tools.cxx
new file mode 100644 (file)
index 0000000..08e0abe
--- /dev/null
@@ -0,0 +1,603 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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
+//
+// File   : Style_Tools.cxx
+// Author : Natalia Ermolaeva, Open CASCADE S.A.S.
+//
+
+#include "Style_Tools.h"
+
+#include <QPainter>
+#include <QPainterPath>
+#include <QRect>
+#include <QColor>
+#include <QSize>
+#include <QTabWidget>
+
+QPainterPath Style_Tools::painterPath( const QRect& r )
+{
+  QPainterPath res;
+  double x = r.x(), y = r.y(), right = r.right(), bottom = r.bottom();
+  res.moveTo( x, y );
+  res.lineTo( right, y );
+  res.lineTo( right, bottom );
+  res.lineTo( x, bottom );
+  res.closeSubpath();
+  return res;
+}
+
+QPainterPath Style_Tools::substractPath( const QPainterPath& fromPath,
+                                         const QPainterPath& path )
+{
+  QPainterPath res;
+  QRegion aFromRegion( fromPath.toFillPolygon().toPolygon() );
+  QRegion aRegion( path.toFillPolygon().toPolygon() );
+  aFromRegion -= aRegion;
+  res.addRegion( aFromRegion );
+  return res;
+}
+
+QPainterPath Style_Tools::roundRect( const QRect& r, const double rad, int type,
+                                     int shType )
+{
+  QPainterPath res;
+  if ( type & None )
+    return painterPath( r );
+  double x = r.x(), y = r.y(), right = r.right(), bottom = r.bottom();
+  int aRad = getMaxRect( r, (int)rad );
+
+  if ( shType == WholePath || shType == TopPath ) {
+    if ( type & ( All | Left | BottomLeft ) ) {
+      res.moveTo( x+aRad, bottom );
+      res.arcTo( x, bottom-2*aRad, 2*aRad, 2*aRad, 270, -90 );
+    }
+    else
+      res.moveTo( x, bottom );
+    res.lineTo( x, y+aRad );
+    if ( type & (All | Left | TopLeft ) )
+      res.arcTo( x, y, 2*aRad, 2*aRad, 180, -90 );
+    else
+      res.lineTo( x, y );
+    res.lineTo( right-aRad, y );
+    if ( type & ( All | Right | TopRight ) )
+      res.arcTo( right-2*aRad, y, 2*aRad, 2*aRad, 90, -90 );
+    else
+      res.lineTo( right, y );
+  }
+  if ( shType == WholePath || shType == BottomPath ) {
+    if ( shType == BottomPath ) {
+      if ( type & ( All | Right | TopRight ) )
+        res.moveTo( right, y+aRad );
+      else
+        res.moveTo( right, y );
+    }
+    res.lineTo( right, bottom-aRad );
+    if ( type & ( All | Right | BottomRight ) )
+      res.arcTo( right-2*aRad, bottom-2*aRad, 2*aRad, 2*aRad, 0, -90 );
+    else
+      res.lineTo( right, bottom );
+
+    if ( type & ( All | Left | BottomLeft ) )
+      res.lineTo( x+aRad, bottom );
+    else
+      res.lineTo( x, bottom ); 
+  }
+  if ( shType == WholePath )
+    res.closeSubpath();
+  return res;
+}
+
+void Style_Tools::roundRect( QPainter* p, const QRect& r, const double rad, const int type,
+                             const QColor& c1, const QColor& c2, bool fill, bool antial )
+{
+  if ( antial )
+    p->setRenderHint( QPainter::Antialiasing );
+
+  QPainterPath path = roundRect( r, rad, type );
+
+  if ( fill ) {
+    QLinearGradient gr( r.x(), r.y(), r.x(), r.bottom() );
+    gr.setColorAt( 0.0, c1 );
+    gr.setColorAt( 0.5, c1 );
+    gr.setColorAt( 1.0, c2 );
+    p->fillPath( path, gr );
+  }
+  p->strokePath( path, QPen( c2, Qt::SolidLine ) );
+}
+
+void Style_Tools::shadowRect( QPainter* p, const QRect& r, const double rad, const double marg,
+                              const int shad, int type, const QColor& light, const QColor& dark,
+                              const QColor& border_top, const QColor& border_bot, const bool antialize,
+                              const bool isButton, const bool btnOn, const bool fill )
+{
+  QColor aLight = light, aDark = dark, aBrdTop = border_top, aBrdBot = border_bot;
+  if ( isButton && btnOn ) {
+    aLight = dark;
+    aDark = light;
+    aBrdTop = border_bot;
+    aBrdBot = border_top;
+  }
+
+  // gradients
+  QLinearGradient
+    gr1( r.x(), r.y(), r.right(), r.y() ),
+    gr2( r.x(), r.y(), r.x(), r.bottom() );
+  if ( fill ) {
+    if ( isButton ) {
+      gr2.setColorAt( 0.0, aLight );
+      if ( marg > 0 )
+        gr2.setColorAt( marg / r.height(), aLight );
+      gr2.setColorAt( 1.0, aDark );
+    }
+    else {
+      QColor _c1 = aLight; _c1.setAlpha( 0 );
+      QColor _c2 = aDark;
+      gr1.setColorAt( 0.0, _c2 );
+      if ( marg > 0 )
+        gr1.setColorAt( marg / r.width(), _c1 );
+      gr1.setColorAt( 1.0, _c1 );
+      gr2.setColorAt( 0.0, _c2 );
+      if ( marg > 0 )
+        gr2.setColorAt( marg / r.height(), _c1 );
+      gr2.setColorAt( 1.0, _c1 );
+    }
+  }
+  // paths
+  int x = r.x(), y = r.y(), right = r.right(), bottom = r.bottom();
+  // main path
+  QRect rCont;
+  if ( antialize )
+   rCont = QRect( QPoint( x+shad, y+shad ), QPoint( right-shad, bottom-shad ) );
+  else
+    rCont = QRect( QPoint( x, y ), QPoint( right, bottom ) );
+
+  QPainterPath path = roundRect( rCont, rad, type );
+
+  // draw paths
+  p->save();
+  if ( antialize )
+    p->setRenderHint( QPainter::Antialiasing, true );
+  else
+    p->setRenderHint( QPainter::Antialiasing, false );
+
+  if( fill ) {
+    p->fillPath( path, aLight );
+    if ( !isButton )
+      p->fillPath( path, gr1 );
+    p->fillPath( path, gr2 );
+  }
+  if ( antialize )
+    p->strokePath( path, QPen( aBrdBot, Qt::SolidLine ) );
+
+  QPainterPath bottomPath = roundRect( rCont, rad, type, BottomPath ),
+               topPath = roundRect( rCont, rad, type, TopPath );
+  p->strokePath( bottomPath, aBrdBot );
+  p->strokePath( topPath, aBrdTop );
+
+  if ( antialize )
+      p->setRenderHint( QPainter::Antialiasing, false );
+  p->restore();
+}
+
+void Style_Tools::shadowCheck( QPainter* p, const QRect& r, const double rad, const int type,
+                               const QColor& light, const QColor& dark,
+                               const QColor& border_top, const QColor& border_bot  )
+{
+  // main path
+  QPainterPath path = roundRect( r, rad, type );
+
+  QLinearGradient gr( r.x(), r.y(), r.right(), r.bottom() );
+  gr.setColorAt( 0.0, dark );
+  gr.setColorAt( 1.0, light );
+  p->fillPath( path, gr ); //fill
+
+  QPainterPath bottomPath = roundRect( r, rad, type, BottomPath ),
+               topPath = roundRect( r, rad, type, TopPath );
+  p->strokePath( bottomPath, border_bot );
+  p->strokePath( topPath, border_top );
+}
+
+
+void Style_Tools::arrowRect( QPainter* p, const QRect& re, const QColor& frame,
+                             const QColor& gr1, const QColor& gr2 )
+{
+  QPainterPath path;
+  const int r = 4;
+  const double d = re.height()/2;
+
+  path.moveTo( re.x()+r,            re.y() );
+  path.lineTo( re.x()+re.width(),   re.y() );
+  path.lineTo( re.x()+re.width()+d, re.y()+d );
+  path.lineTo( re.x()+re.width(),   re.y()+re.height() );
+  path.lineTo( re.x()+r,            re.y()+re.height() );
+  path.arcTo ( re.x(),              re.y()+2*d-2*r, 2*r, 2*r, 270, -90 );
+  path.lineTo( re.x(),              re.y()+r );
+  path.arcTo ( re.x(),              re.y(), 2*r, 2*r, 180, -90 );
+  path.closeSubpath();
+
+  QLinearGradient gr( re.x(), re.y(), re.x(), re.y()+re.height() );
+  gr.setColorAt( 0.0, gr1 );
+  gr.setColorAt( 0.4, gr2 );
+  gr.setColorAt( 0.6, gr2 );
+  gr.setColorAt( 1.0, gr1 );
+
+  p->fillPath( path, gr );
+  p->strokePath( path, QPen( frame, Qt::SolidLine ) );
+}
+
+void Style_Tools::fillRect( QPainter* p, const QRect& re, const QColor& _c1,
+                            const QColor& _c2, const int alpha )
+{
+  QLinearGradient gr( re.x(), re.y(), re.x()+re.width(), re.y()+re.height() );
+  QColor c1 = _c1, c2 = _c2;
+  c1.setAlpha( alpha );
+  c2.setAlpha( alpha );
+  gr.setColorAt( 0.0, c1 );
+  gr.setColorAt( 1.0, c2 );
+  p->fillRect( re, gr );
+}
+
+void Style_Tools::drawArrow( QStyle::PrimitiveElement type, QPainter* p, const QRect& r,
+                             const QColor& pen, const QColor& brush )
+{
+  p->save();
+  QPainterPath arrow1;
+  int x = r.x(), y = r.y(), w = r.right()-x, h = r.bottom()-y;
+  int x11 = 0, x12 = 0, y11 = 0, y12 = 0;
+  int aDelta = qMin( (int)(w/3.5), (int)(h/3.5) );
+  int deltaX = aDelta, deltaY = aDelta;
+  QLineF line( 0, 0, 1, 0 );
+  int xc = r.center().x(), yc = r.center().y();
+  p->translate( xc, yc );
+  bool correct = false;
+  switch( type ) {
+    case QStyle::PE_IndicatorArrowDown:
+      correct = true;
+    case QStyle::PE_IndicatorArrowUp: {
+      int widthArr2 = (int)(deltaX/3.);
+      if ( correct )
+        deltaY = -deltaY; // change arrow direction
+      arrow1.moveTo(  0,          deltaY );
+      arrow1.lineTo(  widthArr2,  deltaY );
+      arrow1.lineTo(  widthArr2,  0 );
+      arrow1.lineTo(  deltaX,     0 );
+      arrow1.lineTo(  0,          -deltaY );
+      arrow1.lineTo( -deltaX,     0. );
+      arrow1.lineTo( -widthArr2,  0 );
+      arrow1.lineTo( -widthArr2, deltaY );
+      arrow1.lineTo(  0,         deltaY );
+      if ( correct )
+        deltaX = -deltaX;
+      x11 = -deltaX; y11 = -deltaY; x12 = deltaX; y12 = deltaY;
+      break;
+    }
+    case QStyle::PE_IndicatorArrowLeft: // to change
+      correct = true;
+    case QStyle::PE_IndicatorArrowRight: {
+      int widthArr2 = (int)(deltaX/3.);
+      if ( correct )
+        deltaX = -deltaX; // change arrow direction
+      arrow1.moveTo( -deltaX,  0 );
+      arrow1.lineTo( -deltaX,  widthArr2 );
+      arrow1.lineTo(  0,       widthArr2 );
+      arrow1.lineTo(  0,       deltaY );
+      arrow1.lineTo(  deltaX,  0 );
+      arrow1.lineTo(  0,      -deltaY );
+      arrow1.lineTo(  0,      -widthArr2 );
+      arrow1.lineTo( -deltaX, -widthArr2 );
+      arrow1.lineTo( -deltaX,  0 );
+      x11 = deltaX; y11 = deltaY; x12 = -deltaX; y12 = -deltaY;
+      break;
+    }
+    case QStyle::PE_IndicatorSpinDown:
+      correct = true;
+    case QStyle::PE_IndicatorSpinUp: {
+      aDelta = (int)(deltaY/2);
+      if ( correct ) {
+        aDelta = (int)(-aDelta/2);
+        deltaY = -deltaY;
+      }
+      arrow1.moveTo(  deltaX,     -aDelta );
+      arrow1.lineTo(  0,          -aDelta-deltaY );
+      arrow1.lineTo( -deltaX,     -aDelta );
+      arrow1.lineTo(  deltaX,     -aDelta );
+      if ( correct )
+        deltaX = -deltaX;
+      x11 = -deltaX, y11 = -deltaY, x12 = deltaX, y12 = 0;
+      break;
+    }
+    default:
+      p->restore();
+      return;
+  }
+  p->setPen( pen );
+  p->setBrush( brush );
+
+  QLinearGradient gr( x11, y11, x12, y12 );
+  gr.setColorAt( 0.0, pen );                // grayer
+  gr.setColorAt( 1.0, brush);               // lighter
+  p->fillPath( arrow1, gr );
+  p->strokePath( arrow1, QPen( pen, Qt::SolidLine ) );
+
+  p->restore();
+}
+
+QPainterPath Style_Tools::tabRect( QPainter* p, const QRect& r, const int position, const double rad,
+                                   const double delta, const QColor& light, const QColor& dark,
+                                   const QColor& border_top, const QColor& border_bot,
+                                   const bool selected, const bool isLast,  const bool isHover,
+                                   const bool focusRect, const bool draw )
+{
+  // paths
+  int x = r.x()+1, y = r.y()+1, right = r.right()+1, left = r.left()-1,
+      bottom = r.bottom()-1, top = r.top()+1;
+  int aDelta;
+  if ( position == QTabWidget::North || position == QTabWidget::South )
+    aDelta = (int)((bottom - top)*delta/2);
+  else
+    aDelta = (int)((right-left)*delta/2);  
+
+  int aRad = getMaxRect( r, (int)rad );
+
+  // main path
+  QPainterPath path, strokePath;
+  switch ( position ) {
+    case QTabWidget::North: {
+      path.moveTo( x, bottom );
+      path.lineTo( x, y+aRad );
+      path.arcTo( x, y, 2*aRad, 2*aRad, 180, -90 );
+      if ( isLast )
+        right = right - aDelta;
+      path.lineTo( right-aDelta, y );
+      path.lineTo( right+aDelta, bottom );
+      strokePath.moveTo( x, bottom );
+      strokePath.lineTo( right+aDelta, bottom );
+      break;
+    }
+    case QTabWidget::South: {
+      path.moveTo( x, y );
+      path.lineTo( x, bottom-aRad );
+      path.arcTo( x, bottom-2*aRad, 2*aRad, 2*aRad, 180, 90 );
+      if ( isLast )
+        right = right - aDelta;
+      path.lineTo( right-aDelta, bottom );
+      path.lineTo( right+aDelta, y );
+      strokePath.moveTo( x, y );
+      strokePath.lineTo( right+aDelta, y );
+      break;
+    }
+    case QTabWidget::West: {
+      path.moveTo( right, y );
+      path.lineTo( x+aRad, y );
+      path.arcTo( x, y, 2*aRad, 2*aRad, 90, 90 );
+      if ( isLast )
+        bottom = bottom - aDelta;
+      path.lineTo( x, bottom-aDelta );
+      path.lineTo( right, bottom+aDelta );
+      strokePath.moveTo( right, y );
+      strokePath.lineTo( right, bottom+aDelta );
+      break;
+    }
+    case QTabWidget::East: {
+      path.moveTo( x, y );
+      path.lineTo( right-aRad, y );
+      path.arcTo( right-2*aRad, y, 2*aRad, 2*aRad, 90, -90 );
+      if ( isLast )
+        bottom = bottom - aDelta;
+      path.lineTo( right, bottom-aDelta );
+      path.lineTo( x, bottom+aDelta );
+      strokePath.moveTo( x, y );
+      strokePath.lineTo( x, bottom+aDelta );
+      break;
+    }
+  }
+  if ( !draw )
+    return path;
+
+  // draw path
+  p->save();
+  p->setRenderHint( QPainter::Antialiasing, true );
+  if ( focusRect ) {
+    path.closeSubpath();
+    drawFocus( p, path, dark, false );
+  }
+  else {
+    QLinearGradient gr( x, y, x, bottom );
+    if ( selected ) {
+      gr.setColorAt( 0.0, light );
+      gr.setColorAt( 1.0, light );
+    }
+    else if ( isHover ) {
+      gr.setColorAt( 0.0, dark );
+      gr.setColorAt( 0.2, light );
+      gr.setColorAt( 0.8, light );
+      gr.setColorAt( 1.0, dark );
+      QLinearGradient gr_1( x, y, right, y );
+      QColor aLight = light;
+      aLight.setAlpha( 0 );
+      gr_1.setColorAt( 0.0, dark );
+      gr_1.setColorAt( 0.2, aLight );
+      gr_1.setColorAt( 0.7, aLight );
+      gr_1.setColorAt( 1.0, dark );
+      p->fillPath( path, gr );
+      p->fillPath( path, gr_1 );
+    }
+    else {
+      gr.setColorAt( 0.0, light );
+      gr.setColorAt( 0.3, dark );
+      gr.setColorAt( 0.7, dark );
+      gr.setColorAt( 1.0, light );
+    }
+    if ( !isHover || selected )
+      p->fillPath( path, gr );
+
+    QColor bordCol = border_top;
+    if ( position == QTabWidget::South || position == QTabWidget::East )
+      bordCol = border_bot;
+    else
+      bordCol = border_top;
+    p->strokePath( path, QPen( bordCol, Qt::SolidLine ) );
+    p->setRenderHint( QPainter::Antialiasing, false );
+    p->strokePath( strokePath, QPen( selected ? light : bordCol, Qt::SolidLine ) );
+  }
+  p->restore();
+  return path;
+}
+
+void Style_Tools::drawFocus( QPainter* p, const QRect& aRect, const double rad, const int type,
+                             const QColor& border )
+{
+  QPainterPath path = Style_Tools::roundRect( aRect, rad, type );
+
+  drawFocus( p, path, border );
+}
+
+void Style_Tools::drawFocus( QPainter* p, const QPainterPath& path, const QColor& border,
+                             const bool line )
+{
+  QPen oldPen = p->pen();
+  QPen aPen = oldPen;
+  aPen.setColor( border );
+  if ( !line )
+    aPen.setStyle( Qt::DotLine );
+  p->setPen( aPen );
+
+  p->drawPath( path );
+  p->setPen( oldPen );
+}
+
+void Style_Tools::drawSlider( QPainter* p, const QRect& r, const double rad,
+                              SliderType type, const QColor& light, const QColor& dark,
+                              const QColor& border_top, const QColor& border_bot )
+{
+  p->save();
+  QPainterPath path, bottomPath;
+  if ( rad == 0 )
+    type = SlNone;
+  int aRad = getMaxRect( r, (int)rad );
+  int w = r.width(), h = r.height();
+  int xc = r.center().x(), yc = r.center().y();
+  p->translate( xc, yc );
+  QLinearGradient gr;
+  switch ( type ) {
+    case SlUp:
+    case SlDown: {
+      int aDeltaX = (int)(w/2), aDeltaY = (int)(h/4), aDeltaArr = (int)(aDeltaY/2);
+      if ( type == SlDown )
+        p->rotate( 180 );
+      path.moveTo(  0,       -2*aDeltaY );
+      path.lineTo(  aDeltaX, -aDeltaY+aDeltaArr );
+      path.lineTo(  aDeltaX, 2*aDeltaY-aRad );
+      path.arcTo(   aDeltaX-2*aRad, 2*aDeltaY-2*aRad, 2*aRad, 2*aRad, 0, -90 );
+      path.lineTo( -aDeltaX+aRad, 2*aDeltaY );
+      path.arcTo(  -aDeltaX,  2*aDeltaY-2*aRad, 2*aRad, 2*aRad, 270, -90 );
+      path.lineTo( -aDeltaX, -aDeltaY+aDeltaArr );
+      path.lineTo( 0,       -2*aDeltaY );
+      bottomPath = path;
+      gr.setStart( 0, -2*aDeltaY );
+      gr.setFinalStop( 0, 2*aDeltaY );
+      break;
+    }
+    case SlLeft:
+    case SlRight: {
+      int aDeltaX = (int)(w/4), aDeltaY = (int)(h/2), aDeltaArr = (int)(aDeltaX/2);
+      if ( type == SlRight )
+        p->rotate( 180 );
+      path.moveTo( -2*aDeltaX,        0 );
+      path.lineTo( -aDeltaX+aDeltaArr,aDeltaY );
+      path.lineTo(  2*aDeltaX-aRad,   aDeltaY );
+      path.arcTo(   2*aDeltaX-2*aRad, aDeltaY-2*aRad, 2*aRad, 2*aRad, 270, 90 );
+      path.lineTo(  2*aDeltaX,       -aDeltaY+aRad );
+      path.arcTo(   2*aDeltaX-2*aRad, -aDeltaY, 2*aRad, 2*aRad, 0, 90 );
+      path.lineTo( -aDeltaX+aDeltaArr,-aDeltaY );
+      path.lineTo( -2*aDeltaX,       0 );
+      gr.setStart( -2*aDeltaX, 0 );
+      gr.setFinalStop( 2*aDeltaX, 0 );
+      bottomPath = path;
+      break;
+    }
+    case SlNone: {
+      p->translate( -xc, -yc );
+      path = Style_Tools::roundRect( r, rad, Style_Tools::All );
+      bottomPath = path;
+      gr.setStart( r.x(), r.y() );
+      gr.setFinalStop( r.x(), r.bottom() );
+      break;
+    }
+    default:
+      return;
+  }
+  p->setRenderHint( QPainter::Antialiasing );
+  gr.setColorAt( 0.0, light );
+  gr.setColorAt( 1.0, dark );
+  p->fillPath( path, gr );
+
+  QColor bottomShadow = border_bot;
+  p->strokePath( bottomPath, bottomShadow );
+  p->setRenderHint( QPainter::Antialiasing, false );
+  p->restore();
+}
+
+void Style_Tools::highlightRect( QPainter* p, const QRect& rect, const double rad, const int type,
+                                 const double marg, const QColor& center, const QColor& out_center,
+                                 const QColor& border )
+{
+  QPainterPath path = Style_Tools::roundRect( rect, rad, type );
+  QLinearGradient gr_h( rect.x(), rect.y(), rect.right(), rect.y() ),
+                  gr_v( rect.x(), rect.y(), rect.x(), rect.bottom() );
+  double aXDelta = marg > 0 ? marg/rect.width() : 0.5;
+  double aYDelta = marg > 0 ? marg/rect.height() : 0.5;
+  if ( aYDelta > 0.5 )
+    aYDelta = 0.25;
+  gr_v.setColorAt( 0.0, out_center );
+  gr_v.setColorAt( aYDelta, center );
+  gr_v.setColorAt( 1-aYDelta, center );
+  gr_v.setColorAt( 1.0, out_center );
+
+  QColor aCenter = center;
+  aCenter.setAlpha( 0 );
+  if ( aXDelta > 0.5 )
+    aXDelta = 0.25;
+  gr_h.setColorAt( 0.0, out_center );
+  gr_h.setColorAt( aXDelta, aCenter );
+  gr_h.setColorAt( 1-aXDelta, aCenter );
+  gr_h.setColorAt( 1.0, out_center );
+
+  p->fillPath( path, gr_v );
+  if ( marg > 0 )
+    p->fillPath( path, gr_h );
+  p->strokePath( path, border );
+}
+
+int Style_Tools::getMinDelta( const QRect& rect, const QSize& size, const int defDelta )
+{
+  int aDelta = defDelta;
+  aDelta = qMin( aDelta, ( rect.height() - size.height() ) / 2 );
+  aDelta = qMin( aDelta, ( rect.width()  - size.width() )  / 2 );
+  return aDelta;
+}
+
+int Style_Tools::getMaxRect( const QRect& rect, const int defRect )
+{
+  int aRect = defRect;
+  aRect = qMin( aRect, rect.height() / 2 );
+  aRect = qMin( aRect, rect.width()  / 2 );
+  return aRect;
+}
+
diff --git a/src/Style/Style_Tools.h b/src/Style/Style_Tools.h
new file mode 100644 (file)
index 0000000..381c5a3
--- /dev/null
@@ -0,0 +1,90 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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
+//
+// File   : Style_Tools.h
+// Author : Natalia Ermolaeva, Open CASCADE S.A.S.
+//
+
+#ifndef STYLE_TOOLS_H
+#define STYLE_TOOLS_H
+
+#include "Style.h"
+#include <QPainterPath>
+#include <QRect>
+#include <QColor>
+#include <QStyle>
+
+class STYLE_SALOME_EXPORT Style_Tools
+{
+public:
+  typedef enum { None        = 0x00000000,
+                 All         = 0x00000001,
+                 Right       = 0x00000002, 
+                 Left        = 0x00000004,
+                 TopLeft     = 0x00000008,
+                 TopRight    = 0x00000010,
+                 BottomLeft  = 0x00000020,
+                 BottomRight = 0x00000040
+                 } RoundType;
+
+  typedef enum { WholePath, BottomPath, TopPath } ShadowType;
+
+  typedef enum { SlUp, SlDown, SlLeft, SlRight, SlNone } SliderType;
+
+  static QPainterPath painterPath( const QRect& );
+  static QPainterPath substractPath( const QPainterPath&, const QPainterPath& );
+
+  static QPainterPath roundRect( const QRect&, const double, int = 0, int = 0 );
+
+  static void         roundRect( QPainter*, const QRect&, const double, const int,
+                                 const QColor&, const QColor&, bool = true, bool = true );
+
+  static void         shadowRect( QPainter*, const QRect&, const double,
+                                  const double, const int, int,
+                                  const QColor&, const QColor&, const QColor&,
+                                  const QColor&, const bool, const bool,
+                                  const bool = false, const bool = true );
+  static void         shadowCheck( QPainter*, const QRect&, const double, const int,
+                                   const QColor&, const QColor&,
+                                   const QColor&, const QColor& );
+  static void         arrowRect( QPainter*, const QRect&, const QColor&,
+                                 const QColor&, const QColor& );
+  static void         fillRect( QPainter*, const QRect&, const QColor&,
+                                const QColor&, const int = 255 );
+  static void         drawArrow( QStyle::PrimitiveElement, QPainter*, const QRect&,
+                                 const QColor&, const QColor& );
+  static QPainterPath tabRect( QPainter*, const QRect&, const int, const double,
+                               const double, const QColor&, const QColor&,
+                               const QColor&, const QColor&,
+                               const bool, const bool, const bool,
+                               const bool = false, const bool = true );
+  static void         drawFocus( QPainter*, const QRect&, const double, const int,
+                                 const QColor& );
+  static void         drawFocus( QPainter*, const QPainterPath&, const QColor&,
+                                 const bool = true );
+  static void         drawSlider( QPainter*, const QRect&, const double,
+                                  SliderType, const QColor&, const QColor&,
+                                  const QColor&, const QColor& );
+  static void         highlightRect( QPainter*, const QRect&, const double, const int,
+                                     const double, const QColor&, const QColor&,
+                                     const QColor& );
+  static int          getMinDelta( const QRect&, const QSize&, const int );
+  static int          getMaxRect( const QRect&, const int );
+};
+
+#endif // STYLE_TOOLS_H