manualContour3DControler.cpp
Go to the documentation of this file.00001 #include "manualContour3DControler.h"
00002
00003
00004
00005
00006
00007
00008 manualContour3DControler::manualContour3DControler()
00009 {
00010 }
00011
00012 manualContour3DControler::~manualContour3DControler()
00013 {
00014 }
00015
00016 manualContour3DControler * manualContour3DControler :: Clone()
00017 {
00018 manualContour3DControler * clone = new manualContour3DControler();
00019 CopyAttributesTo(clone);
00020 return clone;
00021 }
00022
00023
00024 void manualContour3DControler::CopyAttributesTo( manualContour3DControler * cloneObject)
00025 {
00026
00027 manualContourControler::CopyAttributesTo(cloneObject);
00028
00029 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
00030 }
00031
00032
00033 bool manualContour3DControler::OnLeftButtonDown()
00034 {
00035 int X,Y;
00036 wxVTKRenderWindowInteractor *wxVTKiren;
00037 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00038 wxVTKiren->GetEventPosition(X,Y);
00039 MouseClickLeft(X,Y);
00040 return true;
00041 }
00042
00043 void manualContour3DControler::ResetOrientationPlane()
00044 {
00045 double p[3],rp[3],rn[3];
00046 p[0] = this->GetVtkMPRBaseData()->GetX( );
00047 p[1] = this->GetVtkMPRBaseData()->GetY( );
00048 p[2] = this->GetVtkMPRBaseData()->GetZ( );
00049 this->GetManualContourModel()->GetNearestPointAndNormal(p,rp,rn);
00050 this->GetVtkMPRBaseData()->SetNormal(rn[0],rn[1],rn[2]);
00051 }
00052
00053 void manualContour3DControler::MouseClickLeft(int x, int y)
00054 {
00055 manualView3DContour *manualview3Dcontour=(manualView3DContour*)GetManualViewBaseContour();
00056 int id=manualview3Dcontour->GetIdPoint2(x,y);
00057 if ( (GetState()==0) && (id!=-1) )
00058 {
00059 manualPoint *mp = this->GetManualContourModel()->GetManualPoint(id);
00060
00061 this->GetVtkMPRBaseData()->SetX( mp->GetX() );
00062 this->GetVtkMPRBaseData()->SetY( mp->GetY() );
00063 this->GetVtkMPRBaseData()->SetZ( mp->GetZ() );
00064 ResetOrientationPlane();
00065 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
00066 }
00067
00068
00069 manualContourControler::MouseClickLeft(x,y);
00070
00071 }
00072
00073 bool manualContour3DControler::OnChar()
00074 {
00075 bool ok=true;
00076 manualContourControler::OnChar();
00077 char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
00078 if (keyCode==32){
00079 ok=false;
00080 ResetOrientationPlane();
00081 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
00082 }
00083 return ok;
00084 }
00085
00086
00087 void manualContour3DControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
00088 {
00089 _vtkmprbasedata=vtkmprbasedata;
00090 }
00091
00092 vtkMPRBaseData *manualContour3DControler::GetVtkMPRBaseData()
00093 {
00094 return _vtkmprbasedata;
00095 }
00096
00097
00098 void manualContour3DControler::InsertPoint(int x, int y, int z )
00099 {
00100 manualContourControler::InsertPoint( x, y, z );
00101 ResetOrientationPlane();
00102 }
00103