@COMMENCE@
-SUBDIRS = CONVERTOR PIPELINE OBJECT ENGINE GUITOOLS VISU_I VISUGUI VISU_SWIG
+SUBDIRS = CONVERTOR PIPELINE OBJECT ENGINE VVTK GUITOOLS VISU_I VISUGUI VISU_SWIG
@MODULE@
-I${GUI_ROOT_DIR}/include/salome
LDFLAGS += $(QWT_LIBS) -lSalomeNS \
- -lSVTK -lSPlot2d -lVisuObject -lVISUEngineImpl -lVISUGUITOOLS \
+ -lSVTK -lVVTK -lSPlot2d -lVisuObject -lVISUEngineImpl -lVISUGUITOOLS \
-L${KERNEL_ROOT_DIR}/lib/salome \
-L${GUI_ROOT_DIR}/lib/salome
msgid "VisuGUI_Module::MEN_NEW_VIEWER"
msgstr "New Viewer"
+
+msgid "VVTK_ViewManager::VTK_VIEW_TITLE"
+msgstr "VISU scene:%1 - viewer:%2"
\ No newline at end of file
#include "SalomeApp_SelectionMgr.h"
#include "SalomeApp_VTKSelector.h"
-#include "SVTK_ViewManager.h"
-#include "SVTK_ViewModel.h"
+#include "VVTK_ViewManager.h"
+#include "VVTK_ViewModel.h"
#ifdef _DEBUG_
static int MYDEBUG = 1;
//---------------------------------------------------------------
class Viewer
{
- SVTK_ViewManager* myViewManager;
+ VVTK_ViewManager* myViewManager;
SalomeApp_VTKSelector* mySelector;
public:
Viewer(VisuGUI_Module* theModule, TViewerMap& theViewerMap)
{
SalomeApp_Application* anApp = theModule->getApp();
- myViewManager = new SVTK_ViewManager( anApp->activeStudy(), anApp->desktop() );
- SVTK_Viewer* aViewer = (SVTK_Viewer*)myViewManager->getViewModel();
+ myViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() );
+ VVTK_Viewer* aViewer = (VVTK_Viewer*)myViewManager->getViewModel();
mySelector = new SalomeApp_VTKSelector( aViewer, anApp->selectionMgr() );
anApp->addViewManager( myViewManager );
{
VisuGUI::initialize( theApp );
- onCreateViewManager();
-
// Add menus
int aMenuId;
aMenuId = createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
--- /dev/null
+# File : Makefile.in
+# Author : Alexander Solovyov(OCN)
+# Module : VVTK
+# $Header:
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS= VVTK.h \
+ VVTK_ViewManager.h \
+ VVTK_ViewModel.h \
+ VVTK_ViewWindow.h
+
+# Libraries targets
+LIB = libVVTK.la
+
+LIB_SRC= VVTK_ViewManager.cxx \
+ VVTK_ViewModel.cxx \
+ VVTK_ViewWindow.cxx
+
+LIB_MOC = VVTK_ViewWindow.h \
+ VVTK_ViewModel.h \
+ VVTK_ViewManager.h
+
+CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS) \
+ -I$(KERNEL_ROOT_DIR)/include/salome \
+ -I$(GUI_ROOT_DIR)/include/salome
+
+LDFLAGS+=$(QT_MT_LIBS) $(OCC_LIBS) $(VTK_LIBS) \
+ -L$(KERNEL_ROOT_DIR)/lib/salome \
+ -L$(GUI_ROOT_DIR)/lib/salome
+
+LIBS+= -lsuit -lCAM -lSalomeObject -lSVTK -lOpUtil
+
+@CONCLUDE@
--- /dev/null
+#ifdef WNT
+#ifdef SVTK_EXPORTS
+#define VVTK_EXPORT __declspec(dllexport)
+#else
+#define VVTK_EXPORT __declspec(dllimport)
+#endif
+#else
+#define VVTK_EXPORT
+#endif
+
+#if defined WNT
+#pragma warning ( disable: 4251 )
+#endif
--- /dev/null
+#include "VVTK_ViewManager.h"
+#include "VVTK_ViewModel.h"
+
+int VVTK_ViewManager::_VVTKViewMgr_Id = 0;
+
+//***************************************************************
+VVTK_ViewManager
+::VVTK_ViewManager( SUIT_Study* study,
+ SUIT_Desktop* theDesktop )
+: SUIT_ViewManager( study, theDesktop )
+{
+ myId = ++_VVTKViewMgr_Id;
+ setViewModel( new VVTK_Viewer() );
+}
+
+//***************************************************************
+VVTK_ViewManager::~VVTK_ViewManager()
+{
+}
+
+//***************************************************************
+void VVTK_ViewManager::setViewName(SUIT_ViewWindow* theView)
+{
+ int aPos = myViews.find(theView);
+ theView->setCaption( tr( "VTK_VIEW_TITLE" ).arg( myId ).arg( aPos + 1 ) );
+}
--- /dev/null
+#ifndef VVTK_VIEWMANAGER_H
+#define VVTK_VIEWMANAGER_H
+
+#include "SUIT_ViewManager.h"
+#include "VVTK.h"
+
+class SUIT_Desktop;
+
+class VVTK_EXPORT VVTK_ViewManager : public SUIT_ViewManager
+{
+ Q_OBJECT;
+public:
+
+ VVTK_ViewManager( SUIT_Study* study, SUIT_Desktop* );
+ virtual ~VVTK_ViewManager();
+
+protected:
+ void setViewName( SUIT_ViewWindow* theView );
+
+private:
+ int myId;
+ static int _VVTKViewMgr_Id;
+};
+
+#endif
--- /dev/null
+#include <qpopupmenu.h>
+#include <qcolordialog.h>
+
+#include "VVTK_ViewModel.h"
+#include "VVTK_ViewWindow.h"
+
+#include "SVTK_RenderWindowInteractor.h"
+#include "SVTK_RenderWindow.h"
+#include "SVTK_View.h"
+
+#include "VTKViewer_ViewModel.h"
+
+//==========================================================
+VVTK_Viewer
+::VVTK_Viewer()
+{
+ myTrihedronSize = 100;
+}
+
+VVTK_Viewer
+::~VVTK_Viewer()
+{
+}
+
+
+//==========================================================
+void
+VVTK_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*)));
+}
+
+
+//==========================================================
+SUIT_ViewWindow*
+VVTK_Viewer
+::createView( SUIT_Desktop* theDesktop )
+{
+ TViewWindow* aViewWindow = new TViewWindow( theDesktop, this );
+ aViewWindow->setBackgroundColor( backgroundColor() );
+ aViewWindow->SetTrihedronSize( trihedronSize() );
+ return aViewWindow;
+}
+
+
+//==========================================================
+void
+VVTK_Viewer
+::contextMenuPopup( QPopupMenu* thePopup )
+{
+ thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
+ thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
+
+ thePopup->insertSeparator();
+
+ if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
+ if ( !aView->getView()->getToolBar()->isVisible() ){
+ thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
+ }
+ }
+}
+
+
+//==========================================================
+void
+VVTK_Viewer
+::Repaint()
+{
+ QPtrVector<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->getView()->update();
+ }
+ }
+}
+
+
+//==========================================================
+void
+VVTK_Viewer
+::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event)
+{}
+
+void
+VVTK_Viewer
+::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event)
+{}
+
+void
+VVTK_Viewer
+::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event)
+{}
+
+
+//==========================================================
+QColor
+VVTK_Viewer
+::backgroundColor() const
+{
+ return myBgColor;
+}
+
+void
+VVTK_Viewer
+::setBackgroundColor( const QColor& theColor )
+{
+ if ( !theColor.isValid() )
+ return;
+
+ QPtrVector<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;
+}
+
+//==========================================================
+int
+VVTK_Viewer
+::trihedronSize() const
+{
+ return myTrihedronSize;
+}
+
+void
+VVTK_Viewer
+::setTrihedronSize( const int theSize )
+{
+ myTrihedronSize = theSize;
+ if(SUIT_ViewManager* aViewManager = getViewManager()){
+ QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
+ for ( int i = 0; i < aViews.count(); i++ ){
+ if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i ))){
+ aView->SetTrihedronSize( theSize );
+ }
+ }
+ }
+}
+
+//==========================================================
+void
+VVTK_Viewer
+::onDumpView()
+{
+ if(SUIT_ViewWindow* aView = myViewManager->getActiveView())
+ aView->onDumpView();
+}
+
+//==========================================================
+void
+VVTK_Viewer
+::onChangeBgColor()
+{
+ if(SUIT_ViewWindow* aView = myViewManager->getActiveView()){
+ QColor aColor = QColorDialog::getColor( backgroundColor(), aView);
+ setBackgroundColor(aColor);
+ }
+}
+
+//==========================================================
+void
+VVTK_Viewer
+::onShowToolbar()
+{
+ QPtrVector<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->getView()->getToolBar()->show();
+ }
+ }
+}
+
--- /dev/null
+#ifndef VVTK_VIEWMODEL_H
+#define VVTK_VIEWMODEL_H
+
+#include <qcolor.h>
+
+#include "VVTK.h"
+#include "SVTK_ViewModelBase.h"
+
+class VVTK_ViewWindow;
+
+class VVTK_EXPORT VVTK_Viewer : public SVTK_ViewModelBase
+{
+ Q_OBJECT;
+
+public:
+ typedef VVTK_ViewWindow TViewWindow;
+ static QString Type() { return "VVTK"; }
+
+ VVTK_Viewer();
+ virtual ~VVTK_Viewer();
+
+ virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
+
+ virtual void setViewManager(SUIT_ViewManager* theViewManager);
+ virtual void contextMenuPopup( QPopupMenu* );
+ virtual QString getType() const { return Type(); }
+
+ virtual void Repaint();
+
+ QColor backgroundColor() const;
+ void setBackgroundColor( const QColor& );
+
+ int trihedronSize() const;
+ void setTrihedronSize( const int );
+
+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;
+ int myTrihedronSize;
+ bool mySelectionEnabled;
+ bool myMultiSelectionEnabled;
+};
+
+#endif
--- /dev/null
+#include "VVTK_ViewWindow.h"
+#include "VVTK_ViewModel.h"
+
+//----------------------------------------------------------------------------
+VVTK_ViewWindow
+::VVTK_ViewWindow( SUIT_Desktop* theDesktop,
+ VVTK_Viewer* theModel )
+ : SVTK_ViewWindow( theDesktop, theModel )
+{
+ connect(this,SIGNAL(selectionChanged()),
+ theModel,SLOT(onSelectionChanged()));
+}
+
+//----------------------------------------------------------------------------
+VVTK_ViewWindow
+::~VVTK_ViewWindow()
+{}
--- /dev/null
+#ifndef VVTK_VIEWWINDOW_H
+#define VVTK_VIEWWINDOW_H
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+#include "VVTK.h"
+#include "SVTK_ViewWindow.h"
+
+class VVTK_Viewer;
+
+class VVTK_EXPORT VVTK_ViewWindow : public SVTK_ViewWindow
+{
+ Q_OBJECT;
+
+public:
+ VVTK_ViewWindow( SUIT_Desktop*, VVTK_Viewer* );
+ virtual ~VVTK_ViewWindow();
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif