vtkGObjectView.cxx

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002 Program:   bbtk
00003 Module:    $RCSfile: vtkGObjectView.cxx,v $
00004 Language:  C++
00005 Date:      $Date: 2010/09/09 08:07:43 $
00006 Version:   $Revision: 1.15 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00037 #include "vtkGObjectView.h"
00038 
00039 namespace bbtk
00040 {
00041 
00042 
00043         //=========================================================================
00044         vtkGObjectView::vtkGObjectView()
00045         {
00046                 _baseView                       = NULL;
00047                 _borderObjectActor      = NULL;
00048                 _fillObjectActor        = NULL;
00049                 _isStartDragging        = false;
00050                 
00051                 _state                          = NOTHING_HAPPENS;
00052         }
00053 
00054         //=========================================================================
00055         vtkGObjectView::~vtkGObjectView()
00056         {
00057         }
00058         //=========================================================================
00059 
00060         void vtkGObjectView::update(int idController,int command)//virtual
00061         {
00062                 //virtual
00063         }
00064 
00065         //=========================================================================
00066         
00067         void vtkGObjectView::setModel(GObjectModel *model)
00068         {
00069                 _model = model;
00070         }
00071 
00072         //=========================================================================
00073         
00074         void vtkGObjectView::setBaseView(wxVtkBaseView* baseView)
00075         {
00076                 _baseView = baseView;
00077         }
00078 
00079         //=========================================================================
00080 
00081         void vtkGObjectView::initVtkObjects()
00082         {
00083                 createVtkObjects();
00084                 addVtkActors();
00085         }
00086 
00087         //=========================================================================
00088 
00089         void vtkGObjectView::createVtkObjects() //virtual
00090         {
00091                 //virtual
00092         }
00093 
00094         //=========================================================================
00095 
00096         void vtkGObjectView::updateColors() //virtual
00097         {
00098                 //virtual
00099         }
00100 
00101         //=========================================================================
00102 
00103         void vtkGObjectView::addVtkActors()//virtual
00104         {               
00105                 _baseView->GetRenderer()->AddActor(_fillObjectActor);
00106                 _baseView->GetRenderer()->Render();
00107         }
00108 
00109         //=========================================================================
00110 
00111         void vtkGObjectView::removeVtkActors()//virtual
00112         {
00113                 _baseView->GetRenderer()->RemoveActor(_fillObjectActor);
00114                 _baseView->GetRenderer()->Render();
00115         }
00116 
00117         //=========================================================================
00118 
00119         bool vtkGObjectView::isPointInside(int X,int Y) //virtual
00120         {
00121                 // RaC In the actual version, always z=900
00122                 double xx=X,yy=Y,zz=900;
00123                 _baseView->TransCoordScreenToWorld(xx,yy,zz);
00124                 return _model->isPointInside(xx,yy,zz);
00125         }
00126 
00127         //=========================================================================
00128 
00129         void vtkGObjectView::moveObject(int X,int Y) //virtual
00130         {               
00131                 // RaC In the actual version, always z=900
00132                 double xx=X,yy=Y,zz=900;
00133                 _baseView->TransCoordScreenToWorld(xx,yy,zz);
00134 
00135                 if(_isStartDragging)
00136                 {
00137                         _isStartDragging=false;
00138                         
00139                         double xInic,yInic,zInic;
00140                         _model->getInicPoint(xInic,yInic,zInic);                        
00141                         dragDifX=xx-xInic;
00142                         dragDifY=yy-yInic;      
00143                 }
00144                 _model->move(xx-dragDifX,yy-dragDifY,zz);
00145 
00146         }
00147 
00148         //=========================================================================
00149 
00150         void vtkGObjectView::setStartDragging(bool param)
00151         {
00152                 _isStartDragging=param;
00153                 dragDifX=0;
00154                 dragDifX=0;
00155         }
00156 
00157         //=========================================================================
00158 
00159         void vtkGObjectView::setState(int state)
00160         {
00161                 _state = state;
00162         }
00163 
00164         //=========================================================================
00165 
00166         int vtkGObjectView::getState()
00167         {
00168                 return _state;
00169         }
00170 
00171         //=========================================================================
00172 
00173         void vtkGObjectView::setRefreshWaiting()
00174         {
00175                 ((vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView())->SetRefresh_waiting();
00176         }
00177 
00178         //=========================================================================
00179         
00180         void vtkGObjectView::removeFromScene()
00181         {
00182                 removeVtkActors();
00183                 setRefreshWaiting();
00184         }
00185 
00186         //=========================================================================
00187 
00188 
00189 }  // EO namespace bbtk
00190 
00191 // EOF
00192 

Generated on Thu May 31 15:12:19 2012 for bbtkGEditor by  doxygen 1.5.7.1