manualContour3VControler.cpp

Go to the documentation of this file.
00001 #include "manualContour3VControler.h"
00002 
00003 // ----------------------------------------------------------------------------
00004 // ----------------------------------------------------------------------------
00005 // ----------------------------------------------------------------------------
00006 
00007 // _type = 0  Sagital
00008 // _type = 1  Coronal
00009 // _type = 2  Axial
00010 // _type = -1 View 3D
00011 
00012 manualContour3VControler::manualContour3VControler(int type)
00013 {
00014         _type=type;
00015 
00016 //EEDhh
00017 //      _manViewBaseCont1 = NULL;
00018 //      _manViewBaseCont2 = NULL;
00019 //      _manViewBaseCont3 = NULL;
00020 }
00021 //----------------------------------------------------------------------------
00022 manualContour3VControler::~manualContour3VControler()
00023 {
00024 }
00025 
00026 // ----------------------------------------------------------------------------
00027 manualContour3VControler * manualContour3VControler :: Clone()  // virtual
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         // Fathers object
00038         manualContourControler::CopyAttributesTo(cloneObject);
00039 
00040         cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
00041 
00042         // Remember to add ManualViewBaseContour with "AddManualViewBaseContour"
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 // EEDhh
00063 //      if (_manViewBaseCont1!=NULL){
00064 //              _manViewBaseCont1->AddPoint();
00065 //              _manViewBaseCont2->AddPoint();
00066 //              _manViewBaseCont3->AddPoint();
00067 //              this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00068 //      }
00069 
00070         this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00071 }
00072 // ----------------------------------------------------------------------------
00073 void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
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                 /*int   id              = */ GetManualContourModel()->AddPoint(xx,yy,zz);  // JPRx
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 /*EEDhh
00114         if (_manViewBaseCont1!=NULL){
00115                 _manViewBaseCont1->InsertPoint(id);
00116                 _manViewBaseCont2->InsertPoint(id);
00117                 _manViewBaseCont3->InsertPoint(id);
00118                 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
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 // EEDhh
00159 /*
00160 void manualContour3VControler::SetModelView (   manualContourModel *manContModel,
00161                                                                                                 manualViewBaseContour *manViewBaseCont0,
00162                                                                                                 manualViewBaseContour *manViewBaseCont1,
00163                                                                                                 manualViewBaseContour *manViewBaseCont2,
00164                                                                                                 manualViewBaseContour *manViewBaseCont3)
00165 {
00166         manualContourControler::SetModelView(manContModel,manViewBaseCont0);
00167         _manViewBaseCont1 = manViewBaseCont1;
00168         _manViewBaseCont2 = manViewBaseCont2;
00169         _manViewBaseCont3 = manViewBaseCont3;
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 ) // virtual
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         if (_manViewBaseCont1!=NULL){
00227                 _manViewBaseCont1->DeletePoint(id);
00228                 _manViewBaseCont2->DeletePoint(id);
00229                 _manViewBaseCont3->DeletePoint(id);
00230 
00231                 _manViewBaseCont1->Refresh();
00232                 _manViewBaseCont2->Refresh();
00233                 _manViewBaseCont3->Refresh();
00234 
00235                 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00236         }
00237 */
00238         this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00239 }
00240 // ----------------------------------------------------------------------------
00241 void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual
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) // virtual
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 // EEDhh
00267 /*
00268         if (_manViewBaseCont1!=NULL){
00269                 _manViewBaseCont1->SelectAllPossibleSelected(false);
00270                 _manViewBaseCont2->SelectAllPossibleSelected(false);
00271                 _manViewBaseCont3->SelectAllPossibleSelected(false);
00272                 if (id!=-1){
00273                         _manViewBaseCont1->SetPointPosibleSelected(id,true);
00274                         _manViewBaseCont2->SetPointPosibleSelected(id,true);
00275                         _manViewBaseCont3->SetPointPosibleSelected(id,true);
00276                 }
00277                 _manViewBaseCont1->SetPosibleSelected  (  GetManualViewBaseContour()->GetPosibleSelected()  );
00278                 _manViewBaseCont2->SetPosibleSelected  (  GetManualViewBaseContour()->GetPosibleSelected()  );
00279                 _manViewBaseCont3->SetPosibleSelected  (  GetManualViewBaseContour()->GetPosibleSelected()  );
00280 
00281                 _manViewBaseCont1->Refresh();
00282                 _manViewBaseCont2->Refresh();
00283                 _manViewBaseCont3->Refresh();
00284 
00285                 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00286         }
00287 */
00288         this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00289 
00290 }
00291 
00292 // ----------------------------------------------------------------------------
00293 void manualContour3VControler::MouseMove(int x, int y) // virtual
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 // EEDhh
00311 /*
00312                 _manViewBaseCont1->Refresh();
00313                 _manViewBaseCont2->Refresh();
00314                 _manViewBaseCont3->Refresh();
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() // virtual
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 // EEDhh
00345 /*
00346         _manViewBaseCont1->DeleteContour();
00347         _manViewBaseCont2->DeleteContour();
00348         _manViewBaseCont3->DeleteContour();
00349         _manViewBaseCont1->CreateNewContour();
00350         _manViewBaseCont2->CreateNewContour();
00351         _manViewBaseCont3->CreateNewContour();
00352 */
00353 }
00354 

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1