]> 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 c20afadbdf133627b4720f415ebbead9035d549c..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,7 +57,7 @@ namespace bbtk
        }
        //=========================================================================
 
-       void vtkGObjectView::update()//virtual
+       void vtkGObjectView::update(int idController,int command)//virtual
        {
                //virtual
        }
@@ -89,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