X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FwxVtkSceneManager.cxx;h=de910b70ab1f210a3802ba6c2da7d59cdccd81f2;hb=92a55a7bc8ace3f27e6ebdaf56fb47938c97cced;hp=6c8acf0eae3dcbfb045f94839df4cdaa88e42c09;hpb=30ec99c0060a1f69fe302da398730d7ceaae6be2;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 6c8acf0..de910b7 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -755,7 +755,8 @@ void wxVtkSceneManager::update(int idController, int command) { //========================================================================= -bool wxVtkSceneManager::OnMouseMove() { +bool wxVtkSceneManager::OnMouseMove() +{ int X, Y; bool okStatusMessage = false; bool okPortMessage = false; @@ -797,16 +798,18 @@ bool wxVtkSceneManager::OnMouseMove() { desc->getModel()->getCenter(px, py, pz); // JGRR & CM - if ((state == HIGHLIGHTED) || (state == SELECTED_POSSIBLE_CONNECTION )) { + if ((state == HIGHLIGHTED) || (state == SELECTED_POSSIBLE_CONNECTION )) + { // EO JGRR & CM okStatusMessage = true; updateStatusBar(desc->getStatusText()); - if (type == GBLACKBOX) { + if (type == GBLACKBOX) + { GBlackBoxModel *mod = (GBlackBoxModel*) desc->getModel(); - _parent->displayBlackBoxInfo(mod->getBBTKPackage(), - mod->getBBTKType()); + _parent->displayBlackBoxInfo(mod->getBBTKPackage(),mod->getBBTKType()); } // if GBLACKBOX - if (type == GPORT) { + if (type == GPORT) + { // PortText okPortMessage = true; py = py + 5; @@ -826,11 +829,13 @@ bool wxVtkSceneManager::OnMouseMove() { } // for controllers it } } - if (okStatusMessage == false) { + if (okStatusMessage == false) + { updateStatusBar(""); } - if (okPortMessage == false) { + if (okPortMessage == false) + { _textActor->SetScale(0.0001); _fillObjectActor->SetScale(0.0001); } @@ -839,32 +844,35 @@ bool wxVtkSceneManager::OnMouseMove() { //========================================================================= -bool wxVtkSceneManager::OnLeftButtonDown() { - - if (_worldState == INIT_CREATION_CONTOUR) { +bool wxVtkSceneManager::OnLeftButtonDown() +{ + if (_worldState == INIT_CREATION_CONTOUR) + { bool isOverPort = false; std::map::iterator it; - for (it = _controllers.begin(); it != _controllers.end() && isOverPort - == false; ++it) { + for (it = _controllers.begin(); it != _controllers.end() && isOverPort== false; ++it) + { GObjectController *desc = it->second; - if (desc->getGObjectType() == GPORT) { + if (desc->getGObjectType() == GPORT) + { GPortModel *portmod = (GPortModel*) desc->getModel(); vtkGObjectView *portView = desc->getView(); - if (portmod->getPortType() == GINPUTPORT - && portView->getState() == HIGHLIGHTED) { + if (portmod->getPortType() == GINPUTPORT && portView->getState() == HIGHLIGHTED) + { isOverPort = true; - } // if - // JGRR & CM - if ( portmod->getPortType( ) == GINPUTPORT && portView->getState( ) == SELECTED_POSSIBLE_CONNECTION ) { - isOverPort = true ; - portView->setState( HIGHLIGHTED); - } - // EO JGRR & CM - - } // if + } // if + // JGRR & CM + if ( portmod->getPortType( ) == GINPUTPORT && portView->getState( ) == SELECTED_POSSIBLE_CONNECTION ) { + isOverPort = true ; + portView->setState( HIGHLIGHTED); + } + // EO JGRR & CM + + } // if } // for - if (isOverPort == false) { + if (isOverPort == false) + { CancelConnection(); UnSelectBlackBoxes(); } // isOverPort @@ -881,19 +889,20 @@ bool wxVtkSceneManager::OnLeftButtonDown() { GObjectController *cont = GetGBlackBoxControlerPointedByMouse(); - if (GetGBlackBoxControlerPointedByMouse() != NULL) { + if (cont != NULL) { int state = cont->getView()->getState(); if ((ctrlkey == 0) && (state == HIGHLIGHTED)) { UnSelectBlackBoxes(); } + } else { + UnSelectBlackBoxes(); // EED 12/07/2012 } for (int i = 0; i < (int) _selectedObjects.size(); i++) { int id = _selectedObjects[i]; - GObjectController* cont = _controllers[id]; + GObjectController *cont = _controllers[id]; cont->getView()->setState(DRAG); cont->getModel()->notifyObservers(_idManager); } // for - } // if _selectedObjects.size @@ -902,7 +911,8 @@ bool wxVtkSceneManager::OnLeftButtonDown() { //========================================================================= -bool wxVtkSceneManager::OnLeftButtonUp() { +bool wxVtkSceneManager::OnLeftButtonUp() +{ if (_worldState == DRAG_OBJECTS) { _worldState = NOTHING_HAPPENS; @@ -917,8 +927,10 @@ bool wxVtkSceneManager::OnLeftButtonUp() { } //========================================================================= -void wxVtkSceneManager::CancelConnection() { - if (_worldState == INIT_CREATION_CONTOUR) { +void wxVtkSceneManager::CancelConnection() +{ + if (_worldState == INIT_CREATION_CONTOUR) + { _worldState = NOTHING_HAPPENS; //int lastId = _controllers.size()-1; @@ -929,7 +941,8 @@ void wxVtkSceneManager::CancelConnection() { _controllers.erase(_idConnectionInCreation); std::map::iterator it; - for (it = _controllers.begin(); it != _controllers.end(); ++it) { + for (it = _controllers.begin(); it != _controllers.end(); ++it) + { GObjectController *desc = it->second; desc->SetActive(true); desc->getView()->setState(NOTHING_HAPPENS); @@ -1092,7 +1105,8 @@ bool wxVtkSceneManager::OnChar() #endif if(_selectedObjects.size()){ std::cout<<"objects to copy :"; - for(int i=0;i<_selectedObjects.size();i++){ + for(int i=0;i<_selectedObjects.size();i++) + { std::cout<<_selectedObjects.at(i)<<" "; } DuplicateObjects(getSelectedObjects());