]> Creatis software - bbtkGEditor.git/commitdiff
It is possible to center the view to the original point
authorcorredor <>
Wed, 5 May 2010 13:19:36 +0000 (13:19 +0000)
committercorredor <>
Wed, 5 May 2010 13:19:36 +0000 (13:19 +0000)
data/icons/wxart_centerview.xpm [new file with mode: 0644]
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx
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

diff --git a/data/icons/wxart_centerview.xpm b/data/icons/wxart_centerview.xpm
new file mode 100644 (file)
index 0000000..4a987f6
--- /dev/null
@@ -0,0 +1,22 @@
+/* XPM */
+static const char * centerview_xpm[] = {
+"17 15 3 1",
+"      c None",
+".     c #101010",
+"+     c #404040",
+" ............... ",
+" .             . ",
+" .             . ",
+" .  +++++++++  . ",
+" .  +       +  . ",
+" .  +       +  . ",
+" .  +       +  . ",
+" .  +   +   +  . ",
+" .  +       +  . ",
+" .  +       +  . ",
+" .  +       +  . ",
+" .  +++++++++  . ",
+" .             . ",
+" .             . ",
+" ............... ",
+};
index 1e325329ed126f41586323d971cd538c3ca15307..57a0358507298ace767884de7f363bc98f33790a 100644 (file)
@@ -921,7 +921,7 @@ namespace bbtk
        //=========================================================================
 
        void wxVtkSceneManager::deleteAllBoxes()
-       {
+       {               
                std::map<int, GObjectController*>::iterator it;
                for(it = _controllers.begin(); it != _controllers.end(); ++it)
                {
@@ -942,6 +942,21 @@ namespace bbtk
        }
 
        //=========================================================================
+       
+       void wxVtkSceneManager::centerView()
+       {
+               double temp[3];
+               _baseView->GetRenderer()->GetActiveCamera()->GetFocalPoint(temp);
+               printf("RaC wxVtkSceneManager::deleteAllBoxes() GetFocalPoint x:%f y:%f z:%f \n",temp[0],temp[1],temp[2]);
+               _baseView->GetRenderer()->GetActiveCamera()->SetFocalPoint(0,0,temp[2]);
+               _baseView->GetRenderer()->GetActiveCamera()->GetPosition(temp);
+               printf("RaC wxVtkSceneManager::deleteAllBoxes() GetPosition x:%f y:%f z:%f \n",temp[0],temp[1],temp[2]);
+               _baseView->GetRenderer()->GetActiveCamera()->SetPosition(0,0,temp[2]);
+               _baseView->RefreshView();
+
+       }
+
+       //=========================================================================
 
 }  // EO namespace bbtk
 
index 0f795e8d6eb42163d2573940f32dc23e26aef9ec..d789c7ad014733fa8e3e66925484e0eb4ec56541 100644 (file)
@@ -117,6 +117,8 @@ namespace bbtk
                std::string getDiagramScript();
                void deleteObject(int id);
                void deleteAllBoxes();
+               
+               void centerView();
 
                void refreshScene();
 
index 6a7c06843a49848d15017cbfb02e524b9f3691f1..0a352646e70a6e3d9d6a279def8c2232808c94fa 100644 (file)
@@ -128,7 +128,10 @@ namespace bbtk
                        {
                                ok=true;
                                _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
-                               SetState(5);
+                               if(_bakIdPoint!=0 && _bakIdPoint!=GetManualViewBaseContour()->GetNumberOfPoints()-1)
+                               {
+                                       SetState(5);
+                               }
                        }
                        // If nothing selected _state=7
                        if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
index 7f8e8ac21699f6c4af3470e4cc5d588aacf1f4fd..8d63e0db11f9b519e53d3321b980e68c0eab0ff0 100644 (file)
@@ -88,6 +88,7 @@ namespace bbtk
                wxBitmap bmp_new(new_xpm);
                wxBitmap bmp_run(run_xpm);
                wxBitmap bmp_delete(delete_xpm);
+               wxBitmap bmp_centerview(centerview_xpm);
 
                wxToolBar  *_toolbar = new wxToolBar(this, wxID_ANY);
 
@@ -95,6 +96,7 @@ namespace bbtk
                _toolbar->AddTool(1000,_T("New"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New tab"), _T("Create a new panel tab"));
                _toolbar->AddTool(1001,_T("Execute"),bmp_run, wxNullBitmap, wxITEM_NORMAL,_T("Execute actual diagram"), _T("Execute actual diagram"));
                _toolbar->AddTool(1002,_T("Delete all"),bmp_delete, wxNullBitmap, wxITEM_NORMAL,_T("Delete all boxes"), _T("Delete all boxes"));
+               _toolbar->AddTool(1003,_T("Center view"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Center view"), _T("Center view"));
 
                _toolbar->SetMargins( 2, 2 );
                _toolbar->Realize();
@@ -104,6 +106,7 @@ namespace bbtk
                Connect(1000,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
                Connect(1001,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
                Connect(1002,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
+               Connect(1003,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
 
        }
        //=========================================================================
@@ -362,12 +365,20 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxGUIEditorGraphicBBS::OnCenterViewActualDiagram(wxCommandEvent& event)
+       {
+               _tabsMgr->centerViewActualDiagram();
+       }
+
+       //=========================================================================
+
        void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event)
        {
                Close(true);
        }
 
 
+
 }  // EO namespace bbtk
 
 // EOF
index 2994c616890919fd9a0b1c5ccb76a3695c9b97cd..46dfd39febca37906badeaad7bfbc8af2c052c43 100644 (file)
@@ -51,6 +51,7 @@
 #include "wxart_new.xpm" // JPR
 #include "wxart_run.xpm"
 #include "wxart_delete.xpm"
+#include "wxart_centerview.xpm"
 
 //Includes creaMaracasVisu
 
@@ -110,6 +111,7 @@ namespace bbtk
                void OnCreateNewTab(wxCommandEvent& event);
                void OnExecuteActualDiagram(wxCommandEvent& event);
                void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
+               void OnCenterViewActualDiagram(wxCommandEvent& event);
                void OnExit(wxCommandEvent& event);
 
 
index 66dd7b04f70c1ffedcf999c7ed50f8a47a92ad9f..97a3d3abc45cd02e31d9e5e224f04fb96707c1d9 100644 (file)
@@ -147,6 +147,13 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxGEditorTabPanel::centerView()
+       {
+               _sceneManager->centerView();
+       }
+
+       //=========================================================================
+
 }  // EO namespace bbtk
 
 // EOF
index a50bda3d0f2a42503f97f2c98488c1d44ea88cd0..3f6e69930439b10ca8e9d65b2f5342e71d322f4e 100644 (file)
@@ -85,6 +85,9 @@ namespace bbtk
                void editBlackBox(GBlackBoxModel *bbmodel);
                void editDiagramParameters(wxVtkSceneManager* scene);
                void deleteAllBoxes();
+               void centerView();
+
+       //=========================================================================
                
        private:
 
index 6f6b9e94458a9883dd73f216d58653ebf5e2b2a2..e6c91c19c98fe66b222517e0755da3be5189e2e8 100644 (file)
@@ -124,6 +124,13 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxTabPanelsManager::centerViewActualDiagram()
+       {
+               _actual->centerView();
+       }
+
+       //=========================================================================
+
 }  // EO namespace bbtk
 
 // EOF
index b41f027d32c0a0b45749fe9125a064125828c383..05b8b7c3c797845d76a233522c96993c97c1206b 100644 (file)
@@ -78,6 +78,7 @@ namespace bbtk
                void editBlackBox(GBlackBoxModel *bbmodel);
                void editDiagramParameters(wxVtkSceneManager* scene);
                void deleteAllBoxesActualDiagram();
+               void centerViewActualDiagram();
 
        private: