1 #include "manualContourPerpPlaneControler.h"
3 // ----------------------------------------------------------------------------
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
6 manualContourPerpPlaneControler::manualContourPerpPlaneControler()
10 // ----------------------------------------------------------------------------
11 manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
14 // ----------------------------------------------------------------------------
15 manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone() // virtual
17 manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
18 CopyAttributesTo(clone);
22 // ---------------------------------------------------------------------------
23 void manualContourPerpPlaneControler::CopyAttributesTo( manualContourPerpPlaneControler * cloneObject)
26 manualContourControler::CopyAttributesTo(cloneObject);
28 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
29 cloneObject->SetManualContour3VControler( this->GetManualContour3VControler() );
30 cloneObject->SetVtkInteractorStylePlane2D( this->GetVtkInteractorStylePlane2D() );
33 // ----------------------------------------------------------------------------
34 void manualContourPerpPlaneControler::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
36 _vtkmprbasedata = vtkmprbasedata;
39 // ----------------------------------------------------------------------------
40 vtkMPRBaseData *manualContourPerpPlaneControler::GetVtkMPRBaseData()
42 return _vtkmprbasedata;
46 // ----------------------------------------------------------------------------
47 void manualContourPerpPlaneControler::InsertPoint(int x, int y, int z ) // virtual
49 manualContourControler::InsertPoint( x, y, z );
50 _manualcontour3Vcontroler->InsertPoint_Others(0);
52 // ----------------------------------------------------------------------------
53 void manualContourPerpPlaneControler::AddPoint( int x, int y, int z )
55 manualContourControler::AddPoint( x, y, z );
56 _manualcontour3Vcontroler->AddPoint_Others();
58 // ----------------------------------------------------------------------------
59 void manualContourPerpPlaneControler::DeleteActualMousePoint(int x, int y)
61 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
62 manualContourControler::DeleteActualMousePoint( x , y );
63 _manualcontour3Vcontroler->DeleteActualMousePoint_Others(id);
65 // ----------------------------------------------------------------------------
66 void manualContourPerpPlaneControler::MouseMove( int x, int y )
68 _flagMouseMove = true;
69 int ss =this->_vtkInteractorStyleBaseView->vtkInteractorStyle::GetState();
70 if ((this->GetState()!=7) && (ss!=1)){
71 manualContourControler::MouseMove( x , y );
72 int id = GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
75 _manualcontour3Vcontroler->MouseMove_Others(id);
76 _flagMouseMove = false;
80 // ----------------------------------------------------------------------------
81 void manualContourPerpPlaneControler::SetManualContour3VControler(manualContour3VControler *manualcontour3Vcontroler)
83 _manualcontour3Vcontroler = manualcontour3Vcontroler;
85 // ----------------------------------------------------------------------------
86 manualContour3VControler * manualContourPerpPlaneControler::GetManualContour3VControler()
88 return _manualcontour3Vcontroler;
90 // ----------------------------------------------------------------------------
91 bool manualContourPerpPlaneControler::OnChar() // virtual
93 if (manualContourControler::OnChar()==false )
95 _manualcontour3Vcontroler->OnChar_Others();
99 // ----------------------------------------------------------------------------
100 bool manualContourPerpPlaneControler::OnMouseMove() // virtual
102 manualContourControler::OnMouseMove();
103 return _flagMouseMove;
105 // ----------------------------------------------------------------------------
106 bool manualContourPerpPlaneControler::OnLeftDClick() // virtual
108 manualContourControler::OnLeftDClick();
109 return _flagMouseDClick;
111 // ----------------------------------------------------------------------------
112 void manualContourPerpPlaneControler::ResetContour() // virtual
114 manualContourControler::ResetContour();
115 _manualcontour3Vcontroler->ResetContour_Others();
118 // ----------------------------------------------------------------------------
119 void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
121 _flagMouseDClick=true;
122 manualContourControler::MouseDLeft(x,y);
124 if (GetManualViewBaseContour()->ifTouchContour(x,y,0)==true)
126 _flagMouseDClick = false;
127 _vtkinteractorstyleplane2D->OnLeftDClick();
128 ResetOrientationPlane();
129 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
132 // int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
133 // if ( (GetState()==0) && (id!=-1) )
135 // manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
136 // _vtkmprbasedata->SetX( mp->GetX() );
137 // _vtkmprbasedata->SetY( mp->GetY() );
138 // _vtkmprbasedata->SetZ( mp->GetZ() );
139 // ResetOrientationPlane();
140 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
146 // ----------------------------------------------------------------------------
147 void manualContourPerpPlaneControler::ResetOrientationPlane()
149 double p[3],rp[3],rn[3];
150 p[0] = _vtkmprbasedata->GetX( );
151 p[1] = _vtkmprbasedata->GetY( );
152 p[2] = _vtkmprbasedata->GetZ( );
153 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
155 _vtkmprbasedata->SetNormal(rn[0],rn[1],rn[2]);
158 // ----------------------------------------------------------------------------
159 void manualContourPerpPlaneControler::SetVtkInteractorStylePlane2D(InteractorStyleMaracas *vtkinteractorstyleplane2D)
161 _vtkinteractorstyleplane2D = vtkinteractorstyleplane2D;
163 // ----------------------------------------------------------------------------
164 InteractorStyleMaracas * manualContourPerpPlaneControler::GetVtkInteractorStylePlane2D()
166 return _vtkinteractorstyleplane2D;