From: corredor <> Date: Thu, 1 Apr 2010 13:55:14 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v1_0_0~113 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cef73d418644dcb545c7731df11c54146fe82174;p=bbtkGEditor.git *** empty log message *** --- diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h index 889cb75..1145843 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GObjectModel.h @@ -58,7 +58,7 @@ Version: $Revision$ namespace bbtk { - class GObjectModel //: public Observable + class GObjectModel : public Observable { public: diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.cxx index 819f341..a8de6d8 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/Observable.cxx @@ -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 diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx index 73dcda3..f238a73 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx @@ -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 descriptorMap = descriptor->GetInputDescriptorMap(); - std::map::iterator it; + std::map descriptorInMap = descriptor->GetInputDescriptorMap(); + std::map::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 descriptorOutMap = descriptor->GetOutputDescriptorMap(); + std::map::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); } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h index a550948..d272f60 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h @@ -53,6 +53,7 @@ Version: $Revision$ //Includes creaMaracasVisu #include #include +#include //Includes vtk #include @@ -90,6 +91,8 @@ namespace bbtk int _id; wxVtk3DBaseView *_baseView; + std::vector objects; + std::vector selectedObjects; void refreshRenderWindow(); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx index c4b0837..8fc721c 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx @@ -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); diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h index d10991e..1397ef4 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.h @@ -65,7 +65,7 @@ Version: $Revision$ namespace bbtk { - class vtkGObjectView //: public Observer + class vtkGObjectView : public Observer { public: diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx index 51881b2..d02ecc1 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGPortView.cxx @@ -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 ----------"<SetPoint(0, xInic, yInic, 0 ); _pts->SetPoint(1, xInic, yFin, 0 ); diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index 4e61236..0f87071 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -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 '"< #include #include +#include //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);