00001 00002 #include "vtkInteractorStyleBaseView3D.h" 00003 00004 #include "vtkObjectFactory.h" 00005 00006 vtkStandardNewMacro(vtkInteractorStyleBaseView3D); 00007 00008 //--------------------------------------------------------------------------- 00009 vtkInteractorStyleBaseView3D::vtkInteractorStyleBaseView3D(){ 00010 } 00011 //--------------------------------------------------------------------------- 00012 vtkInteractorStyleBaseView3D::~vtkInteractorStyleBaseView3D(){ 00013 } 00014 //--------------------------------------------------------------------------- 00015 void vtkInteractorStyleBaseView3D::OnRightButtonDown () 00016 { 00017 vtkInteractorStyleBaseView::OnRightButtonDown(); 00018 00019 /* 00020 if (GetInteractor()->GetControlKey()==1 ){ 00021 this->vtkInteractorStyleTrackballCamera::OnRightButtonDown(); 00022 } 00023 */ 00024 this->FindPokedRenderer(this->Interactor->GetEventPosition()[0], 00025 this->Interactor->GetEventPosition()[1]); 00026 00027 if (this->CurrentRenderer == NULL) 00028 { 00029 return; 00030 } 00031 00032 if (this->Interactor->GetControlKey()) { 00033 this->StartDolly(); 00034 } 00035 00036 } 00037 //--------------------------------------------------------------------------- 00038 void vtkInteractorStyleBaseView3D::OnRightButtonUp () 00039 { 00040 vtkInteractorStyleBaseView::OnRightButtonUp(); 00041 00042 /* 00043 if (GetInteractor()->GetControlKey()==1 ){ 00044 this->vtkInteractorStyleTrackballCamera::OnRightButtonUp(); 00045 } 00046 */ 00047 00048 00049 switch (this->State) 00050 { 00051 case VTKIS_DOLLY: 00052 this->EndDolly(); 00053 break; 00054 } 00055 } 00056 //--------------------------------------------------------------------------- 00057 void vtkInteractorStyleBaseView3D::OnMouseMove () 00058 { 00059 vtkInteractorStyleBaseView::OnMouseMove(); 00060 00061 // this->vtkInteractorStyleTrackballCamera::OnMouseMove(); 00062 00063 // int x = this->Interactor->GetEventPosition()[0]; // JPRx 00064 // int y = this->Interactor->GetEventPosition()[1]; // JPRx 00065 00066 00067 // vtkRenderWindowInteractor *rwi = this->Interactor; 00068 00069 // int lx = rwi->GetLastEventPosition()[0]; // JPRx 00070 // int ly = rwi->GetLastEventPosition()[1]; // JPRx 00071 // int dx = rwi->GetEventPosition()[0] ; // JPRx 00072 // int dy = rwi->GetEventPosition()[1] ; // JPRx 00073 00074 00075 switch (this->State) 00076 { 00077 case VTKIS_ROTATE: 00078 // this->FindPokedRenderer(x, y); 00079 this->Rotate(); 00080 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL); 00081 break; 00082 00083 case VTKIS_PAN: 00084 // this->FindPokedRenderer(x, y); 00085 this->Pan(); 00086 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL); 00087 break; 00088 00089 case VTKIS_DOLLY: 00090 // this->FindPokedRenderer(x, y); 00091 this->Dolly(); 00092 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL); 00093 break; 00094 00095 case VTKIS_SPIN: 00096 // this->FindPokedRenderer(x, y); 00097 this->Spin(); 00098 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL); 00099 break; 00100 } 00101 00102 00103 00104 } 00105 //--------------------------------------------------------------------------- 00106 void vtkInteractorStyleBaseView3D::OnLeftButtonDown () 00107 { 00108 vtkInteractorStyleBaseView::OnLeftButtonDown(); 00109 /* 00110 if (GetInteractor()->GetControlKey()==1 ){ 00111 this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown(); 00112 } else { 00113 this->vtkInteractorStyleTrackballCamera::OnLeftButtonDown(); 00114 } 00115 */ 00116 00117 00118 this->FindPokedRenderer(this->Interactor->GetEventPosition()[0], 00119 this->Interactor->GetEventPosition()[1]); 00120 if (this->CurrentRenderer == NULL) 00121 { 00122 return; 00123 } 00124 00125 if (this->Interactor->GetControlKey()) { 00126 this->StartPan(); 00127 } else { 00128 this->StartRotate(); 00129 } 00130 00131 /* 00132 if (this->Interactor->GetShiftKey()) 00133 { 00134 if (this->Interactor->GetControlKey()) 00135 { 00136 this->StartDolly(); 00137 } 00138 else 00139 { 00140 this->StartPan(); 00141 } 00142 } 00143 else 00144 { 00145 if (this->Interactor->GetControlKey()) 00146 { 00147 this->StartSpin(); 00148 } 00149 else 00150 { 00151 this->StartRotate(); 00152 } 00153 } 00154 */ 00155 00156 00157 } 00158 //--------------------------------------------------------------------------- 00159 void vtkInteractorStyleBaseView3D::OnLeftButtonUp () 00160 { 00161 vtkInteractorStyleBaseView::OnLeftButtonUp(); 00162 00163 /* 00164 if (GetInteractor()->GetControlKey()==1 ){ 00165 this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp(); 00166 } else { 00167 this->vtkInteractorStyleTrackballCamera::OnLeftButtonUp(); 00168 } 00169 */ 00170 switch (this->State) 00171 { 00172 00173 case VTKIS_PAN: 00174 this->EndPan(); 00175 break; 00176 00177 case VTKIS_ROTATE: 00178 this->EndRotate(); 00179 break; 00180 } 00181 } 00182 //--------------------------------------------------------------------------- 00183 void vtkInteractorStyleBaseView3D::OnMiddleButtonDown () 00184 { 00185 vtkInteractorStyleBaseView::OnMiddleButtonDown(); 00186 // this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown(); 00187 } 00188 //--------------------------------------------------------------------------- 00189 void vtkInteractorStyleBaseView3D::OnMiddleButtonUp () 00190 { 00191 vtkInteractorStyleBaseView::OnMiddleButtonUp(); 00192 00193 // this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp(); 00194 }