]> Creatis software - bbtkGEditor.git/commitdiff
First classes usign VTK objects . connection
authorcorredor <>
Wed, 24 Mar 2010 15:55:38 +0000 (15:55 +0000)
committercorredor <>
Wed, 24 Mar 2010 15:55:38 +0000 (15:55 +0000)
appli/bbEditor/CMakeLists.txt
appli/bbEditor/bbEditor.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/CMakeLists.txt
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h

index 56b590c821cc2b58ad717d0113691c295c2ef8df..69c2a4f88d6b54f3eac5791b355ce4a24cdbebfd 100644 (file)
@@ -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} 
index 4bdc42383d3ae83c56dd1ca70b9d2bd6fa319cfd..57bd80ccec7262fe984642c282e5d80e61a300b5 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <wx/cmdline.h> 
 #include <wx/app.h>
-
 
 class wxBBEditorApp : public wxApp
 {
@@ -20,7 +20,7 @@ public:
   
 IMPLEMENT_APP(wxBBEditorApp);
  
-
 
 // ----------------------------------------------------------------------------
 // The `main program' equivalent, creating the windows and returning the
index e867b9b644142ddb2e13ab59f9acfa8b37300805..1b87e2c766746a852a77ba18d83867761bc8e5b5 100644 (file)
@@ -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
index 7a0a5413ee4a66be8c3cee3ed416cecf7b2e5378..f3383ed5600286c079a76898e64bcba9a93a76dc 100644 (file)
@@ -43,10 +43,18 @@ Version:   $Revision$
 #ifndef __wxVtkSceneManager_h__
 #define __wxVtkSceneManager_h__
 
+//Includes Same project
+#include "VTKGObjectsFactory.h"
+
 //Includes creaMaracasVisu
 #include <wxVtk3DBaseView.h>
 #include <InteractorStyleMaracas.h>
 
+//Includes vtk
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkRenderer.h>
+
 //Includes std
 #include <iostream>
 
@@ -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:
 
index 4287ca8617970fa8fc025b75cb319c7032706910..18d6e909248ee44e0fe7e8d6bada1bea18b225aa 100644 (file)
@@ -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}  )
+
index 3d761d467899bdc55cdef30204d2a9fedbe8ea3b..f2e6e086a58a0aa4986deefee9258e30e904ba5e 100644 (file)
@@ -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"<<std::endl;
                        _tabsMgr->addNewTab();
                        break;
-               case wxID_NEW+1 :
-                       //BlackBoxDescriptor* desc = _pkgBrowser->GetActualSelected();
-                       //cout<<"RaC GetActualSelected desc:"<<desc->GetAuthor()<<endl;
+               case 15 :
+                       BlackBoxDescriptor* desc = _pkgBrowser->GetActualSelected();
+                       cout<<"RaC GetActualSelected desc:"<<desc->GetAuthor()<<endl;
+
                }
        }
 
index 725d3f10716986d2d2b13d53abd1f57b3e3bdd66..91b9d50bd571a7b21efef4a3358b635b0ea1f483 100644 (file)
@@ -52,6 +52,7 @@
 #include <wx/bitmap.h>
 #include <wx/menu.h>
 #include "wxart_new.xpm"
+#include <wx/dnd.h>
 
 #include <bbtkBlackBoxDescriptor.h>
 
index 93653067a8b58e6dfb875614cd0d30aeb10fa1cb..e5c437be980fae4303cf7578d12c805f110a6259 100644 (file)
@@ -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:"<<data<<" x:"<<x<<" y:"<<y<<endl;
          return true;
 
index 98a9ead6ed77b29bb5aef5d3813e95e78fbdef4a..f84d193f61823030c597f56cd3cc57a79e30a4a3 100644 (file)
@@ -52,6 +52,7 @@ Version:   $Revision$
 #include <iostream>
 
 #include "wxVtkSceneManager.h"
+#include "VTKGObjectsFactory.h"
 
 namespace bbtk
 {
index 0dc9e42a2673810c5f6ea8d6e8fd361f23d9945d..f34682c4533e8d5ba88921b19c4870ea4a9d834d 100644 (file)
@@ -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;
        }
index 6d4b90a05dd098a2a8f906982d3f43291ee8dc65..5f08e601e731a5261e218b5c28f682e18850bea0 100644 (file)
@@ -45,6 +45,7 @@ Version:   $Revision$
 
 #include <wx/aui/auibook.h>
 #include <wx/panel.h>
+#include <wx/string.h>
 #include <map>
 #include <iostream>
 
@@ -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<int, wxPanel*> _panels;
-               wxPanel* _actual;
+               wxGEditorTabPanel* _actual;
                wxAuiNotebook  *_notebook;
                int _lastId;