From 8d5cce101d80ada2ddc1db310c59574c7b3b5a06 Mon Sep 17 00:00:00 2001 From: davila <> Date: Sun, 3 Jun 2012 13:15:37 +0000 Subject: [PATCH] v1.1.0 BUG 1394 and 1401 - Erase control points of the spline (connection) - Duplicate selected boxes in MACOS ctrl-d --- .../wxVtkSceneManager.cxx | 82 +++++++++++-------- .../bbsWxGUIEditorGraphic/wxVtkSceneManager.h | 7 +- 2 files changed, 53 insertions(+), 36 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 7d9da52..7a3498b 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -1056,38 +1056,47 @@ bool wxVtkSceneManager::OnLeftDClick() { //========================================================================= -bool wxVtkSceneManager::OnChar() { - char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode(); - int ctrlkey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey(); +bool wxVtkSceneManager::OnChar() +{ + bool ok=false; + char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode(); + int ctrlkey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey(); // KeyCode 127 : Delete Key // KeyCode 8 : Backspace Key - if (keyCode == 8 || keyCode == 127) { - if (_selectedObjects.size() > 0) { - for (int i = 0; i < (int) _selectedObjects.size(); i++) { + if (keyCode == 8 || keyCode == 127) + { + for (int i = 0; i < (int) _selectedObjects.size(); i++) + { int id = _selectedObjects[i]; + printf("EED wxVtkSceneManager::OnChar %d %d\n", i, id); std::map::iterator it; it = _controllers.find(id); if (it != _controllers.end()) { - deleteObject(id); - } + ok=ok||deleteObject(id); + } // if + }// for selected objects + if (ok) _selectedObjects.clear(); + _parent->saveTempandUpdate("delete object"); + }// if keyCode + + /// Duplicate +#ifdef MACOSX + if((keyCode==0) && (ctrlkey==1)) { +#else + ctrlkey+=keyCode; + if(ctrlkey==5){ +#endif + if(_selectedObjects.size()){ + std::cout<<"objects to copy :"; + for(int i=0;i<_selectedObjects.size();i++){ + std::cout<<_selectedObjects.at(i)<<" "; } - _selectedObjects.clear(); - } - } - ctrlkey+=keyCode; - /// Duplicate - if(ctrlkey==5){ - if(_selectedObjects.size()){ - std::cout<<"objects to copy :"; - for(int i=0;i<_selectedObjects.size();i++){ - std::cout<<_selectedObjects.at(i)<<" "; - } - DuplicateObjects(getSelectedObjects()); - }else{ - std::cout<<"No objects to copy\n"; - } - } + DuplicateObjects(getSelectedObjects()); + }else{ + std::cout<<"No objects to copy\n"; + } // _selectedObjects.size + } // ctrlkey 5 return true; } @@ -1113,7 +1122,9 @@ void wxVtkSceneManager::AddControlerToBeRemove( //========================================================================= -void wxVtkSceneManager::deleteObject(int id) { +bool wxVtkSceneManager::deleteObject(int id) +{ + bool result=true; GObjectController *control = _controllers[id]; std::vector controllersToRemove; @@ -1127,8 +1138,7 @@ void wxVtkSceneManager::deleteObject(int id) { // Add box input controllers to be removed for (int i = 0; i < (int) inputs.size(); i++) { - AddControlerToBeRemove(&controllersToRemove, - inputs[i]->getObjectId()); + AddControlerToBeRemove(&controllersToRemove, inputs[i]->getObjectId()); if (inputs[i]->isConnected()) { boxConnected = true; } @@ -1138,8 +1148,7 @@ void wxVtkSceneManager::deleteObject(int id) { // Add box output controllers to be removed for (int i = 0; i < (int) outputs.size(); i++) { - AddControlerToBeRemove(&controllersToRemove, - outputs[i]->getObjectId()); + AddControlerToBeRemove(&controllersToRemove, outputs[i]->getObjectId()); if (outputs[i]->isConnected()) { boxConnected = true; } @@ -1166,8 +1175,15 @@ void wxVtkSceneManager::deleteObject(int id) { // Add box controller to be removed AddControlerToBeRemove(&controllersToRemove, bbmod->getObjectId()); } else if (control->getGObjectType() == GCONNECTOR) { - GConnectorModel *conMod = (GConnectorModel*) control->getModel(); - AddControlerToBeRemove(&controllersToRemove, conMod->getObjectId()); + GConnectorController *gconnectorcontroler = (GConnectorController*)control; + if (gconnectorcontroler->getManualContourController()->IsEditable()==false) + { + GConnectorModel *conMod = (GConnectorModel*) control->getModel(); + AddControlerToBeRemove(&controllersToRemove, conMod->getObjectId()); + } else{ + gconnectorcontroler->getManualContourController()->OnChar(); + result = false; + } } std::map::iterator it; @@ -1182,7 +1198,9 @@ void wxVtkSceneManager::deleteObject(int id) { _controllers.erase(it); }//if }// for - _parent->saveTempandUpdate("delete object"); + + + return result; } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h index 3cf5639..be332f7 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h @@ -122,15 +122,14 @@ namespace bbtk int createGConnector(GPortModel* startPort); void configGBlackBox(int idBox, double xIn, double yIn, double zIn, std::string name, bool boxExecutable,double xEn,double yEn,double zEn); - int configGConnetion( std::string nameStartBox, std::string nameStartPort, std::string - nameEndBox, std::string nameEndPort); + int configGConnetion( std::string nameStartBox, std::string nameStartPort, std::string nameEndBox, std::string nameEndPort); void configGComBoxInputOutputPort(bool inputoutput, std::string inputPortName, double xIn, double yIn,double zIn); GBoxModel* findGBox(std::string boxname); vtkRenderWindow* getRenderWindow(); - vtkRenderer* getRenderer(); + vtkRenderer* getRenderer(); virtual void update(int idController,int command); @@ -177,7 +176,7 @@ namespace bbtk std::string saveComplexBoxBBS(); //Delete the object in the list of controllers with the id given by parameter. - void deleteObject(int id); + bool deleteObject(int id); void AddControlerToBeRemove(std::vector *controllersToRemove, int id); -- 2.45.0