]> Creatis software - bbtkGEditor.git/commitdiff
*** empty log message ***
authorcorredor <>
Thu, 1 Apr 2010 13:55:14 +0000 (13:55 +0000)
committercorredor <>
Thu, 1 Apr 2010 13:55:14 +0000 (13:55 +0000)
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h

index 889cb7580a544f6e19e24f2972bb8cfe77170503..1145843392254225e8ce7e75db96b086f076d852 100644 (file)
@@ -58,7 +58,7 @@ Version:   $Revision$
 namespace bbtk
 {
 
-       class GObjectModel //: public Observable
+       class GObjectModel : public Observable
        {
 
        public: 
index 819f3410c324a1a36020a0f0236385944bc46978..a8de6d834f5ea724976a19cdd2b214acedca821a 100644 (file)
@@ -61,12 +61,16 @@ namespace bbtk
        
        void Observable::notifyObservers()
        {
-               int i;
-               for(i=0;i<_observers.size();i++)
+               if(_changed)
                {
-                       _observers[i]->update();
-               }               
-               _changed=false;
+                       int i;
+                       
+                       for(i=0;i<_observers.size();i++)
+                       {
+                               _observers[i]->update();
+                       }
+                       _changed=false;
+               }
        }
 
     //=========================================================================                
@@ -78,6 +82,11 @@ namespace bbtk
 
        //=========================================================================
 
+       void Observable::addObserver(Observer *observer)
+       {
+               _observers.push_back(observer);
+       }
+
 }  // EO namespace bbtk
 
 // EOF
index 73dcda3d84d0856026e6eda7b2dce6c55391ee62..f238a734a9c25eb2e12e679edbbce0a900047804 100644 (file)
@@ -53,7 +53,7 @@ namespace bbtk
 
                        configureBaseView();
 
-                       /* JUST TO TEST
+                       /*//JUST TO TEST
                        vtkConeSource *cone = vtkConeSource::New();
        
                   cone->SetResolution(10);
@@ -96,8 +96,8 @@ namespace bbtk
 
                        getRenderer()->AddActor(_pointVtkActor);
 
-                       */
-
+                       
+*/
                        /////////////////////
 
                   //getRenderer()->AddActor(act);
@@ -121,8 +121,15 @@ namespace bbtk
 
        void wxVtkSceneManager::configureBaseView()
        {
-               vtkInteractorStyleImage *style = vtkInteractorStyleImage::New();
-               _baseView->GetWxVTKRenderWindowInteractor()->SetInteractorStyle(style);
+               vtkInteractorStyleBaseView2D *interactorstylebaseview = vtkInteractorStyleBaseView2D::New();
+
+               _baseView->SetInteractorStyleBaseView(interactorstylebaseview);
+
+               wxVTKRenderWindowInteractor *iren = _baseView->GetWxVTKRenderWindowInteractor();
+               interactorstylebaseview->SetInteractor ( iren );
+               iren->SetInteractorStyle(interactorstylebaseview);
+               interactorstylebaseview->SetwxVtkBaseView(_baseView);
+
                //_baseView->GetRenderer()->SetActiveCamera(_baseView->GetCamera());
            //_baseView->GetRenderer()->ResetCamera ();
                //_baseView->GetCamera()->SetParallelProjection(true);
@@ -151,18 +158,18 @@ namespace bbtk
                double zz = 0;
                _baseView->TransCoordScreenToWorld(xx,yy,zz);
                model->setInicPoint(xx,yy,zz);
-               //model->addObserver(view);
+               model->addObserver(view);
 
                //Iterate and create the input ports
-               std::map<std::string, BlackBoxInputDescriptor*> descriptorMap = descriptor->GetInputDescriptorMap();
-               std::map<std::string, BlackBoxInputDescriptor*>::iterator it;
+               std::map<std::string, BlackBoxInputDescriptor*> descriptorInMap = descriptor->GetInputDescriptorMap();
+               std::map<std::string, BlackBoxInputDescriptor*>::iterator itInput;
 
                //ERASE
                cantTemp=0;
 
-               for(it = descriptorMap.begin(); it != descriptorMap.end(); ++it)
+               for(itInput = descriptorInMap.begin(); itInput != descriptorInMap.end(); ++itInput)
                {
-                       BlackBoxInputDescriptor *desc = it->second;
+                       BlackBoxInputDescriptor *desc = itInput->second;
                        createGInputPort(desc,model);
                        
                        //ERASE
@@ -170,6 +177,23 @@ namespace bbtk
                }
 
 
+               //Iterate and create the output ports
+               std::map<std::string, BlackBoxOutputDescriptor*> descriptorOutMap = descriptor->GetOutputDescriptorMap();
+               std::map<std::string, BlackBoxOutputDescriptor*>::iterator itOutput;
+
+               //ERASE
+               cantTemp=0;
+
+               for(itOutput = descriptorOutMap.begin();itOutput != descriptorOutMap.end(); ++itOutput)
+               {
+                       BlackBoxOutputDescriptor *desc = itOutput->second;
+                       createGOutputPort(desc,model);
+                       
+                       //ERASE
+                       cantTemp+=2;
+               }
+
+
                //Associates the view with the correspondent renderer and the  model.
                //(NOTE: Refresh is only made by the view)
                view->setModel(model);
@@ -182,13 +206,17 @@ namespace bbtk
                //Refresh renderwindow with new objects
                refreshRenderWindow();
                
+               //Register the controller of the new object
                registerController((InteractorStyleMaracas*) controller);
 
+               //Add the object to the objects list (only boxes and connectors)
+               objects.push_back(model);
+
        }
 
        //=========================================================================
 
-       void wxVtkSceneManager::createGInputPort(BlackBoxInputDescriptor *desc,GBlackBoxModel *blackBox)
+       void wxVtkSceneManager::createGOutputPort(BlackBoxOutputDescriptor *desc,GBlackBoxModel *blackBox)
        {
                int type = GPORT;
 
@@ -198,8 +226,7 @@ namespace bbtk
                GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type);
 
                model->registerInBox(blackBox);
-               blackBox->addInputPort(model);
-
+               blackBox->addOutputPort(model);
                
                //Prepares the initial model
                double xx = 0;
@@ -219,11 +246,14 @@ namespace bbtk
                
                //Associates the controller with the correspondent model and view
                controller->setModelAndView(model,view);
+
+               //Register the controller of the new object
+               registerController((InteractorStyleMaracas*) controller);
        }
 
        //=========================================================================
 
-       void wxVtkSceneManager::createGOutputPort(BlackBoxOutputDescriptor *desc,GBlackBoxModel *blackBox)
+       void wxVtkSceneManager::createGInputPort(BlackBoxInputDescriptor *desc,GBlackBoxModel *blackBox)
        {
                int type = GPORT;
 
@@ -233,7 +263,30 @@ namespace bbtk
                GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type);
 
                model->registerInBox(blackBox);
-               blackBox->addOutputPort(model);
+               blackBox->addInputPort(model);
+
+               
+               //Prepares the initial model
+               double xx = 0;
+               double yy = 0;
+               double zz = 0;
+               blackBox->getInicPoint(xx,yy,zz);
+
+               xx--;
+               yy+=cantTemp;
+               model->setInicPoint(xx,yy,zz);
+
+               //Associates the view with the correspondent renderer and the  model.
+               //(NOTE: Refresh is only made by the view)
+               view->setModel(model);
+               view->setBaseView(_baseView);
+               view->initVtkObjects();
+               
+               //Associates the controller with the correspondent model and view
+               controller->setModelAndView(model,view);
+
+               //Register the controller of the new object
+               registerController((InteractorStyleMaracas*) controller);
        }
 
        //=========================================================================
index a55094814592a9ee0b26cc69054310a4f4dd62c2..d272f60ac5e2a37ee22782eb2fd78c5f0b0efc86 100644 (file)
@@ -53,6 +53,7 @@ Version:   $Revision$
 //Includes creaMaracasVisu
 #include <wxVtk3DBaseView.h>
 #include <InteractorStyleMaracas.h>
+#include <vtkInteractorStyleBaseView2D.h>
 
 //Includes vtk
 #include <vtkRenderWindow.h>
@@ -90,6 +91,8 @@ namespace bbtk
 
                int _id;
                wxVtk3DBaseView *_baseView;
+               std::vector<GObjectModel*> objects;
+               std::vector<GObjectModel*> selectedObjects;
 
                void refreshRenderWindow();
 
index c4b0837ee52477062db225e0bfc1bba5e2f66a2c..8fc721c2b78c87082e5ac8b529349562a2e58a4e 100644 (file)
@@ -66,7 +66,7 @@ bool GObjectController::OnMouseMove()
        {
                int X,Y;
                wxVTKRenderWindowInteractor *_wxVTKiren;
-               _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+               _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
                _wxVTKiren->GetEventPosition( X , Y );
 
                int state  = _model->getState();
@@ -110,7 +110,7 @@ bool GObjectController::OnLeftButtonDown()
        {
                int X,Y;
                wxVTKRenderWindowInteractor *wxVTKiren;
-               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
                wxVTKiren->GetEventPosition(X,Y);
 
                //MouseClickLeft(X,Y);
index d10991ee60ee5e19a4f1e494f41655adb4090050..1397ef4661048cceae023e9f10c91ba9475b8869 100644 (file)
@@ -65,7 +65,7 @@ Version:   $Revision$
 namespace bbtk
 {
 
-       class vtkGObjectView //: public Observer
+       class vtkGObjectView : public Observer
        {
 
        public: 
index 51881b2315d5d025279456ed162bc73f7481b77c..d02ecc1dca947cb963bf9ca46ff3765c1cd7ac66 100644 (file)
@@ -80,9 +80,6 @@ namespace bbtk
                double xInic, yInic,zInic,xFin, yFin,zFin;
                _model->getInicPoint(xInic,yInic,zInic);
                _model->getFinalPoint(xFin, yFin,zFin);
-               cout<<"RaC ----------"<<endl;
-               cout<<"RaC vtkGPortView::createVtkObjects() inic:"<<xInic<<" "<<yInic<<" "<<zInic<<endl;
-               cout<<"RaC vtkGPortView::createVtkObjects() fin:"<<xFin<<" "<<yFin<<" "<<zFin<<endl;
 
                _pts->SetPoint(0, xInic, yInic, 0 );
                _pts->SetPoint(1, xInic, yFin, 0 );
index 4e612365ae983ab06dc6b4a4ace51e4de8c2bc27..0f87071f6fdadb24053f960ae8a0102ab488d2b9 100644 (file)
@@ -101,7 +101,8 @@ namespace bbtk
        //=========================================================================
        void wxGUIEditorGraphicBBS::initHelpHTMLBrowser()
        {
-               
+               //TO FIX THE PATH OF BBTK BIN  IN ORDER TO USE REGENERATE EXECUTABLES
+               //RegenerateAll();
                _helpHtmlBrowser = new WxGUIHtmlBrowser(this,wxSize(200,0));
                _frameAUIMgr->AddPane(_helpHtmlBrowser,wxAuiPaneInfo().Right().MinSize(200,200));       
        }
@@ -145,6 +146,104 @@ namespace bbtk
                _frameAUIMgr->AddPane(_pkgBrowser,wxAuiPaneInfo().Left().MinSize(200,200).CloseButton(false));          
        }
 
+       //================================================================
+
+       void wxGUIEditorGraphicBBS::DoRegeneratePackageDoc( const std::string& pack )
+       {
+               std::string mess("Regenerating doc for package '");
+               if (pack!="-a"){
+                       mess += pack + "'";
+               }
+               else
+               {
+                       mess = "Regenerating doc for all packages";
+               }
+               
+               mess += " ... please wait";             
+
+               SetStatusText( std2wx(mess) );
+
+               //BBTK_BUSY_CURSOR;
+
+               std::string command;
+               #if defined(WIN32)
+                       command = "\"";
+               #endif
+                       command += ConfigurationFile::GetInstance().Get_bin_path();
+                       command += ConfigurationFile::GetInstance().Get_file_separator();
+                       command += "bbRegeneratePackageDoc";
+               #if defined(WIN32)
+                       command += "\"";
+               #endif
+
+               command += " " + pack + " -q";
+           bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
+
+               if ( ! system ( command.c_str() ) )
+               {
+                       SetStatusText( _T("Done !"));
+                       /*
+                       wxMessageBox(_T("Done !"),_T("Regenerate package '")
+                                        +std2wx(pack)+_T("' doc"),
+                                        wxOK | wxICON_INFORMATION);
+                       */
+               }
+               else 
+               {
+                       SetStatusText( _T("Done !"));
+                       wxString err(_T("An error occured while running '"));
+                       err +=  bbtk::std2wx(command) + _T("'");
+                       wxMessageBox(err,_T("Regenerate package doc"),wxOK | wxICON_ERROR);      
+           }
+       }
+
+       //================================================================
+       void wxGUIEditorGraphicBBS::DoRegenerateBoxesLists()
+       {
+               SetStatusText( _T("Regenerating boxes lists ... please wait") );
+               //BBTK_BUSY_CURSOR ;
+
+               std::string command;
+               #if defined(WIN32)
+                       command = "\"";
+               #endif
+                       command += ConfigurationFile::GetInstance().Get_bin_path();
+                       command += ConfigurationFile::GetInstance().Get_file_separator();
+                       command += "bbRegenerateBoxesLists";
+
+               #if defined(WIN32)
+                       command += "\"";
+               #endif
+                       command += " -q";
+
+               bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
+
+               if ( ! system ( command.c_str() ) )
+               {
+                       SetStatusText( _T("Done !"));
+                       /*
+                       wxMessageBox(_T("Done !"),_T("Regenerate boxes lists"),
+                                        wxOK | wxICON_INFORMATION);
+                       */
+               }
+               else 
+               {
+                       SetStatusText( _T("Done !"));
+                       wxString err(_T("An error occured while running '"));
+                       err +=  bbtk::std2wx(command) + _T("'");
+                       wxMessageBox(err,_T("Regenerate boxes lists"),wxOK | wxICON_ERROR);      
+               }
+       }
+       
+  //================================================================
+       void wxGUIEditorGraphicBBS::RegenerateAll()
+       {
+               DoRegeneratePackageDoc("-a");   
+               DoRegenerateBoxesLists();
+       }
+
+  //================================================================
+
        /*****************************************************
        /* HANDLERS 
        /*****************************************************/
index 3f498f27d92bc0abf9c8c1ce0f40d793bebc06fe..4a62c668e328e8034f8d91224f07bac180ec82e3 100644 (file)
@@ -53,6 +53,7 @@
 #include <bbtkWxGUIPackageBrowser2.h>
 #include <bbtkWxGUIHtmlBrowser.h>
 #include <bbtkBlackBoxDescriptor.h>
+#include <bbtkConfigurationFile.h>
 
 //Includes vtk
 
@@ -83,6 +84,10 @@ namespace bbtk
                void initPackageBrowser();
                void initHelpHTMLBrowser();
 
+               void RegenerateAll();
+               void DoRegeneratePackageDoc(const std::string& pack);   
+               void DoRegenerateBoxesLists();
+
                void OnToolLeftClick(wxCommandEvent& event);
                void OnExit(wxCommandEvent& event);