]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGObjectView.cxx
Updated Version with the moving of the objects updated and the background doesn't...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / vtkGObjectView.cxx
index 7e4d139bf5146c0badb86b7d431e99dabc44ef45..1c2fd8f8d1e6622f3fb1bab6d619033b61697fb2 100644 (file)
@@ -44,7 +44,11 @@ namespace bbtk
        vtkGObjectView::vtkGObjectView()
        {
                _baseView=NULL;
-               _objectActor=NULL;
+               _objectBorderActor=NULL;
+               _fillBorderActor=NULL;
+               _isStartDragging=false;
+               
+               _state = NOTHING_HAPPENS;
        }
 
        //=========================================================================
@@ -53,19 +57,9 @@ namespace bbtk
        }
        //=========================================================================
 
-       void vtkGObjectView::refresh()
+       void vtkGObjectView::update(int idController,int command)//virtual
        {
-               if(_model->getState()==NOTHING_HAPPENS)
-               {
-                       _objectActor->GetProperty()->SetColor(0,0,0);
-               }
-
-               if(_model->getState()==HIGHLIGHTED)
-               {
-                       _objectActor->GetProperty()->SetColor(1,0,0);
-               }
-
-               //paint();
+               //virtual
        }
 
        //=========================================================================
@@ -99,23 +93,84 @@ namespace bbtk
 
        //=========================================================================
 
+       void vtkGObjectView::updateColors() //virtual
+       {
+               //virtual
+       }
+
+       //=========================================================================
+
        void vtkGObjectView::addVtkActors()//virtual
        {
-               _baseView->GetRenderer()->AddActor(_objectActor);
+               _baseView->GetRenderer()->AddActor(_objectBorderActor);
+               _baseView->GetRenderer()->AddActor(_fillBorderActor);
                _baseView->GetRenderer()->Render();
        }
 
        //=========================================================================
 
-       bool vtkGObjectView::isPointInside(int X,int Y) 
+       bool vtkGObjectView::isPointInside(int X,int Y) //virtual
        {
-               double xx=X,yy=Y,zz=0;
+               // RaC In the actual version, always z=900
+               double xx=X,yy=Y,zz=900;
                _baseView->TransCoordScreenToWorld(xx,yy,zz);
                return _model->isPointInside(xx,yy,zz);
        }
 
        //=========================================================================
 
+       void vtkGObjectView::moveObject(int X,int Y) //virtual
+       {               
+               // RaC In the actual version, always z=900
+               double xx=X,yy=Y,zz=900;
+               _baseView->TransCoordScreenToWorld(xx,yy,zz);
+
+               if(_isStartDragging)
+               {
+                       _isStartDragging=false;
+                       
+                       double xInic,yInic,zInic;
+                       _model->getInicPoint(xInic,yInic,zInic);                        
+                       dragDifX=xx-xInic;
+                       dragDifY=yy-yInic;      
+               }
+               _model->move(xx-dragDifX,yy-dragDifY,zz);
+
+       }
+
+       //=========================================================================
+
+       void vtkGObjectView::setStartDragging(bool param)
+       {
+               _isStartDragging=param;
+               dragDifX=0;
+               dragDifX=0;
+       }
+
+       //=========================================================================
+
+       void vtkGObjectView::setState(int state)
+       {
+               _state = state;
+       }
+
+       //=========================================================================
+
+       int vtkGObjectView::getState()
+       {
+               return _state;
+       }
+
+       //=========================================================================
+
+       void vtkGObjectView::setRefreshWaiting()
+       {
+               ((vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView())->SetRefresh_waiting();
+       }
+
+       //=========================================================================
+
+
 }  // EO namespace bbtk
 
 // EOF