]> 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 0f748b84285bbd570f084bd5e3bf63a3e6b03513..1c2fd8f8d1e6622f3fb1bab6d619033b61697fb2 100644 (file)
@@ -43,8 +43,12 @@ namespace bbtk
        //=========================================================================
        vtkGObjectView::vtkGObjectView()
        {
-               _renderer=NULL;
-               _objectActor=NULL;
+               _baseView=NULL;
+               _objectBorderActor=NULL;
+               _fillBorderActor=NULL;
+               _isStartDragging=false;
+               
+               _state = NOTHING_HAPPENS;
        }
 
        //=========================================================================
@@ -53,9 +57,9 @@ namespace bbtk
        }
        //=========================================================================
 
-       void vtkGObjectView::refresh()
+       void vtkGObjectView::update(int idController,int command)//virtual
        {
-               //paint();
+               //virtual
        }
 
        //=========================================================================
@@ -67,9 +71,9 @@ namespace bbtk
 
        //=========================================================================
        
-       void vtkGObjectView::setRenderer(vtkRenderer* renderer)
+       void vtkGObjectView::setBaseView(wxVtkBaseView* baseView)
        {
-               _renderer=renderer;
+               _baseView=baseView;
        }
 
        //=========================================================================
@@ -89,14 +93,84 @@ namespace bbtk
 
        //=========================================================================
 
+       void vtkGObjectView::updateColors() //virtual
+       {
+               //virtual
+       }
+
+       //=========================================================================
+
        void vtkGObjectView::addVtkActors()//virtual
        {
-               _renderer->AddActor(_objectActor);
-               _renderer->Render();
+               _baseView->GetRenderer()->AddActor(_objectBorderActor);
+               _baseView->GetRenderer()->AddActor(_fillBorderActor);
+               _baseView->GetRenderer()->Render();
+       }
+
+       //=========================================================================
+
+       bool vtkGObjectView::isPointInside(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);
+               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