Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
Tank.hpp
Go to the documentation of this file.
1#ifndef IV_SRC_MIMICS_MODEL_INDICATORS_TANK_HPP_
2#define IV_SRC_MIMICS_MODEL_INDICATORS_TANK_HPP_
3
7#include "tanks/Tank.hpp"
9
11{
12
14{
15public:
16 Tank();
17 ~Tank() override = default;
18
19 bool load(const iv::file::xml::node &nodeTank) override;
20 bool save(iv::file::xml::node &nodeTank) const override;
21
22 // Controller
23 void getChannels(const std::shared_ptr<std::vector<std::weak_ptr<iv::channels::AbstractChannel>>>
24 &channelsInControl) const override;
25 void mapChannels(const std::function<void(std::weak_ptr<iv::channels::AbstractChannel> &)> &mapFunction) override;
26 [[nodiscard]] std::shared_ptr<iv::mimics::AbstractMimicElement> clone() const override;
27
28 [[nodiscard]] std::optional<iv::types::color> getColorWorkingState() const override;
29 [[nodiscard]] std::optional<std::string> getStringWorkingState() const override;
30 [[nodiscard]] std::optional<iv::mimics::eAlarmState> getAlarmState() const override;
31 void executeCommand(const std::string &strAction) const override;
32
33 // Draw
34 void drawSpecific(IGraphics *graphics, std::optional<iv::types::color> colorWorkingState,
35 std::optional<iv::types::color> colorControlState, iv::eLanguage drawingLanguage) override;
36
37 // UI
39 void addOptionsMenu(const std::shared_ptr<iv::mimics::MimicControlMenu> &menu) override;
40
41private:
42 static constexpr double kPrvRelationXY {6.8};
43
44 Tank(const Tank &other);
45
46 enum class eInfoLocation
47 {
48 Top,
49 Bottom,
50 Left,
51 Right
52 };
53
54 std::weak_ptr<iv::tanks::Tank> m_tank;
55
56 // Value
66
67 // Colors
70
71 // Scale
73
74 //Alarm limits indicators
77
78 // View
80 std::optional<iv::types::color> colorState, IGraphics *graphics, double sizeXFrame,
81 double sizeYFrame, double sizeY) const;
82 void drawLevelLimits(const iv::channels::AnalogAlarmLimits &levelLimits, IGraphics *graphics, double sizeX,
83 double sizeY) const;
84 void drawLevelScale(const iv::channels::AnalogAlarmLimits &levelLimits, IGraphics *graphics,
85 std::optional<iv::types::color> colorState, uint8_t numDecimals, double sizeX,
86 double sizeY) const;
87 void drawTankInfo(bool hasValue, iv::types::channelValue tankVolumeValue, uint8_t numDecimals,
88 std::optional<iv::types::color> colorState, IGraphics *graphics) const;
89
90 std::unique_ptr<CRectangleGraphics> m_containerGraphic {nullptr};
91 std::unique_ptr<CRectangleGraphics> m_contentGraphic {nullptr};
92 std::unique_ptr<CDiagram> m_scaleGraphic {nullptr};
93
94 struct Keys
95 {
96 static constexpr std::string_view tankName {"TankName"};
97 static constexpr std::string_view locationInfo {"LocationInfo"};
98 static constexpr std::string_view showVolume {"ShowVolume"};
99 static constexpr std::string_view showVolumeInPercent {"ShowVolumeInPercent"};
100 static constexpr std::string_view showVolumeInMeters {"ShowVolumeInMeters"};
101 static constexpr std::string_view showVolumeInLitres {"ShowVolumeInLitres"};
102 static constexpr std::string_view showSounding {"ShowSounding"};
103 static constexpr std::string_view showWeight {"ShowWeight"};
104 static constexpr std::string_view textValueHeight {"TextValueHeight"};
105 static constexpr std::string_view textValuePadding {"TextValuePadding"};
106 static constexpr std::string_view showScale {"ShowScale"};
107 static constexpr std::string_view showAlarmLimits {"ShowAlarmLimits"};
108 static constexpr std::string_view markType {"MarkType"};
109 static constexpr std::string_view backgroundColor {"BackgroundColor"};
110 static constexpr std::string_view contentColor {"ContentColor"};
111 };
113 {
114 static constexpr std::string string {};
115 static constexpr std::string locationInfo {"Right"};
116
117 static constexpr bool showVolume {false};
118 static constexpr bool showVolumeInPercent {false};
119 static constexpr bool showVolumeInMeters {false};
120 static constexpr bool showVolumeInLitres {false};
121 static constexpr bool showSounding {false};
122 static constexpr bool showWeight {false};
123 static constexpr iv::types::height textValueHeight {16};
125 static constexpr bool showScale {false};
126 static constexpr bool showAlarmLimits {true};
128 static constexpr auto backgroundColor {iv::color::DarkGray};
129 static constexpr auto contentColor {iv::color::Blue};
130 struct Colors
131 {
133 };
134 };
135 struct Sections
136 {
137 static constexpr std::string_view tankIndicator {"TankIndicator"};
138 static constexpr std::string_view scale {"Scale"};
139 };
151};
152
153}// namespace iv::mimics::elements
154
155#endif//IV_SRC_MIMICS_MODEL_INDICATORS_TANK_HPP_
Definition AbstractComponentGUI.hpp:30
Definition IGraphics.hpp:20
Definition xmlFile.hpp:15
Definition AbstractMimicElement.hpp:21
Definition Tank.hpp:14
bool save(iv::file::xml::node &nodeTank) const override
Definition Tank.cpp:125
static constexpr double kPrvRelationXY
Definition Tank.hpp:42
std::shared_ptr< iv::mimics::AbstractMimicElement > clone() const override
Definition Tank.cpp:207
std::weak_ptr< iv::tanks::Tank > m_tank
Definition Tank.hpp:54
iv::types::color m_contentColor
Definition Tank.hpp:69
std::optional< iv::types::color > getColorWorkingState() const override
Retrieves the color representing the current working state of the element.
Definition Tank.cpp:212
std::optional< std::string > getStringWorkingState() const override
Definition Tank.cpp:234
std::unique_ptr< CRectangleGraphics > m_contentGraphic
Definition Tank.hpp:91
iv::types::color m_backgroundColor
Definition Tank.hpp:68
iv::mimics::elements::eMarkType m_markType
Definition Tank.hpp:76
iv::types::padding m_textInfoPadding
Definition Tank.hpp:65
void mapChannels(const std::function< void(std::weak_ptr< iv::channels::AbstractChannel > &)> &mapFunction) override
Processed gets ///.
Definition Tank.cpp:193
eInfoLocation
Definition Tank.hpp:47
bool load(const iv::file::xml::node &nodeTank) override
Definition Tank.cpp:76
bool m_showAlarmLimits
Definition Tank.hpp:75
std::optional< iv::mimics::eAlarmState > getAlarmState() const override
Definition Tank.cpp:244
iv::types::height m_textInfoHeight
Definition Tank.hpp:64
iv::mimics::elements::Tank::eInfoLocation m_locationInfo
Definition Tank.hpp:57
~Tank() override=default
void drawLevelScale(const iv::channels::AnalogAlarmLimits &levelLimits, IGraphics *graphics, std::optional< iv::types::color > colorState, uint8_t numDecimals, double sizeX, double sizeY) const
Definition Tank.cpp:647
void drawLevelLimits(const iv::channels::AnalogAlarmLimits &levelLimits, IGraphics *graphics, double sizeX, double sizeY) const
Definition Tank.cpp:612
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 Tank.cpp:268
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 Tank.cpp:168
void executeCommand(const std::string &strAction) const override
Run actions ///.
Definition Tank.cpp:263
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 Tank.cpp:539
bool m_showVolumeInPercent
Definition Tank.hpp:59
bool m_showVolumeInMetersCubics
Definition Tank.hpp:60
bool m_showVolume
Definition Tank.hpp:58
Tank()
Definition Tank.cpp:24
bool m_showVolumeInLitres
Definition Tank.hpp:61
std::unique_ptr< CDiagram > m_scaleGraphic
Definition Tank.hpp:92
iv::mimics::support::Scale m_scale
Definition Tank.hpp:72
void drawTankInfo(bool hasValue, iv::types::channelValue tankVolumeValue, uint8_t numDecimals, std::optional< iv::types::color > colorState, IGraphics *graphics) const
Definition Tank.cpp:663
std::unique_ptr< CRectangleGraphics > m_containerGraphic
Definition Tank.hpp:90
void addOptionsMenu(const std::shared_ptr< iv::mimics::MimicControlMenu > &menu) override
Definition Tank.cpp:522
bool m_showWeight
Definition Tank.hpp:62
bool m_showSounding
Definition Tank.hpp:63
AbstractComponentGUI * panelEditControl() override
UI methods ///.
Definition Tank.cpp:368
constexpr iv::types::color Blue
Definition color.hpp:23
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
eMarkType
Definition enums.hpp:170
double height
Definition types.hpp:14
double channelValue
Definition types.hpp:67
double padding
Definition types.hpp:16
uint32_t color
Definition types.hpp:12
eLanguage
Definition enums.hpp:37
Definition structs.hpp:33
static constexpr iv::types::color hhal
Definition Tank.hpp:148
static constexpr iv::types::color lal
Definition Tank.hpp:146
static constexpr iv::types::color hal
Definition Tank.hpp:147
static constexpr iv::types::color llal
Definition Tank.hpp:145
static constexpr iv::types::color tankEdges
Definition Tank.hpp:142
static constexpr iv::types::color text
Definition Tank.hpp:132
static constexpr std::string locationInfo
Definition Tank.hpp:115
static constexpr bool showScale
Definition Tank.hpp:125
static constexpr bool showVolumeInMeters
Definition Tank.hpp:119
static constexpr bool showVolumeInPercent
Definition Tank.hpp:118
static constexpr auto contentColor
Definition Tank.hpp:129
static constexpr auto backgroundColor
Definition Tank.hpp:128
static constexpr iv::types::height textValueHeight
Definition Tank.hpp:123
static constexpr auto markType
Definition Tank.hpp:127
static constexpr bool showSounding
Definition Tank.hpp:121
static constexpr iv::types::padding textValuePadding
Definition Tank.hpp:124
static constexpr bool showAlarmLimits
Definition Tank.hpp:126
static constexpr bool showWeight
Definition Tank.hpp:122
static constexpr bool showVolume
Definition Tank.hpp:117
static constexpr bool showVolumeInLitres
Definition Tank.hpp:120
Definition Tank.hpp:95
static constexpr std::string_view showSounding
Definition Tank.hpp:102
static constexpr std::string_view showVolume
Definition Tank.hpp:98
static constexpr std::string_view showVolumeInPercent
Definition Tank.hpp:99
static constexpr std::string_view tankName
Definition Tank.hpp:96
static constexpr std::string_view showVolumeInMeters
Definition Tank.hpp:100
static constexpr std::string_view showWeight
Definition Tank.hpp:103
static constexpr std::string_view backgroundColor
Definition Tank.hpp:109
static constexpr std::string_view showScale
Definition Tank.hpp:106
static constexpr std::string_view contentColor
Definition Tank.hpp:110
static constexpr std::string_view showVolumeInLitres
Definition Tank.hpp:101
static constexpr std::string_view markType
Definition Tank.hpp:108
static constexpr std::string_view showAlarmLimits
Definition Tank.hpp:107
static constexpr std::string_view locationInfo
Definition Tank.hpp:97
static constexpr std::string_view textValueHeight
Definition Tank.hpp:104
static constexpr std::string_view textValuePadding
Definition Tank.hpp:105
static constexpr std::string_view tankIndicator
Definition Tank.hpp:137
static constexpr std::string_view scale
Definition Tank.hpp:138
Definition Scale.hpp:14