From: corredor <> Date: Wed, 24 Mar 2010 15:55:38 +0000 (+0000) Subject: First classes usign VTK objects . connection X-Git-Tag: v1_0_0~120 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=ac7e88cf5991d996435b15c7d731b67078f8b2c9;p=bbtkGEditor.git First classes usign VTK objects . connection --- diff --git a/appli/bbEditor/CMakeLists.txt b/appli/bbEditor/CMakeLists.txt index 56b590c..69c2a4f 100644 --- a/appli/bbEditor/CMakeLists.txt +++ b/appli/bbEditor/CMakeLists.txt @@ -21,10 +21,11 @@ ELSE(BBTK_USE_WXWIDGETS AND WIN32) ADD_EXECUTABLE(bbEditor MACOSX_BUNDLE ${SOURCES} ) ENDIF(BBTK_USE_WXWIDGETS AND WIN32) - + TARGET_LINK_LIBRARIES(bbEditor bbsWxGUIEditorGraphic bbsKernelEditorGraphic + bbsVtkGUIEditorGraphic ${VTK_LIBRARIES} ${WXWIDGETS_LIBRARIES} ${creaMaracasVisu_LIBRARIES} diff --git a/appli/bbEditor/bbEditor.cxx b/appli/bbEditor/bbEditor.cxx index 4bdc423..57bd80c 100644 --- a/appli/bbEditor/bbEditor.cxx +++ b/appli/bbEditor/bbEditor.cxx @@ -8,7 +8,7 @@ #include #include - + class wxBBEditorApp : public wxApp { @@ -20,7 +20,7 @@ public: IMPLEMENT_APP(wxBBEditorApp); - + // ---------------------------------------------------------------------------- // The `main program' equivalent, creating the windows and returning the diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx index e867b9b..1b87e2c 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx @@ -47,15 +47,16 @@ namespace bbtk //========================================================================= - wxVtkSceneManager::wxVtkSceneManager(wxVtk3DBaseView *baseView,int id) + wxVtkSceneManager::wxVtkSceneManager(wxDropTarget *parent, wxVtk3DBaseView *baseView,int id) { _id=id; _baseView=baseView; if( _baseView!=NULL ) { - vtkInteractorStyleBaseView* baseViewControlManager = (vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView(); - baseViewControlManager->AddInteractorStyleMaracas( this ); + + _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(parent); + registerController(this); configureBaseView(); vtkRenderer *ren1 =_baseView->GetRenderer(); @@ -79,6 +80,7 @@ namespace bbtk //========================================================================= wxVtkSceneManager::~wxVtkSceneManager() { + //_baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(NULL); } //========================================================================= @@ -90,6 +92,37 @@ namespace bbtk //========================================================================= + void wxVtkSceneManager::createGBlackBox() + { + InteractorStyleMaracas *toAdd = VTKGObjectsFactory::getInstance()->createGBlackBox(_baseView); + registerController(toAdd); + } + + //========================================================================= + + void wxVtkSceneManager::registerController(InteractorStyleMaracas *param) + { + vtkInteractorStyleBaseView* baseViewControlManager = (vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView(); + baseViewControlManager->AddInteractorStyleMaracas( param ); + } + + //========================================================================= + + vtkRenderer* wxVtkSceneManager::getRenderer() + { + return _baseView->GetRenderer(); + } + + //========================================================================= + + vtkRenderWindow* wxVtkSceneManager::getRenderWindow() + { + return _baseView->GetRenWin(); + } + //========================================================================= + + + //========================================================================= } // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h index 7a0a541..f3383ed 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h @@ -43,10 +43,18 @@ Version: $Revision$ #ifndef __wxVtkSceneManager_h__ #define __wxVtkSceneManager_h__ +//Includes Same project +#include "VTKGObjectsFactory.h" + //Includes creaMaracasVisu #include #include +//Includes vtk +#include +#include +#include + //Includes std #include @@ -56,11 +64,15 @@ namespace bbtk class wxVtkSceneManager : public InteractorStyleMaracas { public: - wxVtkSceneManager(wxVtk3DBaseView *baseView, int id); + wxVtkSceneManager(wxDropTarget *parent, wxVtk3DBaseView *baseView, int id); ~wxVtkSceneManager(); void configureBaseView(); - //void addGBox(double x=0, double y=0); + void createGBlackBox(); + void registerController(InteractorStyleMaracas *param); + + vtkRenderWindow* getRenderWindow(); + vtkRenderer* getRenderer(); private: diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/CMakeLists.txt b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/CMakeLists.txt index 4287ca8..18d6e90 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/CMakeLists.txt +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/CMakeLists.txt @@ -1 +1,12 @@ -# \ No newline at end of file + + +FILE(GLOB bbsVtkGUIEditorGraphic_CXX_SOURCES "." "*.cxx") +FILE(GLOB bbsVtkGUIEditorGraphic_H_SOURCES "." "*.h") + +INCLUDE_DIRECTORIES(../bbsWxGUIEditorGraphic) +INCLUDE_DIRECTORIES(../bbsKernelEditorGraphic) + +ADD_LIBRARY(bbsVtkGUIEditorGraphic + ${bbsVtkGUIEditorGraphic_CXX_SOURCES} + ${bbsVtkGUIEditorGraphic_H_SOURCES} ) + diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index 3d761d4..f2e6e08 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -64,8 +64,9 @@ namespace bbtk initMenu(); initToolbar(); - initPackageBrowser(); initTabPanelsManager(); + initPackageBrowser(); + CreateStatusBar(); _frameAUIMgr->Update(); @@ -93,7 +94,7 @@ namespace bbtk //////////////////// // TEMP to avoid drag and drop - _toolbar->AddTool(wxID_NEW+1,_T("New Box"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New Box"), _T("Create a new Box")); + _toolbar->AddTool(15,_T("New Box"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New Box"), _T("Create a new Box")); // @@ -105,6 +106,7 @@ namespace bbtk // connect command event handlers Connect(wxID_NEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick)); + Connect(15,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick)); } @@ -144,8 +146,6 @@ namespace bbtk _pkgBrowser->IncludeAll(); _frameAUIMgr->AddPane(_pkgBrowser,wxAuiPaneInfo().Left().MinSize(200,200).CloseButton(false)); - //FIXME - Just the first tab with drop target event - //_pkgBrowser->SetBoxListDropTarget((wxDropTarget*)_tabsMgr->getActualTabPanel()); } /***************************************************** @@ -160,9 +160,10 @@ namespace bbtk std::cout<<"RaC New"<addNewTab(); break; - case wxID_NEW+1 : - //BlackBoxDescriptor* desc = _pkgBrowser->GetActualSelected(); - //cout<<"RaC GetActualSelected desc:"<GetAuthor()<GetActualSelected(); + cout<<"RaC GetActualSelected desc:"<GetAuthor()< #include #include "wxart_new.xpm" +#include #include diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index 9365306..e5c437b 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -45,7 +45,7 @@ namespace bbtk } //========================================================================= - wxGEditorTabPanel::wxGEditorTabPanel(wxWindow *parent,int id):wxPanel(parent) + wxGEditorTabPanel::wxGEditorTabPanel(wxWindow *parent,int id):wxPanel(parent),wxTextDropTarget() { _id=id; _panelAUIMgr = new wxAuiManager(this); @@ -57,6 +57,7 @@ namespace bbtk //========================================================================= wxGEditorTabPanel::~wxGEditorTabPanel() { + delete _sceneManager; } //========================================================================= @@ -64,7 +65,8 @@ namespace bbtk { wxVtk3DBaseView *baseview = new wxVtk3DBaseView(this); baseview->Configure(); - _sceneManager=new wxVtkSceneManager(baseview,_id); + + _sceneManager=new wxVtkSceneManager(this,baseview,_id); _panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane()); _panelAUIMgr->Update(); @@ -74,7 +76,7 @@ namespace bbtk bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data) { - + _sceneManager->createGBlackBox(); cout<<"RaC DyD:"< #include "wxVtkSceneManager.h" +#include "VTKGObjectsFactory.h" namespace bbtk { diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx index 0dc9e42..f34682c 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx @@ -59,7 +59,7 @@ namespace bbtk { _lastId++; - wxPanel *newPanel = new wxGEditorTabPanel(_notebook,_lastId); + wxGEditorTabPanel *newPanel = new wxGEditorTabPanel(_notebook,_lastId); _panels[_lastId]=newPanel; _actual = newPanel; @@ -73,7 +73,7 @@ namespace bbtk } //========================================================================= - wxPanel* wxTabPanelsManager::getActualTabPanel() + wxGEditorTabPanel* wxTabPanelsManager::getActualTabPanel() { return _actual; } diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h index 6d4b90a..5f08e60 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h @@ -45,6 +45,7 @@ Version: $Revision$ #include #include +#include #include #include @@ -63,7 +64,7 @@ namespace bbtk virtual void addNewTab(); wxAuiNotebook* getAuiNotebook(); - wxPanel* getActualTabPanel(); + wxGEditorTabPanel* getActualTabPanel(); private: @@ -71,7 +72,7 @@ namespace bbtk ** The map */ map _panels; - wxPanel* _actual; + wxGEditorTabPanel* _actual; wxAuiNotebook *_notebook; int _lastId;