7 #include "scene2D/adaptor/SLine.hpp" 9 #include <fwRenderQt/data/InitQtPen.hpp> 11 #include <fwServices/macros.hpp> 13 #include <QGraphicsItemGroup> 43 const ConfigType config = this->
getConfigTree().get_child(
"config.<xmlattr>");
45 SLM_ASSERT(
"Attribute 'x1' is missing", config.count(
"x1"));
46 SLM_ASSERT(
"Attribute 'x2' is missing", config.count(
"x2"));
47 SLM_ASSERT(
"Attribute 'y1' is missing", config.count(
"y1"));
48 SLM_ASSERT(
"Attribute 'y2' is missing", config.count(
"y2"));
51 m_x1 = config.get<
float>(
"x1");
52 m_x2 = config.get<
float>(
"x2");
53 m_y1 = config.get<
float>(
"y1");
54 m_y2 = config.get<
float>(
"y2");
57 if (config.count(
"color"))
71 QGraphicsLineItem* line =
new QGraphicsLineItem(pt1.first, pt1.second,
72 pt2.first, pt2.second);
77 m_layer->addToGroup(line);
91 m_layer =
new QGraphicsItemGroup();
92 m_pen.setCosmetic(
true);
Root class for all scene2d adaptors.
::fwRenderQt::data::Axis::sptr m_xAxis
The x Axis.
SCENE2D_API void stopping() override
Remove the layer from the scene.
virtual SCENE2D_API ~SLine() noexcept
Basic destructor, do nothing.
Line adaptor. Draw a line on the scene2D.
FWRENDERQT_API Point2DType mapAdaptorToScene(const Point2DType &_xy, const ::fwRenderQt::data::Axis::sptr &_xAxis, const ::fwRenderQt::data::Axis::sptr &_yAxis) const
FWRENDERQT_API std::shared_ptr< ::fwRenderQt::SRender > getScene2DRender() const
Get the render that manages the IAdaptor.
SCENE2D_API SLine() noexcept
Basic constructor, do nothing.
std::pair< double, double > Point2DType
Point2D coordinate <X, Y>
static FWRENDERQT_API void setPenColor(QPen &_pen, std::string _color)
Set a pen a color.
This bundles contains data and services used to display a 2D Qt scene.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
::fwRenderQt::data::Axis::sptr m_yAxis
The y Axis.
FWRENDERQT_API void configureParams()
Parse the xml configuration for Axis, z value and opacity.
SCENE2D_API void starting() override
Initialize the layer and call the draw() function.
SCENE2D_API void configuring() override
Configure the service before starting. Apply the configuration to service.
SCENE2D_API void updating() override
Do nothing.
FWSERVICES_API ConfigType getConfigTree() const
Return the configuration, in an boost property tree.