manualContour3VControler.cpp
Go to the documentation of this file.00001 #include "manualContour3VControler.h"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 manualContour3VControler::manualContour3VControler(int type)
00013 {
00014 _type=type;
00015
00016
00017
00018
00019
00020 }
00021
00022 manualContour3VControler::~manualContour3VControler()
00023 {
00024 }
00025
00026
00027 manualContour3VControler * manualContour3VControler :: Clone()
00028 {
00029 manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
00030 CopyAttributesTo(clone);
00031 return clone;
00032 }
00033
00034
00035 void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject)
00036 {
00037
00038 manualContourControler::CopyAttributesTo(cloneObject);
00039
00040 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
00041
00042
00043
00044 }
00045
00046 int manualContour3VControler::GetType()
00047 {
00048 return _type;
00049 }
00050
00051
00052 void manualContour3VControler::AddPoint_Others()
00053 {
00054 manualViewBaseContour *mvbc;
00055 int i,size=this->_lstManualViewBaseContour.size();
00056 for ( i = 0 ; i < size ; i++ )
00057 {
00058 mvbc = _lstManualViewBaseContour[i];
00059 mvbc->AddPoint();
00060 }
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00071 }
00072
00073 void manualContour3VControler::AddPoint( int x, int y, int z )
00074 {
00075
00076 z=(int)_vtkmprbasedata->GetZ();
00077 if (GetManualContourModel()!=NULL){
00078 double xx = x;
00079 double yy = y;
00080 double zz = z;
00081 GetManualViewBaseContour()->TransfromCoordViewWorld(xx,yy,zz,_type);
00082
00083 if (_type==0)
00084 {
00085 xx=_vtkmprbasedata->GetX();
00086 }
00087
00088 if (_type==1)
00089 {
00090 yy=_vtkmprbasedata->GetY();
00091 }
00092
00093
00094 GetManualContourModel()->AddPoint(xx,yy,zz);
00095 GetManualViewBaseContour()->AddPoint();
00096 AddPoint_Others();
00097
00098 }
00099 }
00100
00101
00102 void manualContour3VControler::InsertPoint_Others(int id)
00103 {
00104
00105 manualViewBaseContour *mvbc;
00106 int i,size=this->_lstManualViewBaseContour.size();
00107 for ( i = 0 ; i < size ; i++ )
00108 {
00109 mvbc = _lstManualViewBaseContour[i];
00110 mvbc->InsertPoint(id);
00111 }
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00123
00124 }
00125
00126 void manualContour3VControler::InsertPoint(int x, int y, int z)
00127 {
00128 int id=-1;
00129 if (GetManualContourModel()!=NULL){
00130 if (GetManualContourModel()->GetSizeLstPoints()>1){
00131 z=(int)_vtkmprbasedata->GetZ();
00132 double xx = x;
00133 double yy = y;
00134 double zz = z;
00135 GetManualViewBaseContour()->TransfromCoordViewWorld(xx,yy,zz,_type);
00136 if (_type==0)
00137 {
00138 xx=_vtkmprbasedata->GetX();
00139 }
00140
00141 if (_type==1)
00142 {
00143 yy=_vtkmprbasedata->GetY();
00144 }
00145
00146 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
00147
00148 GetManualViewBaseContour()->InsertPoint(id);
00149 InsertPoint_Others(0);
00150
00151 } else {
00152 AddPoint(x,y,z);
00153 }
00154 }
00155 }
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174 void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont )
00175 {
00176 _lstManualViewBaseContour.push_back( manViewBaseCont );
00177 }
00178
00179
00180 void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
00181 {
00182 _vtkmprbasedata=vtkmprbasedata;
00183 }
00184
00185 vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData()
00186 {
00187 return _vtkmprbasedata;
00188 }
00189
00190 void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z )
00191 {
00192 z=(int)_vtkmprbasedata->GetZ();
00193 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
00194 double xx = x;
00195 double yy = y;
00196 double zz = z;
00197 GetManualViewBaseContour()->TransfromCoordViewWorld(xx,yy,zz,_type);
00198
00199 if (_type==0)
00200 {
00201 xx=_vtkmprbasedata->GetX();
00202 }
00203 if (_type==1)
00204 {
00205 yy=_vtkmprbasedata->GetY();
00206 }
00207
00208 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
00209 mp->SetPoint(xx,yy,zz);
00210
00211 }
00212 }
00213
00214 void manualContour3VControler::DeleteActualMousePoint_Others(int id)
00215 {
00216 manualViewBaseContour *mvbc;
00217 int i,size=this->_lstManualViewBaseContour.size();
00218 for ( i = 0 ; i < size ; i++ )
00219 {
00220 mvbc = _lstManualViewBaseContour[i];
00221 mvbc->DeletePoint(id);
00222 mvbc->Refresh();
00223 }
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00239 }
00240
00241 void manualContour3VControler::DeleteActualMousePoint(int x, int y)
00242 {
00243 int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
00244 if (id!=-1){
00245 manualContourBaseControler::DeleteActualMousePoint( x , y );
00246 DeleteActualMousePoint_Others( id );
00247 }
00248 }
00249
00250 void manualContour3VControler::MouseMove_Others(int id)
00251 {
00252 manualViewBaseContour *mvbc;
00253 int i,size=this->_lstManualViewBaseContour.size();
00254 for ( i = 0 ; i < size ; i++ )
00255 {
00256 mvbc = _lstManualViewBaseContour[i];
00257 mvbc->SelectAllPossibleSelected(false);
00258 if (id!=-1)
00259 {
00260 mvbc->SetPointPosibleSelected(id,true);
00261 }
00262 mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
00263 mvbc->Refresh();
00264 }
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00289
00290 }
00291
00292
00293 void manualContour3VControler::MouseMove(int x, int y)
00294 {
00295 manualContourControler::MouseMove( x , y );
00296 int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
00297 MouseMove_Others( id );
00298 }
00299
00300
00301 void manualContour3VControler::OnChar_Others()
00302 {
00303 manualViewBaseContour *mvbc;
00304 int i,size=this->_lstManualViewBaseContour.size();
00305 for ( i = 0 ; i < size ; i++ )
00306 {
00307 mvbc = _lstManualViewBaseContour[i];
00308 mvbc->Refresh();
00309 }
00310
00311
00312
00313
00314
00315
00316 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00317 }
00318
00319 bool manualContour3VControler::OnChar()
00320 {
00321 manualContourControler::OnChar();
00322 OnChar_Others();
00323 return true;
00324 }
00325
00326 void manualContour3VControler::ResetContour()
00327 {
00328 manualContourControler::ResetContour();
00329 ResetContour_Others();
00330 }
00331
00332
00333 void manualContour3VControler::ResetContour_Others()
00334 {
00335 manualViewBaseContour *mvbc;
00336 int i,size=this->_lstManualViewBaseContour.size();
00337 for ( i = 0 ; i < size ; i++ )
00338 {
00339 mvbc = _lstManualViewBaseContour[i];
00340 mvbc->DeleteContour();
00341 mvbc->CreateNewContour();
00342 }
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353 }
00354