diff --git a/Modules/Core/include/mitkStatusBar.h b/Modules/Core/include/mitkStatusBar.h index 5361021c38..16a5edab5c 100755 --- a/Modules/Core/include/mitkStatusBar.h +++ b/Modules/Core/include/mitkStatusBar.h @@ -1,91 +1,92 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef MITKSTATUSBAR_H #define MITKSTATUSBAR_H #include "mitkStatusBarImplementation.h" #include #include #include +#include #include namespace mitk { //##Documentation //## @brief Sending a message to the applications StatusBar //## //## Holds a GUI dependent StatusBarImplementation and sends the text further. //## nearly equal to itk::OutputWindow, //## no Window, but one line of text and a delay for clear. //## all mitk-classes use this class to display text on GUI-StatusBar. //## The mainapplication has to set the internal held StatusBarImplementation with SetInstance(..). //## @ingroup Interaction class MITKCORE_EXPORT StatusBar : public itk::Object { public: itkTypeMacro(StatusBar, itk::Object); //##Documentation //## @brief static method to get the GUI dependent StatusBar-instance //## so the methods DisplayText, etc. can be called //## No reference counting, cause of decentral static use! static StatusBar *GetInstance(); //##Documentation //## @brief Supply a GUI- dependent StatusBar. Has to be set by the application //## to connect the application dependent subclass of mitkStatusBar //## if you create an instance, then call ->Delete() on the supplied //## instance after setting it. static void SetImplementation(StatusBarImplementation *instance); //##Documentation //## @brief Send a string to the applications StatusBar void DisplayText(const char *t); //##Documentation //## @brief Send a string with a time delay to the applications StatusBar void DisplayText(const char *t, int ms); void DisplayErrorText(const char *t); void DisplayWarningText(const char *t); void DisplayWarningText(const char *t, int ms); void DisplayGenericOutputText(const char *t); void DisplayDebugText(const char *t); void DisplayGreyValueText(const char *t); //##Documentation - void DisplayRendererInfo(Point3D point, ScalarType time); + void DisplayRendererInfo(Point3D point, TimePointType time); //## @brief Display position, index, time and pixel value - void DisplayImageInfo(Point3D point, itk::Index<3> index, ScalarType time, ScalarType pixelValue); + void DisplayImageInfo(Point3D point, itk::Index<3> index, TimePointType time, ScalarType pixelValue); //## @brief Display rotation, index, time and custom pixel value - void DisplayImageInfo(Point3D point, itk::Index<3> index, ScalarType time, const char* pixelValue); + void DisplayImageInfo(Point3D point, itk::Index<3> index, TimePointType time, const char* pixelValue); //## @brief Display placeholder text for invalid information void DisplayImageInfoInvalid(); //##Documentation //## @brief removes any temporary message being shown. void Clear(); //##Documentation //## @brief Set the SizeGrip of the window //## (the triangle in the lower right Windowcorner for changing the size) //## to enabled or disabled void SetSizeGripEnabled(bool enable); protected: StatusBar(); ~StatusBar() override; static StatusBarImplementation *m_Implementation; static StatusBar *m_Instance; }; } // end namespace mitk #endif /* define MITKSTATUSBAR_H */ diff --git a/Modules/Core/src/Controllers/mitkStatusBar.cpp b/Modules/Core/src/Controllers/mitkStatusBar.cpp index 4fd8779472..66bae1893c 100755 --- a/Modules/Core/src/Controllers/mitkStatusBar.cpp +++ b/Modules/Core/src/Controllers/mitkStatusBar.cpp @@ -1,189 +1,189 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkStatusBar.h" #include #include namespace mitk { StatusBarImplementation *StatusBar::m_Implementation = nullptr; StatusBar *StatusBar::m_Instance = nullptr; /** * Display the text in the statusbar of the application */ void StatusBar::DisplayText(const char *t) { if (m_Implementation != nullptr) m_Implementation->DisplayText(t); } /** * Display the text in the statusbar of the application for ms seconds */ void StatusBar::DisplayText(const char *t, int ms) { if (m_Implementation != nullptr) m_Implementation->DisplayText(t, ms); } void StatusBar::DisplayErrorText(const char *t) { if (m_Implementation != nullptr) m_Implementation->DisplayErrorText(t); } void StatusBar::DisplayWarningText(const char *t) { if (m_Implementation != nullptr) m_Implementation->DisplayWarningText(t); } void StatusBar::DisplayWarningText(const char *t, int ms) { if (m_Implementation != nullptr) m_Implementation->DisplayWarningText(t, ms); } void StatusBar::DisplayGenericOutputText(const char *t) { if (m_Implementation != nullptr) m_Implementation->DisplayGenericOutputText(t); } void StatusBar::DisplayDebugText(const char *t) { if (m_Implementation != nullptr) m_Implementation->DisplayDebugText(t); } void StatusBar::DisplayGreyValueText(const char *t) { if (m_Implementation != nullptr) m_Implementation->DisplayGreyValueText(t); } - static void WriteCommonRendererInfo(std::ostringstream& stream, Point3D point, ScalarType time) + static void WriteCommonRendererInfo(std::ostringstream& stream, Point3D point, TimePointType time) { stream << "Position: <" << std::fixed << point[0] << ", " << std::fixed << point[1] << ", " << std::fixed << point[2] << "> mm; "; stream << "Time: " << time << " ms"; } - static void WriteCommonImageInfo(std::ostringstream& stream, Point3D point, itk::Index<3> index, ScalarType time) + static void WriteCommonImageInfo(std::ostringstream& stream, Point3D point, itk::Index<3> index, TimePointType time) { stream << "Position: <" << std::fixed << point[0] << ", " << std::fixed << point[1] << ", " << std::fixed << point[2] << "> mm; "; stream << "Index: <" << index[0] << ", " << index[1] << ", " << index[2] << "> ; "; stream << "Time: " << time << " ms"; } - void StatusBar::DisplayRendererInfo(Point3D point, ScalarType time) + void StatusBar::DisplayRendererInfo(Point3D point, TimePointType time) { if (m_Implementation == nullptr) return; std::ostringstream stream; stream.imbue(std::locale::classic()); stream.precision(2); WriteCommonRendererInfo(stream, point, time); m_Implementation->DisplayGreyValueText(stream.str().c_str()); } - void StatusBar::DisplayImageInfo(Point3D point, itk::Index<3> index, ScalarType time, ScalarType pixelValue) + void StatusBar::DisplayImageInfo(Point3D point, itk::Index<3> index, TimePointType time, ScalarType pixelValue) { if (m_Implementation == nullptr) return; std::ostringstream stream; stream.imbue(std::locale::classic()); stream.precision(2); WriteCommonImageInfo(stream, point, index, time); stream << "; Pixel value: "; if (fabs(pixelValue) > 1000000 || fabs(pixelValue) < 0.01) stream << std::scientific; stream << pixelValue; m_Implementation->DisplayGreyValueText(stream.str().c_str()); } - void StatusBar::DisplayImageInfo(Point3D point, itk::Index<3> index, ScalarType time, const char* pixelValue) + void StatusBar::DisplayImageInfo(Point3D point, itk::Index<3> index, TimePointType time, const char* pixelValue) { if (m_Implementation == nullptr) return; std::ostringstream stream; stream.imbue(std::locale::classic()); stream.precision(2); WriteCommonImageInfo(stream, point, index, time); stream << "; " << pixelValue; m_Implementation->DisplayGreyValueText(stream.str().c_str()); } void StatusBar::DisplayImageInfoInvalid() { if (m_Implementation != nullptr) m_Implementation->DisplayGreyValueText("No image information at this position!"); } void StatusBar::Clear() { if (m_Implementation != nullptr) m_Implementation->Clear(); } void StatusBar::SetSizeGripEnabled(bool enable) { if (m_Implementation != nullptr) { m_Implementation->SetSizeGripEnabled(enable); } } /** * Get the instance of this StatusBar */ StatusBar *StatusBar::GetInstance() { if (m_Instance == nullptr) // if not set, then send a errormessage on OutputWindow { m_Instance = new StatusBar(); } return m_Instance; } /** * Set an instance of this; application must do this!See Header! */ void StatusBar::SetImplementation(StatusBarImplementation *implementation) { if (m_Implementation == implementation) { return; } m_Implementation = implementation; } StatusBar::StatusBar() {} StatusBar::~StatusBar() {} } // end namespace mitk