ddt  1.0.0
ddtFileBasedOverlay.hpp
Go to the documentation of this file.
1 
21 #ifndef DDT_DATAVISUALISATION_DDTGRAPHCIS_FILEBASEDOVERLAY_HPP
22 #define DDT_DATAVISUALISATION_DDTGRAPHCIS_FILEBASEDOVERLAY_HPP
23 
24 #define BOOST_BIND_GLOBAL_PLACEHOLDERS
25 
26 #include <QtMath>
27 #include <boost/property_tree/json_parser.hpp>
28 #include <boost/property_tree/ptree.hpp>
29 
32 
33 namespace pt = boost::property_tree;
34 
39  public:
43  explicit DdtFileBasedOverlay();
44 
49 
54  void AddGraphicalElement(DdtGraphicalElement* const element);
55 
60 
65  QList<DdtGraphicalElement*>* GetListOfGraphicalElements();
66 
74  bool LoadOverlayFile(const QString overlay_file,
75  const std::string image_widget_name, QString& error_msg);
76 
80  void ShowOverlay() const;
81 
85  void HideOverlay() const;
86 
91  void ShowOverlayByObject(const QString object_name) const;
92 
97  void HideOverlayByObject(const QString object_name) const;
98 
103  void ShowOverlayByElement(const QString element_name) const;
104 
109  void HideOverlayByElement(const QString element_name) const;
110 
116  std::string ParseElementType(pt::ptree& elem_type);
117 
118  private:
119  bool ParseImageWidget(pt::ptree& image_widget);
120  bool ParseObjectElements(pt::ptree& object);
121  bool GetShow(pt::ptree const& node) const;
122  bool HandleRectangle(pt::ptree const& element, const QString object_name);
123  bool HandleEllipse(pt::ptree const& element, const QString object_name);
124  bool HandleCross(pt::ptree const& element, const QString object_name);
125  bool HandleLine(pt::ptree const& element, const QString object_name);
126  bool HandleText(pt::ptree const& element, const QString object_name);
127  void ReadProperties(pt::ptree const& properties_tree,
128  DdtGraphicalElementProperties& element_properties) const;
129  Qt::GlobalColor CheckColour(const std::string colour) const;
130  QFont::Weight CheckWeight(const std::string weight) const;
131  Qt::PenStyle CheckLineStyle(const std::string line_style) const;
132 
133  QString error_txt;
134  QList<DdtGraphicalElement*> graphical_elements;
135 };
136 
137 #endif // DDT_DATAVISUALISATION_DDTGRAPHCIS_FILEBASEDOVERLAY_HPP
138 
Definition: ddtFileBasedOverlay.hpp:38
void RemoveGraphicalElements()
Definition: ddtFileBasedOverlay.cpp:33
void AddGraphicalElement(DdtGraphicalElement *const element)
Definition: ddtFileBasedOverlay.cpp:27
QList< DdtGraphicalElement * > * GetListOfGraphicalElements()
Definition: ddtFileBasedOverlay.cpp:38
std::string ParseElementType(pt::ptree &elem_type)
Definition: ddtFileBasedOverlay.cpp:138
virtual ~DdtFileBasedOverlay()
void ShowOverlayByObject(const QString object_name) const
Definition: ddtFileBasedOverlay.cpp:619
void ShowOverlayByElement(const QString element_name) const
Definition: ddtFileBasedOverlay.cpp:639
void HideOverlay() const
Definition: ddtFileBasedOverlay.cpp:612
void ShowOverlay() const
Definition: ddtFileBasedOverlay.cpp:605
void HideOverlayByElement(const QString element_name) const
Definition: ddtFileBasedOverlay.cpp:650
void HideOverlayByObject(const QString object_name) const
Definition: ddtFileBasedOverlay.cpp:629
bool LoadOverlayFile(const QString overlay_file, const std::string image_widget_name, QString &error_msg)
Definition: ddtFileBasedOverlay.cpp:42
Definition: ddtGraphicalElementProperties.hpp:29
Definition: ddtGraphicalElement.hpp:89
DDT Graphics. Base Class for the DDT Graphical Elements. Elements can be lines, ovals,...
DDT Graphics. Include file to include all supported graphical element types. Include list for the Gra...