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

Method OnMouseMove

Interaction/Widgets/vtkBrokenLineWidget.cxx:758–822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

756}
757
758void vtkBrokenLineWidget::OnMouseMove()
759{
760 // See whether we're active
761 if (this->State == vtkBrokenLineWidget::Outside || this->State == vtkBrokenLineWidget::Start)
762 {
763 return;
764 }
765
766 int X = this->Interactor->GetEventPosition()[0];
767 int Y = this->Interactor->GetEventPosition()[1];
768
769 // Do different things depending on state
770 // Calculations everybody does
771 double focalPoint[4], pickPoint[4], prevPickPoint[4];
772 double z, vpn[3];
773
774 vtkCamera* camera = this->CurrentRenderer->GetActiveCamera();
775 if (!camera)
776 {
777 return;
778 }
779
780 // Compute the two points defining the motion vector
781 this->ComputeWorldToDisplay(
782 this->LastPickPosition[0], this->LastPickPosition[1], this->LastPickPosition[2], focalPoint);
783 z = focalPoint[2];
784 this->ComputeDisplayToWorld(double(this->Interactor->GetLastEventPosition()[0]),
785 double(this->Interactor->GetLastEventPosition()[1]), z, prevPickPoint);
786 this->ComputeDisplayToWorld(double(X), double(Y), z, pickPoint);
787
788 // Process the motion
789 if (this->State == vtkBrokenLineWidget::Moving)
790 {
791 // Okay to process
792 if (this->CurrentHandle)
793 {
794 this->MovePoint(prevPickPoint, pickPoint);
795 }
796 else // Must be moving the spline
797 {
798 this->Translate(prevPickPoint, pickPoint);
799 }
800 }
801 else if (this->State == vtkBrokenLineWidget::Scaling)
802 {
803 this->Scale(prevPickPoint, pickPoint, X, Y);
804 }
805 else if (this->State == vtkBrokenLineWidget::Spinning)
806 {
807 camera->GetViewPlaneNormal(vpn);
808 this->Spin(prevPickPoint, pickPoint, vpn);
809 }
810
811 if (this->ProjectToPlane)
812 {
813 this->ProjectPointsToPlane();
814 }
815

Callers 1

ProcessEventsHandlerMethod · 0.95

Calls 11

MovePointMethod · 0.95
TranslateMethod · 0.95
ScaleMethod · 0.95
SpinMethod · 0.95
ProjectPointsToPlaneMethod · 0.95
BuildRepresentationMethod · 0.95
GetActiveCameraMethod · 0.80
ComputeWorldToDisplayMethod · 0.80
ComputeDisplayToWorldMethod · 0.80
InvokeEventMethod · 0.80
RenderMethod · 0.65

Tested by

no test coverage detected