7 #include "uiMeasurement/action/SAddLabeledPoint.hpp" 9 #include <fwCom/Signal.hpp> 10 #include <fwCom/Signal.hxx> 11 #include <fwCom/Signals.hpp> 13 #include <fwCore/base.hpp> 15 #include <fwData/Boolean.hpp> 16 #include <fwData/Point.hpp> 17 #include <fwData/PointList.hpp> 18 #include <fwData/String.hpp> 20 #include <fwDataTools/fieldHelper/Image.hpp> 22 #include <fwGui/dialog/InputDialog.hpp> 23 #include <fwGui/dialog/MessageDialog.hpp> 25 #include <fwServices/macros.hpp> 36 static const ::fwServices::IService::KeyType s_POINTLIST_INOUT =
"pointlist";
40 SAddLabeledPoint::SAddLabeledPoint( ) noexcept :
47 SAddLabeledPoint::~SAddLabeledPoint() noexcept
55 _sstream <<
"Action for remove distance" << std::endl;
61 bool SAddLabeledPoint::defineLabel(std::string& name)
64 name =
"Label" + ::boost::lexical_cast< std::string >(m_count);
66 ::fwData::String::sptr url = ::fwData::String::New();
69 inputDlg.
setMessage(
"Which label for the point?");
71 std::string inputText = inputDlg.
getInput();
73 if(!inputText.empty())
86 ::fwData::PointList::sptr landmarks = this->getInOut< ::fwData::PointList >(s_POINTLIST_INOUT);
90 landmarks = this->getObject< ::fwData::PointList >();
92 SLM_ASSERT(
"landmarks not instanced", landmarks);
95 if ( this->defineLabel(value) )
98 ::fwData::Point::sptr newPoint = ::fwData::Point::New();
101 landmarks->getPoints().push_back( newPoint );
104 ::fwData::String::sptr label = ::fwData::String::New();
105 label->value() = value;
113 sig->asyncEmit(newPoint);
#define FW_DEPRECATED_KEY(newKey, access, version)
Use this macro when deprecating a service key to warn the developer.
FWGUI_API void actionServiceStarting()
Method called when the action service is starting.
Class allowing to block a Connection.
The namespace uiMeasurement contains actions to add/show/remove distances and landmarks.
UIMEASUREMENT_API void stopping() override
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
This action adds labeled point into a PointList.
FWGUI_API void actionServiceStopping()
Method called when the action service is stopping.
Defines the service interface managing the menu items.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_POINT_ADDED_SIG
Signal emitted when a Point is added.
UpdateSlotType::sptr m_slotUpdate
Slot to call update method.
UIMEASUREMENT_API void configuring() override
Configure the service before starting. Apply the configuration to service.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
FWGUI_API void initialize()
Initialize the action.
UIMEASUREMENT_API void info(std::ostream &_sstream) override
Write information in a stream.
This class defines a list of points.
UIMEASUREMENT_API void starting() override
Initialize the service activity.
UIMEASUREMENT_API void updating() override
Perform some computations according to object (this service is attached to) attribute values and its ...