diff --git a/src/InteractorStyle.cpp b/src/InteractorStyle.cpp index 594e1cf92ac9b157ab3dab079d5180356bf35a89..aacc6efec04bb102cc1bdda02742f655b5be8037 100644 --- a/src/InteractorStyle.cpp +++ b/src/InteractorStyle.cpp @@ -42,6 +42,7 @@ #include "InteractorStyle.h" #include <iostream> +#include <QStringList> using namespace std; @@ -96,6 +97,36 @@ void InteractorStyle::Dolly() vtkInteractorStyleTrackballCamera::Dolly(); } +void InteractorStyle::OnMouseMove() +{ + vtkRenderWindowInteractor *rwi = this->Interactor; + vtkRenderWindow *renderWindow = rwi->GetRenderWindow(); + + int pos[2]={0,0}; + rwi->GetEventPosition(pos); + int pos_x=pos[0]; + int pos_y=pos[1]; + + VTK_CREATE(vtkCoordinate,coordinate); + coordinate->SetCoordinateSystemToDisplay(); + coordinate->SetValue(pos_x,pos_y,0); + double* world = coordinate->GetComputedWorldValue(renderWindow->GetRenderers()->GetFirstRenderer()); + //conversion in metre + world[0]/=100; world[1]/=100; world[2]/=100; + + QString winName=renderWindow->GetWindowName(); + QStringList query = winName.split(" -->") ; + + if(query.size()>1) + { + char tmp[50]; + sprintf(tmp,"--> [ %.2f x %.2f x %.2f ]",world[0],world[1],world[2]); + winName=query[0] +" -->"+QString(tmp); + renderWindow->SetWindowName(winName.toStdString().c_str()); + } + vtkInteractorStyleTrackballCamera::OnMouseMove(); +} + void InteractorStyle::OnChar() { @@ -290,13 +321,10 @@ void InteractorStyle::OnLeftButtonUp() vtkRenderWindowInteractor *rwi = this->Interactor; - int pos_x=0; - int pos_y=0; - //rwi->GetMousePosition(&pos_x, &pos_y); - int pos[2]; + int pos[2] = {0,0}; rwi->GetEventPosition(pos); - pos_x=pos[0]; - pos_y=pos[1]; + int pos_x=pos[0]; + int pos_y=pos[1]; VTK_CREATE(vtkCoordinate,coordinate); coordinate->SetCoordinateSystemToDisplay(); diff --git a/src/InteractorStyle.h b/src/InteractorStyle.h index 7171fb466ad30b7955ca3d0b0a74c9e03b02758a..a780fad5eeef8bed63c2256fc6686879c42c9251 100644 --- a/src/InteractorStyle.h +++ b/src/InteractorStyle.h @@ -59,6 +59,7 @@ public: virtual void Pan(); virtual void Dolly(); virtual void OnLeftButtonUp(); + virtual void OnMouseMove(); diff --git a/src/ThreadVisualisation.cpp b/src/ThreadVisualisation.cpp index 0843f3cfa2f85dde38034a9a980b534ae62dc2f2..6a995229bacc0eb6ba4847cb3737869230356cdb 100644 --- a/src/ThreadVisualisation.cpp +++ b/src/ThreadVisualisation.cpp @@ -351,6 +351,7 @@ void ThreadVisualisation::run() //style->SetKeyPressActivationValue('R'); //style->SetKeyPressActivation(true); + //renderWindow->SetCurrentCursor(VTK_CURSOR_CROSSHAIR); //save the top view camera _topViewCamera=vtkCamera::New(); diff --git a/src/TimerCallback.cpp b/src/TimerCallback.cpp index 97516232c2335e58bbff86a1f22b1c143b710ee2..1b9631bf67294debbe4c72dc78bc64e8d505a404 100644 --- a/src/TimerCallback.cpp +++ b/src/TimerCallback.cpp @@ -206,10 +206,10 @@ void TimerCallback::Execute(vtkObject *caller, unsigned long eventId, winName.append(" [ "); s=QString::number(winSize[0]).toStdString(); winName.append(s); - winName.append("X"); + winName.append(" x "); s=QString::number(winSize[1]).toStdString(); winName.append(s); - winName.append(" ] "); + winName.append(" ] -->"); int posY=winSize[1]*(1.0-30.0/536.0); int posX=winSize[0]*(1.0-450.0/720.0);