SwitchViewDirection will remove volume measure.

This commit is contained in:
Krad
2022-11-16 11:21:05 +08:00
parent 01105d0c66
commit 6d70e5d309
4 changed files with 16 additions and 9 deletions

View File

@@ -329,12 +329,12 @@ void VolumeInteractorStyle::MeasurePlace() {
}
void VolumeInteractorStyle::ClearMeasure() {
ActiveMeasure(nullptr);
EndMeasure();
std::for_each(measureStore.begin(), measureStore.end(),[=](Measure* m){
picker->DeletePickList(m->GetProp());
m->ForceDelete();
});
measureStore.clear();
}

View File

@@ -300,7 +300,7 @@ void VolumeRenderingViewer::Render() {
firstRender = false;
RenderWindow->SetDesiredUpdateRate(Interactor->GetDesiredUpdateRate());
Interactor->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr);
SetViewDirection(0);
SwitchViewDirection(0);
this->OrientationMarker->RemoveAllObservers();
this->OrientationMarker->SetInteractor(this->Interactor);
this->OrientationMarker->EnabledOn();
@@ -483,7 +483,7 @@ void VolumeRenderingViewer::SetCoordsTransformMatrix(ExtendMedicalImagePropertie
OrientationMatrix->Invert();
}
void VolumeRenderingViewer::SetViewDirection(int direction) {
void VolumeRenderingViewer::SwitchViewDirection(int direction) {
double position[4] = {.0, .0, .0, 1.};
double ViewUp[4] = {.0, .0, .0, 1.};
switch (direction){
@@ -525,6 +525,10 @@ void VolumeRenderingViewer::SetViewDirection(int direction) {
camera->SetPosition(position);
camera->SetViewUp(ViewUp);
Renderer->ResetCamera();
auto style = VolumeInteractorStyle::SafeDownCast(InteractorStyle);
if (style){
style->ClearMeasure();
}
}
void VolumeRenderingViewer::ResetZoomFitWindow() {
@@ -572,7 +576,10 @@ void VolumeRenderingViewer::ResetZoomFitWindow() {
//use 0.99 to avoid border out of screen
camera->Dolly(0.99/halfDisY);
}
auto style = VolumeInteractorStyle::SafeDownCast(InteractorStyle);
if (style){
style->ClearMeasure();
}
Renderer->ResetCameraClippingRange();
}
@@ -601,7 +608,7 @@ void VolumeRenderingViewer::pressedOrientationMarker(vtkObject* sender, unsigned
auto cube = vtkAnnotatedCubeActor::SafeDownCast(OrientationMarker->GetOrientationMarker());
if (cube){
int v = GetViewDirection(cube,var->ToInt());
SetViewDirection(v);
SwitchViewDirection(v);
Render();
}
}

View File

@@ -78,10 +78,10 @@ public:
void SetInteractorStyleMode(int mode);
void SetViewDirection(int direction);
void SwitchViewDirection(int direction);
void ResetViewDirection(){
SetViewDirection(0);
SwitchViewDirection(0);
}
void ResetView(){

View File

@@ -54,7 +54,7 @@ VolumeRenderingWindow::VolumeRenderingWindow(QWidget *parent , Qt::WindowFlags f
});
connect(toolBar, &VolumeRenderingToolBar::viewDirectionChanged, [=](int direction){
mViewer->SetViewDirection(direction);
mViewer->SwitchViewDirection(direction);
mViewer->Render();
});
}