| 813 | } |
| 814 | |
| 815 | void vtkSplineWidget::OnMouseMove() |
| 816 | { |
| 817 | // See whether we're active |
| 818 | if (this->State == vtkSplineWidget::Outside || this->State == vtkSplineWidget::Start) |
| 819 | { |
| 820 | return; |
| 821 | } |
| 822 | |
| 823 | int X = this->Interactor->GetEventPosition()[0]; |
| 824 | int Y = this->Interactor->GetEventPosition()[1]; |
| 825 | |
| 826 | // Do different things depending on state |
| 827 | // Calculations everybody does |
| 828 | double focalPoint[4], pickPoint[4], prevPickPoint[4]; |
| 829 | double z, vpn[3]; |
| 830 | |
| 831 | vtkCamera* camera = this->CurrentRenderer->GetActiveCamera(); |
| 832 | if (!camera) |
| 833 | { |
| 834 | return; |
| 835 | } |
| 836 | |
| 837 | // Compute the two points defining the motion vector |
| 838 | this->ComputeWorldToDisplay( |
| 839 | this->LastPickPosition[0], this->LastPickPosition[1], this->LastPickPosition[2], focalPoint); |
| 840 | z = focalPoint[2]; |
| 841 | this->ComputeDisplayToWorld(double(this->Interactor->GetLastEventPosition()[0]), |
| 842 | double(this->Interactor->GetLastEventPosition()[1]), z, prevPickPoint); |
| 843 | this->ComputeDisplayToWorld(double(X), double(Y), z, pickPoint); |
| 844 | |
| 845 | // Process the motion |
| 846 | if (this->State == vtkSplineWidget::Moving) |
| 847 | { |
| 848 | // Okay to process |
| 849 | if (this->CurrentHandle) |
| 850 | { |
| 851 | this->MovePoint(prevPickPoint, pickPoint); |
| 852 | } |
| 853 | else // Must be moving the spline |
| 854 | { |
| 855 | this->Translate(prevPickPoint, pickPoint); |
| 856 | } |
| 857 | } |
| 858 | else if (this->State == vtkSplineWidget::Scaling) |
| 859 | { |
| 860 | this->Scale(prevPickPoint, pickPoint, X, Y); |
| 861 | } |
| 862 | else if (this->State == vtkSplineWidget::Spinning) |
| 863 | { |
| 864 | camera->GetViewPlaneNormal(vpn); |
| 865 | this->Spin(prevPickPoint, pickPoint, vpn); |
| 866 | } |
| 867 | |
| 868 | if (this->ProjectToPlane) |
| 869 | { |
| 870 | this->ProjectPointsToPlane(); |
| 871 | } |
| 872 |
no test coverage detected