]> Creatis software - bbtkGEditor.git/commitdiff
It is possible to delete connections !!!
authorcorredor <>
Thu, 6 May 2010 09:37:24 +0000 (09:37 +0000)
committercorredor <>
Thu, 6 May 2010 09:37:24 +0000 (09:37 +0000)
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourController.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourView.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/manualConnectorContourView.h

index 24099d8c0ddb0b9f355984cfaa738a96b8d9a634..41f2fd5b409f621812ce1f91e5eda5a22ee406f3 100644 (file)
@@ -275,6 +275,7 @@ namespace bbtk
                manContourView->SetColorEditContour(0.5, 0.5, 0.5);
                manContourView->SetColorSelectContour(1, 0.8, 0);
                manContourView->SetWidthLine(1);
+               manContourView->SetShowText(false);
 
                manContourControl->SetModelView( manContourModel , manContourView );
                
@@ -310,6 +311,9 @@ namespace bbtk
                connectorView->setBaseView(_baseView);
                connectorcontroller->setModelAndView(connectorModel,connectorView);
 
+               connectorModel->addObserver(connectorView);
+               connectorModel->addObserver(this);
+
                int newId = _controllers.size();
                connectorcontroller->setId(newId);
                _controllers[newId] = connectorcontroller;
@@ -369,6 +373,7 @@ namespace bbtk
                                {
                                        int id = idController;
                                        _selectedObjects.push_back(id);
+                                       cout<<"RaC wxVtkSceneManager::update _selectedObjects.push_back id:"<<id<<endl;
                                }
 
                        }
@@ -756,6 +761,12 @@ namespace bbtk
                        // Add box controller to be removed
                        controllersToRemove.push_back(bbmod->getObjectId());
                }
+               else if(control->getGObjectType()==GCONNECTOR)
+               {                       
+                       GConnectorModel *conMod = (GConnectorModel*)control->getModel();
+                       cout<<"RaC wxVtkSceneManager::deleteObject id:"<<id<<" modelId:" <<conMod->getObjectId()<<endl;
+                       controllersToRemove.push_back(conMod->getObjectId());
+               }
 
                for(int i = 0;i<controllersToRemove.size();i++)
                {
index 30468e790f1772abddcc34c8b95e33cf04b5e560..b2ff896ce7b75b4e49a6e0e5cd330d8a7a44ab0b 100644 (file)
@@ -104,6 +104,12 @@ namespace bbtk
                        wxVTKiren->GetEventPosition(X, Y);
 
                        _controller->MouseReleaseLeft(X,Y);
+                       if(_controller->GetManualViewBaseContour()->GetSelected()==true)
+                       {
+                               cout<<"RaC GConnectorController::OnLeftButtonUp GetSelected():"<<_controller->GetManualViewBaseContour()->GetSelected() <<endl;
+                               _view->setState(SELECTED);
+                               _model->notifyObservers(getId(),ADD_TO_SELECTED);
+                       }
                        
                }
                return true;
@@ -194,7 +200,7 @@ namespace bbtk
                GConnectorModel *conMod = (GConnectorModel*)_model;
                conMod->disconnectConnection();
 
-               _controller->SetEditable(true);
+               _controller->SetEditable(false);
                _controller->DeleteContour();
        }
 
index 0a352646e70a6e3d9d6a279def8c2232808c94fa..415c64d138815916a18f1a3848106beaa70d87a7 100644 (file)
@@ -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,11 +88,7 @@ namespace bbtk
                SetEditable( false );
                SetPosibleToMove( false );
                SetState(0);
-
-               if(!_created)
-               {
-                       //DeleteContour();
-               }
+               
        }
 
        //=========================================================================
index cb404e004ebc676e2a910e9c5fe347279b9a0439..a987842ce48087c771c6523a0df5862094ae333f 100644 (file)
@@ -69,6 +69,7 @@ namespace bbtk
                //Public methods                
                virtual void MouseClickRight(int x, int y);
                virtual void MouseClickLeft(int x, int y);
+               virtual void MouseMove(int x, int y);
 
        private:
 
index 1a1bbb38a63bf5bfb9e8e05204fd165c595669a2..6fb868581188b0391d8eb385c434df33829f24a3 100644 (file)
@@ -82,8 +82,14 @@ namespace bbtk
                        }
                 }
        }
+       
        //=========================================================================
 
+       void manualConnectorContourView::RefreshText()  // virtual
+       {
+
+       }
+
 
 }  // EO namespace bbtk
 
index b0ec5e255b4307c1065bc54f8a363cb9d4b8b124..7ef4521ab093724fed48062ff0229fb3c6893fb9 100644 (file)
@@ -68,7 +68,8 @@ namespace bbtk
                //Public methods                
                virtual void TransfromCoordViewWorld(double &X, double &Y, double &Z, int type=2);
                void updateStartAndEnd(double* start , double* end);
-               virtual void    AddControlPoints();
+               virtual void AddControlPoints();
+               virtual void RefreshText();
 
        private: