diff --git a/src/src/Common/QGlobals.h b/src/src/Common/QGlobals.h index 52f337a..b7c8163 100644 --- a/src/src/Common/QGlobals.h +++ b/src/src/Common/QGlobals.h @@ -200,13 +200,13 @@ public: EventsCenter::TriggerEvent(AnonymizeStateChanged); } - static bool IsAnno() + static bool GetVisibility() { return annotOn; } - static void toggleAnno() + static void setVisibility(bool v) { - annotOn = !annotOn; + annotOn = v; EventsCenter::TriggerEvent(AnnotationStateChanged); } diff --git a/src/src/Interaction/ActorDraggableInteractorStyle.cpp b/src/src/Interaction/ActorDraggableInteractorStyle.cpp index 04a3905..d7b966e 100644 --- a/src/src/Interaction/ActorDraggableInteractorStyle.cpp +++ b/src/src/Interaction/ActorDraggableInteractorStyle.cpp @@ -211,7 +211,7 @@ void ActorDraggableInteractorStyle::OnChar() { void ActorDraggableInteractorStyle::NoneStatePick() { - if (AnnoHelper::IsAnno()) { + if (AnnoHelper::GetVisibility()) { int *pos = this->Interactor->GetEventPosition(); this->FindPokedRenderer(pos[0], pos[1]); int result = picker->PickProp(pos[0], pos[1], this->CurrentRenderer); diff --git a/src/src/Rendering/Legend/ReferenceLineLegendActor.cpp b/src/src/Rendering/Legend/ReferenceLineLegendActor.cpp index d28668b..53fd57c 100644 --- a/src/src/Rendering/Legend/ReferenceLineLegendActor.cpp +++ b/src/src/Rendering/Legend/ReferenceLineLegendActor.cpp @@ -14,6 +14,8 @@ #include #include +bool ReferenceLineLegendActor::TypeVisibility = true; + vtkStandardNewMacro(ReferenceLineLegendActor) ReferenceLineLegendActor::ReferenceLineLegendActor() { @@ -53,7 +55,7 @@ int ReferenceLineLegendActor::RenderOverlay(vtkViewport *viewport) { auto renderer = vtkRenderer::SafeDownCast(viewport); if (!renderer) return 0; BuildShape(renderer); - if (Visibility){ + if (Visibility && ReferenceLineLegendActor::TypeVisibility){ shadow2D->RenderOverlay(viewport); return actor2D->RenderOverlay(viewport); } diff --git a/src/src/Rendering/Legend/ReferenceLineLegendActor.h b/src/src/Rendering/Legend/ReferenceLineLegendActor.h index b2b2a34..a6800eb 100644 --- a/src/src/Rendering/Legend/ReferenceLineLegendActor.h +++ b/src/src/Rendering/Legend/ReferenceLineLegendActor.h @@ -58,6 +58,14 @@ public: Modified(); } + static bool GetTypeVisibility(){ + return TypeVisibility; + }; + + static void SetTypeVisibility(bool v){ + TypeVisibility = v; + } + protected: ReferenceLineLegendActor(); @@ -73,6 +81,7 @@ private: void operator=(const ReferenceLineLegendActor &) = delete; vtkTimeStamp mModifyTime; + static bool TypeVisibility; }; diff --git a/src/src/Rendering/Viewer/infinitiViewer.cxx b/src/src/Rendering/Viewer/infinitiViewer.cxx index ef3f4d5..4d20aab 100644 --- a/src/src/Rendering/Viewer/infinitiViewer.cxx +++ b/src/src/Rendering/Viewer/infinitiViewer.cxx @@ -1129,7 +1129,7 @@ void infinitiViewer::InitTopLeftCornerInfo(const std::string &lbl_ser_num, const } void infinitiViewer::UpdateCornerInfo(int index) { - if (AnnoHelper::IsAnno()) { + if (AnnoHelper::GetVisibility()) { if (index == TOP_LEFT) { int maxSlice = this->GetSliceMax(); @@ -1167,7 +1167,7 @@ void infinitiViewer::UpdateCornerInfo(int index) { } void infinitiViewer::UpdateCornerInfoAll() { - if (AnnoHelper::IsAnno()) { + if (AnnoHelper::GetVisibility()) { UpdateCornerInfo(TOP_LEFT); UpdateCornerInfo(BOTTOM_RIGHT); UpdateCornerInfo(TOP_RIGHT); @@ -1184,7 +1184,7 @@ void infinitiViewer::UpdateCornerInfoAll() { } void infinitiViewer::UpdateTopLeftCornerInfo() { - if (AnnoHelper::IsAnno()) { + if (AnnoHelper::GetVisibility()) { int maxSlice = this->GetSliceMax(); int currentSlice = this->GetSlice(); std::string msg_const = m_cornerInfo.ConstAnno[TOP_LEFT]; @@ -1334,7 +1334,7 @@ void infinitiViewer::UnActiveReferenceLine() { } void infinitiViewer::RenderLegend() { - if (AnnoHelper::IsAnno()) { + if (AnnoHelper::GetVisibility()) { if (Renderer) { if (rulerActive)ruler->RenderOverlay(Renderer); referenceLine->RenderOverlay(Renderer); diff --git a/src/src/UI/Manager/ImageViewManager.cpp b/src/src/UI/Manager/ImageViewManager.cpp index 56fd7c9..01c367e 100644 --- a/src/src/UI/Manager/ImageViewManager.cpp +++ b/src/src/UI/Manager/ImageViewManager.cpp @@ -514,3 +514,8 @@ void ImageViewManager::reloadCurrentView(DicomImageView * view){ emit currentViewReloaded(view); } +void ImageViewManager::switchReferenceLineVisibility(bool v) { + ReferenceLineLegendActor::SetTypeVisibility(v); + renderAll(); +} + diff --git a/src/src/UI/Manager/ImageViewManager.h b/src/src/UI/Manager/ImageViewManager.h index 6dd3e55..72ed533 100644 --- a/src/src/UI/Manager/ImageViewManager.h +++ b/src/src/UI/Manager/ImageViewManager.h @@ -88,6 +88,8 @@ public: void switchSliceOrientation(); + void switchReferenceLineVisibility(bool v); + void updateCornerInfoAll(); void updateCornerInfoPrivacy(); diff --git a/src/src/UI/Widget/ToolBar/DefaultToolBar.cpp b/src/src/UI/Widget/ToolBar/DefaultToolBar.cpp index 0e6580a..abfaa78 100644 --- a/src/src/UI/Widget/ToolBar/DefaultToolBar.cpp +++ b/src/src/UI/Widget/ToolBar/DefaultToolBar.cpp @@ -280,6 +280,16 @@ void DefaultToolBar::initAnonymizeButton() { mBtnAnonymize->setCheckable(true); QMenu *m; m = new QMenu(this); + //显隐 Annotations + mActionHideAnnotations = m->addAction(tr("Annotations"), this, [=](bool value) { + AnnoHelper::setVisibility(value); + }); + mActionHideAnnotations->setCheckable(true); + mActionHideAnnotations->setChecked(true); + //显隐 reference line + mActionHideReferenceLine = m->addAction(tr("Cross Reference Line"), this, &DefaultToolBar::referenceLineStateChange); + mActionHideReferenceLine->setCheckable(true); + mActionHideReferenceLine->setChecked(true); //视窗操作,显隐测量 mActionHideMeasure = m->addAction(tr("Hide all measurements"), this, [=](bool value) { Measure::SetHidden(mActionHideMeasure->isChecked()); diff --git a/src/src/UI/Widget/ToolBar/DefaultToolBar.h b/src/src/UI/Widget/ToolBar/DefaultToolBar.h index 84a3fd8..27c81de 100644 --- a/src/src/UI/Widget/ToolBar/DefaultToolBar.h +++ b/src/src/UI/Widget/ToolBar/DefaultToolBar.h @@ -39,6 +39,7 @@ signals: void parentWindowClose(); void transform(TransFormType type); void showMeta(); + void referenceLineStateChange(bool isShow); private: QAction *addButton(QToolButton *button, const char *objectName); @@ -90,6 +91,8 @@ private: QAction *mActionClose; QAction *mActionFullScreen; QAction *mActionSyncState; + QAction *mActionHideAnnotations; + QAction *mActionHideReferenceLine; QAction *mActionHideMeasure; QAction *mActionHidePatData; QAction* mSyncActions[3]={nullptr,nullptr,nullptr}; diff --git a/src/src/UI/Window/QDicomViewer.cpp b/src/src/UI/Window/QDicomViewer.cpp index 9b75270..d69ec4b 100644 --- a/src/src/UI/Window/QDicomViewer.cpp +++ b/src/src/UI/Window/QDicomViewer.cpp @@ -116,9 +116,10 @@ void QDicomViewer::createVCRToolbar(DicomImageView *v) { //视窗操作,wwwl void QDicomViewer::initViewOperation() { - // operation mode change + // operation reference line hide and show + connect(ui->toolBar, &DefaultToolBar::referenceLineStateChange, + ui->viewContainer->getViewManager(), &ImageViewManager::switchReferenceLineVisibility); // operation mode change connect(ui->toolBar, &DefaultToolBar::modeChanged, [=](int mode) { - printf("mode:%d\r\n",mode); ui->viewContainer->getViewManager()->setInteractionMode(mode); }); // custom window level