vtkGObjectView.cxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
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)
00061 {
00062
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()
00090 {
00091
00092 }
00093
00094
00095
00096 void vtkGObjectView::updateColors()
00097 {
00098
00099 }
00100
00101
00102
00103 void vtkGObjectView::addVtkActors()
00104 {
00105 _baseView->GetRenderer()->AddActor(_fillObjectActor);
00106 _baseView->GetRenderer()->Render();
00107 }
00108
00109
00110
00111 void vtkGObjectView::removeVtkActors()
00112 {
00113 _baseView->GetRenderer()->RemoveActor(_fillObjectActor);
00114 _baseView->GetRenderer()->Render();
00115 }
00116
00117
00118
00119 bool vtkGObjectView::isPointInside(int X,int Y)
00120 {
00121
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)
00130 {
00131
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 }
00190
00191
00192