vtkRenderWindowInteractor *rwi = this->Interactor;
std::string key = rwi->GetKeySym();
+ int ctrlKeyInd = rwi->GetControlKey();
+
+ int altKeyInd = rwi->GetAltKey();
+
+ int shiftKeyInd = rwi->GetShiftKey();
+
// Output the key that was pressed
std::cout << "Pressed " << key << std::endl;
// Handle an arrow key
if (key == "Up")
- {
- contourWidget =
- vtkSmartPointer<vtkContourWidget>::New();
- contourWidget->SetInteractor(interactor);
- contourWidget->SetRepresentation(contourRep);
- contourWidget->On();
-
- std::cout << "add and move points" << std::endl;
- contourWidget->GetEventTranslator()->RemoveTranslation(
- vtkCommand::LeftButtonPressEvent);
- contourWidget->GetEventTranslator()->SetTranslation(
- vtkCommand::LeftButtonPressEvent,
- vtkWidgetEvent::Translate);
-
- //contourWidget->Initialize(pd);
- //contourWidget->Render();
+ {
- //interactor->Initialize();
- //interactor->Start();
- //Interactor->Disable();
+ std::cout << "UP" << std::endl;
+
}
// Handle a "normal" key
if (key == "Down")
{
- std::cout << "Remove points" << std::endl;
- contourWidget->GetEventTranslator()->RemoveTranslation(
- vtkCommand::LeftButtonPressEvent);
- contourWidget->GetEventTranslator()->SetTranslation(
- vtkCommand::LeftButtonPressEvent,
- vtkWidgetEvent::Delete);
+ std::cout << "DOWN" << std::endl;
}
+ if (ctrlKeyInd != 0)
+ {
+ if (key == "z" || key == "Z")
+ {
+ std::cout << "undo" << std::endl;
+
+ }
+
+ if (key == "y" || key == "Y")
+ {
+ std::cout << "redo" << std::endl;
+
+ }
+ }
+
// Forward events
vtkInteractorStyleTrackballCamera::OnKeyPress();
}
vtkSmartPointer<vtkActor>::New();
planeActor->SetMapper(mapper);
- /*vtkSmartPointer<KeyPressInteractorStyle> style =
+ vtkSmartPointer<KeyPressInteractorStyle> style =
vtkSmartPointer<KeyPressInteractorStyle>::New();
- interactor->SetInteractorStyle(style);*/
+ interactor->SetInteractorStyle(style);
// create the contour stuff
vtkSmartPointer<vtkOrientedGlyphContourRepresentation> contourRep =