MCPcopy Create free account
hub / github.com/Kitware/VTK / ProcessKeyEvents

Method ProcessKeyEvents

Interaction/Widgets/vtkCamera3DWidget.cxx:202–271  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

200
201//------------------------------------------------------------------------------
202void vtkCamera3DWidget::ProcessKeyEvents(vtkObject*, unsigned long event, void* clientdata, void*)
203{
204 vtkCamera3DWidget* self = static_cast<vtkCamera3DWidget*>(clientdata);
205 vtkCamera3DRepresentation* rep = vtkCamera3DRepresentation::SafeDownCast(self->WidgetRep);
206 char* cKeySym = self->Interactor->GetKeySym();
207 std::string keySym = cKeySym != nullptr ? cKeySym : "";
208 std::transform(keySym.begin(), keySym.end(), keySym.begin(), ::toupper);
209 if (event == vtkCommand::KeyPressEvent)
210 {
211 if (keySym == "X")
212 {
213 if (rep->GetTranslationAxis() == vtkWidgetRepresentation::XAxis)
214 {
215 rep->SetTranslationAxisToNone();
216 }
217 else
218 {
219 rep->SetTranslationAxisToXAxis();
220 }
221 }
222 else if (keySym == "Y")
223 {
224 if (rep->GetTranslationAxis() == vtkWidgetRepresentation::YAxis)
225 {
226 rep->SetTranslationAxisToNone();
227 }
228 else
229 {
230 rep->SetTranslationAxisToYAxis();
231 }
232 }
233 else if (keySym == "Z")
234 {
235 if (rep->GetTranslationAxis() == vtkWidgetRepresentation::ZAxis)
236 {
237 rep->SetTranslationAxisToNone();
238 }
239 else
240 {
241 rep->SetTranslationAxisToZAxis();
242 }
243 }
244 else if (keySym == "O")
245 {
246 rep->SetTranslationAxisToNone();
247 }
248 else if (keySym == "A")
249 {
250 if (rep->GetTranslatingAll())
251 {
252 rep->TranslatingAllOff();
253 }
254 else
255 {
256 rep->TranslatingAllOn();
257 }
258 }
259 else if (keySym == "C")

Callers

nothing calls this directly

Calls 4

GetKeySymMethod · 0.80
transformFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected