Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
LevelBar.hpp
Go to the documentation of this file.
1#ifndef IV_SRC_MIMICS_INDICATORS_LEVELBAR_HPP_
2#define IV_SRC_MIMICS_INDICATORS_LEVELBAR_HPP_
3
5#include "mimics/enums.hpp"
11
13{
14
16{
17public:
18 LevelBar();
19 ~LevelBar() override = default;
20
21 bool load(const iv::file::xml::node &nodeControlMimic) override;
22 bool save(iv::file::xml::node &nodeControlMimic) const override;
23
24 // Controller
25 void getChannels(const std::shared_ptr<std::vector<std::weak_ptr<iv::channels::AbstractChannel>>>
26 &channelsInControl) const override;
27 void mapChannels(const std::function<void(std::weak_ptr<iv::channels::AbstractChannel> &)> &mapFunction) override;
28 [[nodiscard]] std::shared_ptr<iv::mimics::AbstractMimicElement> clone() const override;
29
30 [[nodiscard]] std::optional<iv::mimics::eAlarmState> getAlarmState() const override;
31 [[nodiscard]] std::optional<iv::types::color> getColorWorkingState() const override;
32 [[nodiscard]] std::optional<std::string> getStringWorkingState() const override;
33 void executeCommand(const std::string &strAction) const override;
34
35 // Draw
36 void drawSpecific(IGraphics *graphics, std::optional<iv::types::color> colorWorkingState,
37 std::optional<iv::types::color> colorControlState, iv::eLanguage drawingLanguage) override;
38
39 // UI
41
42private:
43 static constexpr double kPrvRelationXY {6.8};
44
45 LevelBar(const LevelBar &other);
46
47 // Draw functions
49 std::optional<iv::types::color> colorState, IGraphics *graphics, double sizeXFrame,
50 double sizeYFrame, double sizeY) const;
51 void drawLevelLimits(const iv::channels::AnalogAlarmLimits &levelLimits, IGraphics *graphics, double sizeX,
52 double sizeY) const;
53 void drawLevelScale(const iv::channels::AnalogAlarmLimits &levelLimits, IGraphics *graphics,
54 std::optional<iv::types::color> colorState, uint8_t numDecimals, double sizeX,
55 double sizeY) const;
56 void drawLevelValue(bool hasValue, iv::types::channelValue value, std::optional<iv::types::color> colorState,
57 IGraphics *graphics) const;
58
60
61 //Bar
67
68 //Alarm limits indicators
71
72 //Scale
74
75 // View
76 std::unique_ptr<CRectangleGraphics> m_containerGraphic {nullptr};
77 std::unique_ptr<CRectangleGraphics> m_contentGraphic {nullptr};
78 std::unique_ptr<CDiagram> m_scaleGraphic {nullptr};
79
80 struct Keys
81 {
82 static constexpr std::string_view backgroundColor {"BackgroundColor"};
83 static constexpr std::string_view foregroundColor {"ForegroundColor"};
84 static constexpr std::string_view showTextValue {"ShowTextValue"};
85 static constexpr std::string_view textValueHeight {"TextValueHeight"};
86 static constexpr std::string_view valueType {"ValueType"};
87 static constexpr std::string_view showAlarmLimits {"ShowAlarmLimits"};
88 static constexpr std::string_view markType {"MarkType"};
89 static constexpr std::string_view showScale {"ShowScale"};
90 static constexpr std::string_view scaleTextHeight {"ScaleTextHeight"};
91 static constexpr std::string_view scaleColor {"ScaleColor"};
92 static constexpr std::string_view scalePosition {"ScalePosition"};
93 static constexpr std::string_view divisionsNumber {"DivisionsNumber"};
94 static constexpr std::string_view subdivisionsNumber {"SubdivisionsNumber"};
95 static constexpr std::string_view scaleLineWidth {"ScaleLineWidth"};
96 };
98 {
99 static constexpr std::string string {};
102 static constexpr bool showTextValue {false};
103 static constexpr iv::types::height textValueHeight {16};
104 static constexpr std::string valueType {"Raw"};
105 static constexpr bool showAlarmLimits {false};
106 static constexpr std::string markType {"ShortLine"};
107 static constexpr bool showScale {false};
108 static constexpr iv::types::height scaleTextHeight {16};
112 static constexpr uint8_t divisionsNumber {3};
113 static constexpr uint8_t subdivisionsNumber {2};
114 static constexpr iv::types::width scaleLineWidth {1};
115 struct Colors
116 {
118 };
119 };
120 struct Sections
121 {
122 static constexpr std::string_view levelBal {"LevelBar"};
123 static constexpr std::string_view scale {"Scale"};
124 static constexpr std::string_view channel {"LevelChannel"};
125 };
137};
138
139}// namespace iv::mimics::elements
140
141#endif//IV_SRC_MIMICS_INDICATORS_LEVELBAR_HPP_
Definition AbstractComponentGUI.hpp:30
Definition IGraphics.hpp:20
Definition xmlFile.hpp:15
Definition AbstractMimicElement.hpp:21
Definition Channel.hpp:12
Definition LevelBar.hpp:16
std::optional< iv::mimics::eAlarmState > getAlarmState() const override
Definition LevelBar.cpp:161
iv::types::color m_backgroundColor
Definition LevelBar.hpp:62
bool save(iv::file::xml::node &nodeControlMimic) const override
Definition LevelBar.cpp:117
iv::types::color m_foregroundColor
Definition LevelBar.hpp:63
iv::types::height m_textValueHeight
Definition LevelBar.hpp:65
void drawLevelValue(bool hasValue, iv::types::channelValue value, std::optional< iv::types::color > colorState, IGraphics *graphics) const
Definition LevelBar.cpp:530
void executeCommand(const std::string &strAction) const override
Run actions ///.
Definition LevelBar.cpp:205
void drawLevelBar(iv::types::channelValue value, const iv::channels::AnalogAlarmLimits &levelLimits, std::optional< iv::types::color > colorState, IGraphics *graphics, double sizeXFrame, double sizeYFrame, double sizeY) const
Definition LevelBar.cpp:406
void drawLevelScale(const iv::channels::AnalogAlarmLimits &levelLimits, IGraphics *graphics, std::optional< iv::types::color > colorState, uint8_t numDecimals, double sizeX, double sizeY) const
Definition LevelBar.cpp:514
bool m_showAlarmLimits
Definition LevelBar.hpp:69
void getChannels(const std::shared_ptr< std::vector< std::weak_ptr< iv::channels::AbstractChannel > > > &channelsInControl) const override
AƱade los canales que el MimicElement tiene enlazado.
Definition LevelBar.cpp:144
iv::mimics::elements::eMarkType m_markType
Definition LevelBar.hpp:70
std::unique_ptr< CDiagram > m_scaleGraphic
Definition LevelBar.hpp:78
~LevelBar() override=default
std::unique_ptr< CRectangleGraphics > m_contentGraphic
Definition LevelBar.hpp:77
std::shared_ptr< iv::mimics::AbstractMimicElement > clone() const override
Definition LevelBar.cpp:156
iv::mimics::elements::eValueType m_valueType
Definition LevelBar.hpp:66
iv::mimics::support::Scale m_scale
Definition LevelBar.hpp:73
std::unique_ptr< CRectangleGraphics > m_containerGraphic
Definition LevelBar.hpp:76
iv::mimics::Channel m_channel
Definition LevelBar.hpp:59
static constexpr double kPrvRelationXY
Definition LevelBar.hpp:43
AbstractComponentGUI * panelEditControl() override
UI methods ///.
Definition LevelBar.cpp:295
void mapChannels(const std::function< void(std::weak_ptr< iv::channels::AbstractChannel > &)> &mapFunction) override
Processed gets ///.
Definition LevelBar.cpp:151
std::optional< std::string > getStringWorkingState() const override
Definition LevelBar.cpp:195
LevelBar()
Definition LevelBar.cpp:27
bool m_showTextValue
Definition LevelBar.hpp:64
std::optional< iv::types::color > getColorWorkingState() const override
Retrieves the color representing the current working state of the element.
Definition LevelBar.cpp:177
void drawLevelLimits(const iv::channels::AnalogAlarmLimits &levelLimits, IGraphics *graphics, double sizeX, double sizeY) const
Definition LevelBar.cpp:479
void drawSpecific(IGraphics *graphics, std::optional< iv::types::color > colorWorkingState, std::optional< iv::types::color > colorControlState, iv::eLanguage drawingLanguage) override
Draws the specific abstract element shape.
Definition LevelBar.cpp:210
bool load(const iv::file::xml::node &nodeControlMimic) override
Definition LevelBar.cpp:60
constexpr iv::types::color White
Definition color.hpp:222
constexpr iv::types::color ControlAnalogicWarning
Definition color.hpp:425
constexpr iv::types::color ControlAnalogicAlarm
Definition color.hpp:424
constexpr iv::types::color LevelAnalogTankLine
Definition color.hpp:465
constexpr iv::types::color DarkGray
Definition color.hpp:59
Definition enums.hpp:95
eScalePosition
Definition enums.hpp:177
eMarkType
Definition enums.hpp:170
eValueType
Definition enums.hpp:183
double height
Definition types.hpp:14
double channelValue
Definition types.hpp:67
double width
Definition types.hpp:23
uint32_t color
Definition types.hpp:12
eLanguage
Definition enums.hpp:37
Definition structs.hpp:33
static constexpr iv::types::color llal
Definition LevelBar.hpp:131
static constexpr iv::types::color hhal
Definition LevelBar.hpp:134
static constexpr iv::types::color hal
Definition LevelBar.hpp:133
static constexpr iv::types::color lal
Definition LevelBar.hpp:132
static constexpr iv::types::color levelBarEdges
Definition LevelBar.hpp:128
static constexpr iv::types::color text
Definition LevelBar.hpp:117
static constexpr iv::types::height scaleTextHeight
Definition LevelBar.hpp:108
static constexpr iv::types::color foregroundColor
Definition LevelBar.hpp:101
static constexpr bool showAlarmLimits
Definition LevelBar.hpp:105
static constexpr iv::types::height textValueHeight
Definition LevelBar.hpp:103
static constexpr iv::types::color scaleColor
Definition LevelBar.hpp:109
static constexpr std::string valueType
Definition LevelBar.hpp:104
static constexpr iv::types::width scaleLineWidth
Definition LevelBar.hpp:114
static constexpr uint8_t divisionsNumber
Definition LevelBar.hpp:112
static constexpr iv::mimics::elements::eScalePosition scalePosition
Definition LevelBar.hpp:110
static constexpr std::string markType
Definition LevelBar.hpp:106
static constexpr iv::types::color backgroundColor
Definition LevelBar.hpp:100
static constexpr uint8_t subdivisionsNumber
Definition LevelBar.hpp:113
static constexpr bool showTextValue
Definition LevelBar.hpp:102
static constexpr bool showScale
Definition LevelBar.hpp:107
Definition LevelBar.hpp:81
static constexpr std::string_view scaleTextHeight
Definition LevelBar.hpp:90
static constexpr std::string_view scalePosition
Definition LevelBar.hpp:92
static constexpr std::string_view textValueHeight
Definition LevelBar.hpp:85
static constexpr std::string_view showAlarmLimits
Definition LevelBar.hpp:87
static constexpr std::string_view valueType
Definition LevelBar.hpp:86
static constexpr std::string_view scaleColor
Definition LevelBar.hpp:91
static constexpr std::string_view showScale
Definition LevelBar.hpp:89
static constexpr std::string_view divisionsNumber
Definition LevelBar.hpp:93
static constexpr std::string_view scaleLineWidth
Definition LevelBar.hpp:95
static constexpr std::string_view showTextValue
Definition LevelBar.hpp:84
static constexpr std::string_view backgroundColor
Definition LevelBar.hpp:82
static constexpr std::string_view foregroundColor
Definition LevelBar.hpp:83
static constexpr std::string_view markType
Definition LevelBar.hpp:88
static constexpr std::string_view subdivisionsNumber
Definition LevelBar.hpp:94
Definition LevelBar.hpp:121
static constexpr std::string_view channel
Definition LevelBar.hpp:124
static constexpr std::string_view scale
Definition LevelBar.hpp:123
static constexpr std::string_view levelBal
Definition LevelBar.hpp:122
Definition Scale.hpp:14