X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsVtkGUIEditorGraphic%2FmanualConnectorContourController.cxx;h=a1c234a00b5a20ed5d2b3a7ecc2aa3abae128bc6;hb=f6286f6851a4c0757cbacbee679d31bcc5a933bd;hp=6a7c06843a49848d15017cbfb02e524b9f3691f1;hpb=4339183c287d12a0b68265ec017cb51e6b24e89a;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx index 6a7c068..a1c234a 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx @@ -46,9 +46,37 @@ namespace bbtk } //========================================================================= + manualConnectorContourController::~manualConnectorContourController() { } + + //========================================================================= + + void manualConnectorContourController::MouseMove(int x, int y) // virtual + { + int z=GetZ(); + GetManualViewBaseContour()->SelectPosiblePoint(x,y,z); + GetManualViewBaseContour()->SelectPosibleContour(x,y,z); + if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); } + if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); } + if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() ) + { + //GetManualViewBaseContour()->MoveContour(x,y,z); + } + if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){ + GetManualViewBaseContour()->Refresh(); + this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); + } + if (!IsEditable()) + { + GetManualViewBaseContour()->RemoveControlPoints(); + GetManualViewBaseContour()->Refresh(); + this->_vtkInteractorStyleBaseView->SetRefresh_waiting(); + } + + } + //========================================================================= void manualConnectorContourController::MouseClickRight(int x, int y) @@ -60,15 +88,13 @@ namespace bbtk SetEditable( false ); SetPosibleToMove( false ); SetState(0); - - if(!_created) - { - //DeleteContour(); - } + } //========================================================================= - void manualConnectorContourController::MouseClickLeft(int x, int y){ + + void manualConnectorContourController::MouseClickLeft(int x, int y) + { bool ok = false; int z = GetZ(); @@ -97,14 +123,7 @@ namespace bbtk if ((GetState()==1) && (_easyCreation==true) && GetNumberOfPointsManualContour()==2) { ok=true; - - SetCompleteCreation( true ); - SetKeyBoardMoving( false ); - GetManualContourModel()->SetCloseContour(false); - - SetEditable( false ); - SetPosibleToMove( false ); - SetState(0); + endContourCreation(); } // Continue to Insert Control Points with ClickLeft (After being empty the contour) @@ -128,7 +147,10 @@ namespace bbtk { ok=true; _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z); - SetState(5); + if(_bakIdPoint!=0 && _bakIdPoint!=GetManualViewBaseContour()->GetNumberOfPoints()-1) + { + SetState(5); + } } // If nothing selected _state=7 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) ) @@ -154,6 +176,21 @@ namespace bbtk GetManualViewBaseContour()->Refresh(); } } + + //========================================================================= + + void manualConnectorContourController::endContourCreation() + { + SetCompleteCreation( true ); + SetKeyBoardMoving( false ); + GetManualContourModel()->SetCloseContour(false); + + SetEditable( false ); + SetPosibleToMove( false ); + SetState(0); + } + + //========================================================================= } // EO namespace bbtk