]> Creatis software - bbtkGEditor.git/commitdiff
no message
authordavila <>
Wed, 29 Sep 2010 21:18:28 +0000 (21:18 +0000)
committerdavila <>
Wed, 29 Sep 2010 21:18:28 +0000 (21:18 +0000)
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx

index 36fd7763ca985f5d65d5f6b642b6d17ed6f3b4e0..f03d48da4c790b5d830ba5ab3cabc43b4cdff645 100644 (file)
@@ -172,6 +172,8 @@ namespace bbtk
        const int ID_SAVE_AS_BBS                                =       1010;
        const int ID_SAVE_AS_COMPLEXBOX                 =       1011;
        const int ID_COPY_TO_COMPLEXDIAGRAM             =       1012;
+       const int ID_BTNBOX                                             =       1013;
+       
 
        const int wxID_NOTEBOOK                                 =       1013;
 }
index adb3bf021c59e1bf5222f4203e19edd27c7e7e2e..bd3b65237c0d544c340da634ef8803912a2e6f96 100644 (file)
@@ -114,7 +114,6 @@ namespace bbtk
                wxVTKiren->GetEventPosition(X,Y);
 
                int state  = _view->getState();
-                       
                //Evaluate new state
                if(_isLeftClickDown)
                {
@@ -126,7 +125,7 @@ namespace bbtk
                                _model->notifyObservers(getId());
                        }
                }
-               return true;
+       return true;
                
        }
        
index 56a6a9bb439e9f85f411682d138575b701fa9dff..c90562674f26061179807e75be2b6fc2fca652ee 100644 (file)
@@ -64,6 +64,8 @@ namespace bbtk
                _xGeneral               = -100;
                _yGeneral               = 100;
                _zGeneral               = 900;   //  ?????
+printf("EED  InterpreterBBS::createGBlackBox 900-450\n");
+
                _countBoxes             = 0;
                _countInputs    = 0;
                _countOutputs   = 0;
index f5027edffc143c987cdaec8fc42480bb09f3fe8e..c9c63b355f3f8165dbddeb0211a16bcba50d15ca 100644 (file)
@@ -104,6 +104,7 @@ namespace bbtk
                wxBitmap bmp_run(run_xpm);
                wxBitmap bmp_delete(delete_xpm);
                wxBitmap bmp_centerview(centerview_xpm);
+               wxBitmap bmp_box(box_xpm);
                wxBitmap bmp_complexbox(complexbox_xpm);
                wxBitmap bmp_complexinputport(complexinputport_xpm);
                wxBitmap bmp_complexoutputport(complexoutputport_xpm);
@@ -118,6 +119,8 @@ namespace bbtk
                toolbar->AddTool(ID_DELETEALL,_T("Delete all"),bmp_delete, wxNullBitmap, wxITEM_NORMAL,_T("Delete all boxes"), _T("Delete all boxes"));
                toolbar->AddTool(ID_CENTERVIEW,_T("Center view"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Center view"), _T("Center view"));
                toolbar->AddSeparator();
+               toolbar->AddTool(ID_BTNBOX,_T("New Box"),bmp_box, wxNullBitmap, wxITEM_NORMAL,_T("New Box"), _T("Nex Box"));
+               toolbar->AddSeparator();
                toolbar->AddTool(ID_BTNCOMPLEXBOX,_T("Complex box"),complexbox_xpm, wxNullBitmap, wxITEM_NORMAL,_T("Complex box"), _T("Complex box"));
                toolbar->SetToggle(ID_BTNCOMPLEXBOX,true);
                toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT,_T("Add input to Complex box"),bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,_T("Add input to Complex box"), _T("Add input to Complex box"));
@@ -136,6 +139,7 @@ namespace bbtk
                Connect(ID_RUN,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
                Connect(ID_DELETEALL,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
                Connect(ID_CENTERVIEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
+               Connect(ID_BTNBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnBox));
                Connect(ID_BTNCOMPLEXBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnComplexBox));
                Connect(ID_ADDCOMPLEXBOXINPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxInput));
                Connect(ID_ADDCOMPLEXBOXOUTPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxOutput));
@@ -419,13 +423,10 @@ namespace bbtk
                if (openFileDialog->ShowModal() == wxID_OK)
                {
                        wxString fileName = openFileDialog->GetPath(  );
-printf("EED wxGUIEditorGraphicBBS::OnOpenBBS  file=%s\n", (const char*) (fileName.mb_str()) );
                        
                        
                        _tabsMgr->addNewTab();
 
-                       
-//                     bbtk::EExecuterBBSG::Pointer exe = bbtk::EExecuterBBSG::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory() );
                        bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory());                       
                        
                        // We tell the interpreter to throw exceptions on error
@@ -612,7 +613,24 @@ printf("EED wxGUIEditorGraphicBBS::OnOpenBBS  file=%s\n", (const char*) (fileNam
        }
 
        //=========================================================================
+       
+       
+       void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event)
+       {
+               BlackBoxDescriptor      *bbDes          = _pkgBrowser->GetActualSelected();
+               std::string                     typeName        = bbDes->GetTypeName();
+               std::string                     packageName = bbDes->GetPackage()->GetName();
 
+               this->_tabsMgr->getActualTabPanel()->getSceneManager()->createGBlackBox(50,50,packageName, typeName);
+               
+               
+               printf("EED  wxGUIEditorGraphicBBS::OnClickBtnBox \n");
+               refreshGUIControls();           
+       }
+       
+       //=========================================================================
+
+       
        void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event)
        {
                wxToolBar* toolbar = GetToolBar();
index 48bce9b33edf2d7b83a31c3f9603657eba416ce7..887b7c6f98af67a6b58c2a0a8a5192667baf2649 100644 (file)
@@ -56,6 +56,7 @@
 #include "wxart_run.xpm"
 #include "wxart_delete.xpm"
 #include "wxart_centerview.xpm"
+#include "wxart_box.xpm"
 #include "wxart_complexbox.xpm"
 #include "wxart_complexinputport.xpm"
 #include "wxart_complexoutputport.xpm"
@@ -137,6 +138,7 @@ namespace bbtk
                        void OnExecuteActualDiagram(wxCommandEvent& event);
                        void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
                        void OnCenterViewActualDiagram(wxCommandEvent& event);
+                       void OnClickBtnBox(wxCommandEvent& event);
                        void OnClickBtnComplexBox(wxCommandEvent& event);
                        void OnAddComplexBoxInput(wxCommandEvent& event);
                        void OnAddComplexBoxOutput(wxCommandEvent& event);
index 3cf0c06bda1f25a09f46b94f00fe530650aae13e..db678abd5d778bd192e3d512a524422b66737ff1 100644 (file)
@@ -74,7 +74,7 @@ namespace bbtk
                                
                std::vector<GPortModel*> lstInputs = _model->getInputPorts();
                wxFlexGridSizer *sizer = new wxFlexGridSizer(lstInputs.size(),3,5,5);             
-               for(int i = 0;i<lstInputs.size();i++)
+               for(int i = 0;i<(int)lstInputs.size();i++)
                {
                        GPortModel* port = lstInputs[i];
                        std::string type = port->getBBTKType();
index 5199260eaa18baf08b7ad38dd995f13c3b13597c..66c468a242fab2830160dfe9299a1c5ce43368b1 100644 (file)
@@ -102,10 +102,10 @@ namespace bbtk
                interactorstylebaseview->SetwxVtkBaseView(_baseView);
                
                _baseView->GetRenderer()->GetActiveCamera()->ParallelProjectionOn();
-               _baseView->GetRenderer()->ResetCamera(-100,100,-100,100,900,1000);
+               _baseView->GetRenderer()->ResetCamera(-100,100,-100,100,800,1100);
                
                _baseView->GetRenderer()->SetBackground(0.9,0.9,0.9);
-               _baseView->GetRenderer()->GradientBackgroundOff();
+               _baseView->GetRenderer()->GradientBackgroundOn();
                _baseView->Refresh();
                
                // Actos Port_Text 
@@ -174,6 +174,7 @@ namespace bbtk
                _aPolygonMapper->SetInput(aPolygonGrid);
                _fillObjectActor->SetMapper(_aPolygonMapper);
                _fillObjectActor->GetProperty()->SetColor(PORTFILL_NH_R,PORTFILL_NH_G,PORTFILL_NH_B);
+               _fillObjectActor->GetProperty()->SetOpacity(0);
                _aPolygonMapper->Modified();
 
                _baseView->GetRenderer()->AddActor( _fillObjectActor );         
@@ -249,7 +250,7 @@ namespace bbtk
                
                //z value is not important yet, because it is only used a parallel projection
                double zz = 900;
-
+printf("EED  wxVtkSceneManager::createGBlackBox 900-450\n");
                _baseView->TransCoordScreenToWorld(xx,yy,zz);
                model->setInicPoint(xx,yy,zz);
                
@@ -335,6 +336,7 @@ namespace bbtk
                
                //z value is not important yet, because it is only used a parallel projection
                double zz                                               = 900;
+printf("EED  wxVtkSceneManager::createGComplexBoxInputPort 900-450\n");
 
                _baseView->TransCoordScreenToWorld(xx,yy,zz);
                model->setInicPoint(xx,yy,zz);
@@ -377,9 +379,9 @@ namespace bbtk
 
                //Create the MVC Objects
                
-               GComplexBoxPortModel *model             = (GComplexBoxPortModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
-               vtkGObjectView *view                    = GObjectsMVCFactory::getInstance()->createGObjectView(type);
-               GObjectController* controller   = GObjectsMVCFactory::getInstance()->createGObjectController(type);
+               GComplexBoxPortModel    *model          = (GComplexBoxPortModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
+               vtkGObjectView                  *view           = GObjectsMVCFactory::getInstance()->createGObjectView(type);
+               GObjectController               *controller     = GObjectsMVCFactory::getInstance()->createGObjectController(type);
                                
                //Prepares the initial model 
 
@@ -388,6 +390,8 @@ namespace bbtk
                
                //z value is not important yet, because it is only used a parallel projection
                double zz                                               = 900;
+               
+printf("EED  wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n");
 
                _baseView->TransCoordScreenToWorld(xx,yy,zz);
                model->setInicPoint(xx,yy,zz);
@@ -790,9 +794,9 @@ namespace bbtk
                                        if(portmod->getPortType()==GINPUTPORT && portView->getState()==HIGHLIGHTED)
                                        {
                                                isOverPort=true;
-                                       }
-                               }
-                       }
+                                       } // if
+                               } // if
+                       } // for 
                        
                        if(isOverPort==false)
                        {
@@ -809,14 +813,14 @@ namespace bbtk
                                        desc->SetActive(true);
                                        desc->getView()->setState(NOTHING_HAPPENS);
                                        desc->getModel()->notifyObservers(_idManager);
-                               }
-                       }
-               }
+                               } // for 
+                       } // isOverPort
+               } // _worldState
                
                if(_selectedObjects.size()!=0)
                {
-                       _worldState = DRAG_OBJECTS;
-                       _startDragging = true;
+                       _worldState             = DRAG_OBJECTS;
+                       _startDragging  = true;
 
                        for (int i = 0; i < (int)_selectedObjects.size(); i++)
                        {
@@ -824,8 +828,8 @@ namespace bbtk
                                GObjectController* cont = _controllers[id];
                                cont->getView()->setState(DRAG);
                                cont->getModel()->notifyObservers(_idManager);
-                       }
-               }
+                       } // for
+               } // _selectedObjects
                
                
                
@@ -1624,13 +1628,6 @@ namespace bbtk
 
                                        configGComBoxInputOutputPort(true, inputPortName,xIn,yIn,zIn);
 
-//ups3 EED Borrame
-//                                     int idInputPort = createGComplexBoxInputPort(inputPortName);
-//                                     GObjectController *cont = _controllers[idInputPort];
-//                                     GBoxModel *cbmod = (GBoxModel*)cont->getModel();
-//                                     cbmod->setInicPoint(xIn,yIn,zIn);
-//                                     cbmod->notifyObservers(_idManager);
-
                                        
                                } // for input complex box
 
@@ -1678,14 +1675,7 @@ namespace bbtk
                                        getline(inputStream,line);//FIN_COMPLEX_PORT
 
                                        configGComBoxInputOutputPort(false, outputPortName,xIn,yIn,zIn);
-                                       
-//ups 3 EED Borrame
-//                                     int idOutputPort = createGComplexBoxOutputPort(outputPortName);
-//                                     GObjectController *cont = _controllers[idOutputPort];
-//                                     GBoxModel *cbmod = (GBoxModel*)cont->getModel();
-//                                     cbmod->setInicPoint(xIn,yIn,zIn);
-//                                     cbmod->notifyObservers(_idManager);
-                                       
+
                                } // for output complex box
 
                        } // complex box
@@ -1770,17 +1760,8 @@ namespace bbtk
                                
                                GObjectController *cont = _controllers[idBox];
                                GBlackBoxModel *bbmod   = (GBlackBoxModel*)cont->getModel();
+
                                
-                               
-//ups2 eed                             
-//                             GObjectController *cont = _controllers[idBox];
-//                             GBlackBoxModel *bbmod   = (GBlackBoxModel*)cont->getModel();
-//                             bbmod->setBBTKName(name);
-//                             bbmod->setInicPoint(xIn,yIn,zIn);
-//                             bbmod->setFinalPoint(xEn,yEn,zEn);
-//                             bbmod->setExecutable(boxExecutable);
-
-                                                       
                                //----------
                                getline(inputStream,line);//PORT o FIN_BOX
                                std::string port=line.substr(0,4);
@@ -1833,67 +1814,6 @@ namespace bbtk
                                std::string nameEndPort(result);
 
                                configGConnetion(nameStartBox, nameStartPort, nameEndBox, nameEndPort);
-//ups 3 EED Borrame
-/*                             
-                               std::vector<int> lstB   = getBlackBoxes();                              
-                               GPortModel *startP              = NULL;
-                               GPortModel *endP                = NULL;
-                               int j;
-                               for(j = 0;j<lstB.size();j++)
-                               {
-                                       int idB = lstB[j];
-                                       GBlackBoxModel *bbMod = (GBlackBoxModel*)_controllers[idB]->getModel();
-                                       if(_controllers[idB]->getModel()->getBBTKName()==nameStartBox)
-                                       {                                               
-                                               startP = bbMod->getOutputPort(nameStartPort);
-                                       }
-                                       else if(_controllers[idB]->getModel()->getBBTKName()==nameEndBox)
-                                       {
-                                               endP = bbMod->getInputPort(nameEndPort);
-                                       }
-                               } // for
-
-                               if(_isComplexBox)
-                               {
-                                       if(startP==NULL)
-                                       {
-                                               std::vector<int> lstInputs = getComplexInputPorts();
-                                               for(j = 0;j<lstInputs.size();j++)
-                                               {
-                                                       int idB = lstInputs[j];
-                                                       GBoxModel *cbMod = (GBoxModel*)_controllers[idB]->getModel();
-                                                       if(_controllers[idB]->getModel()->getBBTKName()==nameStartBox)
-                                                       {                                               
-                                                               startP = cbMod->getOutputPort(nameStartPort);
-                                                       } // if 
-                                               } // for
-                                       } // if 
-
-                                       if(endP==NULL)
-                                       {
-                                               std::vector<int> lstOutputs = getComplexOutputPorts();
-                                               for(j = 0;j<lstOutputs.size();j++)
-                                               {
-                                                       int idB = lstOutputs[j];
-                                                       GBoxModel *cbMod = (GBoxModel*)_controllers[idB]->getModel();
-                                                       if(_controllers[idB]->getModel()->getBBTKName()==nameEndBox)
-                                                       {                                               
-                                                               endP = cbMod->getInputPort(nameEndPort);
-                                                       } // if
-                                               } // for
-                                       } // if endP
-                               } // complex box
-                                                               
-                               int idCon = createGConnector(startP);
-                               _worldState = NOTHING_HAPPENS;
-                               GConnectorController *tempp = (GConnectorController*)_controllers[idCon]; 
-
-                               GConnectorModel *conMod = (GConnectorModel*)tempp->getModel();
-                               vtkGConnectorView *conView = (vtkGConnectorView*)tempp->getView();
-                               tempp->endContourCreation();
-                               conMod->setEndPort(endP);                                       
-                               conView->updateStartEndPoints();
- */
                        } // for numConns
                        
         } // start
@@ -1995,54 +1915,6 @@ namespace bbtk
                
                printf("EED wxVtkSceneManager::configGConnetion 2 %p %p \n", startP, endP );
 
-/*ups5 EED Borrame
-               std::vector<int> lstB   = getBlackBoxes();                              
-               int j;
-               for(j = 0;j<(int)lstB.size();j++)
-               {
-                       int idB = lstB[j];
-                       GBlackBoxModel *bbMod = (GBlackBoxModel*)_controllers[idB]->getModel();
-                       if(_controllers[idB]->getModel()->getBBTKName()==nameStartBox)
-                       {                                               
-                               startP = bbMod->getOutputPort(nameStartPort);
-                       }
-                       else if(_controllers[idB]->getModel()->getBBTKName()==nameEndBox)
-                       {
-                               endP = bbMod->getInputPort(nameEndPort);
-                       }
-               } // for
-               if(_isComplexBox)
-               {
-                       if(startP==NULL)
-                       {
-                               std::vector<int> lstInputs = getComplexInputPorts();
-                               for(j = 0;j<(int)lstInputs.size();j++)
-                               {
-                                       int idB                         = lstInputs[j];
-                                       GBoxModel *cbMod        = (GBoxModel*)_controllers[idB]->getModel();
-                                       if(_controllers[idB]->getModel()->getBBTKName()==nameStartBox)
-                                       {                                               
-                                               startP = cbMod->getOutputPort(nameStartPort);
-                                       } // if 
-                               } // for
-                       } // if 
-                       
-                       if(endP==NULL)
-                       {
-                               std::vector<int> lstOutputs = getComplexOutputPorts();
-                               for(j = 0;j<(int)lstOutputs.size();j++)
-                               {
-                                       int idB = lstOutputs[j];
-                                       GBoxModel *cbMod = (GBoxModel*)_controllers[idB]->getModel();
-                                       if(_controllers[idB]->getModel()->getBBTKName()==nameEndBox)
-                                       {                                               
-                                               endP = cbMod->getInputPort(nameEndPort);
-                                       } // if
-                               } // for
-                       } // if endP
-               } // complex box
- */            
                
                int idCon                                       = createGConnector(startP);
                _worldState                                     = NOTHING_HAPPENS;