7 #include "uiMeasurementQt/editor/Distance.hpp" 9 #include <fwCom/Signal.hpp> 10 #include <fwCom/Signal.hxx> 12 #include <fwCore/base.hpp> 14 #include <fwData/Boolean.hpp> 15 #include <fwData/Composite.hpp> 16 #include <fwData/Image.hpp> 17 #include <fwData/String.hpp> 19 #include <fwGuiQt/container/QtContainer.hpp> 21 #include <fwRuntime/ConfigurationElement.hpp> 22 #include <fwRuntime/operations.hpp> 24 #include <fwServices/IService.hpp> 25 #include <fwServices/macros.hpp> 27 #include <boost/filesystem.hpp> 28 #include <boost/filesystem/convenience.hpp> 31 #include <QVBoxLayout> 42 const ::fwCom::Signals::SignalKeyType Distance::s_DISTANCE_REQUESTED_SIG =
"distanceRequested";
48 m_sigDistanceRequested = newSignal< DistanceRequestedSignalType >(s_DISTANCE_REQUESTED_SIG);
63 ::fwGuiQt::container::QtContainer::sptr qtContainer = ::fwGuiQt::container::QtContainer::dynamicCast(
64 this->getContainer() );
66 namespace fs = ::boost::filesystem;
67 fs::path pathImageDist = ::fwRuntime::getBundleResourceFilePath(
"uiMeasurementQt",
"distance.png");
68 OSLM_ASSERT(
"Image "<< pathImageDist <<
"is missing", fs::exists(pathImageDist));
70 QIcon imageDist(QString::fromStdString(pathImageDist.string()));
72 m_distButton =
new QPushButton( imageDist, tr(
""));
73 m_distButton->setToolTip(tr(
"Distance"));
75 QVBoxLayout* layout =
new QVBoxLayout();
76 layout->addWidget( m_distButton, 1 );
77 layout->setContentsMargins(0, 0, 0, 0);
78 QObject::connect(m_distButton, SIGNAL(clicked()),
this, SLOT(
onDistanceButton()));
80 qtContainer->setLayout( layout );
87 QObject::disconnect(m_distButton, SIGNAL(clicked()),
this, SLOT(
onDistanceButton()));
109 ::fwData::Image::sptr image = this->getInOut< ::fwData::Image >(
"image");
110 SLM_ASSERT(
"'image' key is not found.", image);
113 image->setField(
"ShowDistances", ::fwData::Boolean::New(
true));
115 m_sigDistanceRequested->asyncEmit();
void onDistanceButton()
Notify the scene that a distance is added.
#define OSLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
Defines the service interface managing the editor service for object.
FWGUI_API void destroy()
Stops sub-views and toobar services. Destroys view, sub-views and toolbar containers.
UIMEASUREMENTQT_API Distance() noexcept
Constructor. Do nothing.
virtual void starting() override
Install the layout.
virtual void configuring() override
Initialize the widget.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
FWGUI_API void create()
Creates view, sub-views and toolbar containers. Manages sub-views and toobar services.
virtual void updating() override
Do nothing.
virtual void stopping() override
Destroy the layout.
This class defines an image.
virtual UIMEASUREMENTQT_API ~Distance() noexcept override
Destructor. Do nothing.
Distance service is represented by a button. It allows to show distances in a generic scene...
FWGUI_API void initialize()
Initialize managers.