manualContourPerpPlaneControler.cpp
Go to the documentation of this file.00001 #include "manualContourPerpPlaneControler.h"
00002
00003
00004
00005
00006 manualContourPerpPlaneControler::manualContourPerpPlaneControler()
00007 {
00008 _flagMouseMove = true;
00009 }
00010
00011 manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
00012 {
00013 }
00014
00015 manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone()
00016 {
00017 manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
00018 CopyAttributesTo(clone);
00019 return clone;
00020 }
00021
00022
00023 void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject)
00024 {
00025
00026 manualContourControler::CopyAttributesTo(cloneObject);
00027
00028 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
00029 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
00030 cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() );
00031 }
00032
00033
00034 void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
00035 {
00036 _vtkmprbasedata = vtkmprbasedata;
00037 }
00038
00039
00040 vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData()
00041 {
00042 return _vtkmprbasedata;
00043 }
00044
00045
00046
00047 void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z )
00048 {
00049 manualContourControler::InsertPoint( x, y, z );
00050 _manualcontour3Vcontroler->InsertPoint_Others(0);
00051 }
00052
00053 void manualContourPerpPlaneControler::AddPoint( int x, int y, int z )
00054 {
00055 manualContourControler::AddPoint( x, y, z );
00056 _manualcontour3Vcontroler->AddPoint_Others();
00057 }
00058
00059 void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y)
00060 {
00061 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
00062 manualContourControler::DeleteActualMousePoint( x , y );
00063 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
00064 }
00065
00066 void manualContourPerpPlaneControler::MouseMove( int x, int y )
00067 {
00068 _flagMouseMove = true;
00069 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
00070 if ((this->GetState()!=7) && (ss!=1)){
00071 manualContourControler::MouseMove( x , y );
00072 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
00073 if (id!=-1)
00074 {
00075 _manualcontour3Vcontroler->MouseMove_Others(id);
00076 _flagMouseMove = false;
00077 }
00078 }
00079 }
00080
00081 void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
00082 {
00083 _manualcontour3Vcontroler = manualcontour3Vcontroler;
00084 }
00085
00086 manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler()
00087 {
00088 return _manualcontour3Vcontroler;
00089 }
00090
00091 bool manualContourPerpPlaneControler::OnChar()
00092 {
00093 if (manualContourControler::OnChar()==false )
00094 {
00095 _manualcontour3Vcontroler->OnChar_Others();
00096 }
00097 return true;
00098 }
00099
00100 bool manualContourPerpPlaneControler::OnMouseMove()
00101 {
00102 manualContourControler::OnMouseMove();
00103 return _flagMouseMove;
00104 }
00105
00106 bool manualContourPerpPlaneControler::OnLeftDClick()
00107 {
00108 manualContourControler::OnLeftDClick();
00109 return _flagMouseDClick;
00110 }
00111
00112 void manualContourPerpPlaneControler::ResetContour()
00113 {
00114 manualContourControler::ResetContour();
00115 _manualcontour3Vcontroler->ResetContour_Others();
00116 }
00117
00118
00119 void manualContourPerpPlaneControler::MouseDLeft( int x, int y)
00120 {
00121 _flagMouseDClick=true;
00122 manualContourControler::MouseDLeft(x,y);
00123
00124 if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true)
00125 {
00126 _flagMouseDClick = false;
00127 _vtkinteractorstyleplane2D->OnLeftDClick();
00128 ResetOrientationPlane();
00129 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00130 }
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 }
00143
00144
00145
00146
00147 void manualContourPerpPlaneControler::ResetOrientationPlane()
00148 {
00149 double p[3],rp[3],rn[3];
00150 p[0] = _vtkmprbasedata->GetX( );
00151 p[1] = _vtkmprbasedata->GetY( );
00152 p[2] = _vtkmprbasedata->GetZ( );
00153 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
00154
00155 _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]);
00156 }
00157
00158
00159 void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D)
00160 {
00161 _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D;
00162 }
00163
00164 InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D()
00165 {
00166 return _vtkinteractorstyleplane2D;
00167 }
00168