Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
BreakerPms.hpp
Go to the documentation of this file.
1#ifndef IV_SRC_MIMICS_MODEL_ELEMENTSPMS_BREAKERPMS_HPP_
2#define IV_SRC_MIMICS_MODEL_ELEMENTSPMS_BREAKERPMS_HPP_
3
14
16{
17
25{
26public:
27 BreakerPms();
28 ~BreakerPms() override = default;
29
30 bool load(const iv::file::xml::node &nodeControlMimic) override;
31 bool save(iv::file::xml::node &nodeControlMimic) const override;
32
33 // Controller
34 void getChannels(const std::shared_ptr<std::vector<std::weak_ptr<iv::channels::AbstractChannel>>>
35 &channelsInControl) const override;
36 [[nodiscard]] std::shared_ptr<iv::mimics::AbstractMimicElement> clone() const override;
37 void executeCommand(const std::string &strAction) const override;
38
39 [[nodiscard]] std::optional<iv::types::color> getColorWorkingState() const override;
40 [[nodiscard]] std::optional<std::string> getStringWorkingState() const override;
41 [[nodiscard]] std::optional<std::string> getStringControlState() const override;
42 [[nodiscard]] std::optional<iv::mimics::eAlarmState> getAlarmState() const override;
43
44 // Draw
45 void drawSpecific(IGraphics *graphics, std::optional<iv::types::color> colorWorkingState,
46 std::optional<iv::types::color> colorControlState, iv::eLanguage drawingLanguage) override;
47
48 // UI
50 void addOptionsMenu(const std::shared_ptr<iv::mimics::MimicControlMenu> &menu) override;
51
52 bool canShowCircularMenu() const override;
53 bool hasAlternativeAction() const override;
54 void runAlternativeAction(CDialog *dlgFatherRef) override;
55
56 void setGenerator(const std::weak_ptr<iv::model::pms::Generator> &generator);
57 void changeHeight(const iv::types::height &height);
58
59protected:
60 BreakerPms(const BreakerPms &other);
61
62 bool checkIntegrity() const override;
63 bool hasRepeatedChannels(const std::unordered_set<iv::types::channelId> &channelsRepeatedOpt) const override;
64 bool
65 isRepeatedMimicElement(const std::set<std::shared_ptr<AbstractMimicElement>> &otherMimicsElements) const override;
66
67 // Draw functions
68 void drawBreaker(IGraphics *graphics, iv::types::color colorWorkingState) const;
69 void drawLimitCircles(IGraphics *graphics, iv::types::color colorWorkingState) const;
70 void drawLocalRemote(IGraphics *graphics) const;
71
73
74 std::weak_ptr<iv::model::pms::Generator> m_pmsGenerator;
75
76private:
77 std::unique_ptr<CRectangleGraphics> m_rectangleOpt {nullptr};
78 std::unique_ptr<CRectangleGraphics> m_topLimitCircle {nullptr};
79 std::unique_ptr<CRectangleGraphics> m_bottomLimitCircle {nullptr};
80
81 struct Constants
82 {
96 {
97 static constexpr iv::types::height height {70};
98 static constexpr double widthProportion {50. / 70.};
99 static constexpr double arcWidth {0.08};
100 static constexpr iv::types::degree arcStart {225};
101 static constexpr iv::types::degree arcEnd {-45};
102 static constexpr double powerTextOffset {0.10};
103 static constexpr double powerTextSize {0.20};
104 static constexpr double powerUnitTextSize {0.1};
105 static constexpr double frequencyTextSize {0.15};
106 static constexpr double frequencyUnitTextSize {0.1};
107 static constexpr double priorityTextSize {0.10};
108 static constexpr double breakerNameTextSize {0.15};
109 };
110 struct Paddings
111 {
112 static constexpr iv::types::width powerUnitPadding {2};
114 };
115 };
130 struct Keys
131 {
132 static constexpr std::string_view breaker {"Breaker"};
133 static constexpr std::string_view breakerNameColor {"BreakerNameColor"};
134 };
135 struct Sections
136 {
137 static constexpr std::string_view breaker {"Breaker"};
138 };
139};
140
141}// namespace iv::mimics::elementsPms
142
143#endif//IV_SRC_MIMICS_MODEL_ELEMENTSPMS_BREAKERPMS_HPP_
Definition AbstractComponentGUI.hpp:30
Definition CDialog.hpp:21
Definition IGraphics.hpp:20
Definition xmlFile.hpp:15
Definition AbstractMimicElement.hpp:21
Definition BreakerPms.hpp:25
void setGenerator(const std::weak_ptr< iv::model::pms::Generator > &generator)
Definition BreakerPms.cpp:443
std::unique_ptr< CRectangleGraphics > m_bottomLimitCircle
Definition BreakerPms.hpp:79
void executeCommand(const std::string &strAction) const override
Run actions ///.
Definition BreakerPms.cpp:82
std::optional< iv::mimics::eAlarmState > getAlarmState() const override
Definition BreakerPms.cpp:136
std::weak_ptr< iv::model::pms::Generator > m_pmsGenerator
Definition BreakerPms.hpp:74
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 BreakerPms.cpp:170
std::optional< std::string > getStringControlState() const override
Definition BreakerPms.cpp:129
bool isRepeatedMimicElement(const std::set< std::shared_ptr< AbstractMimicElement > > &otherMimicsElements) const override
Determines whether the current mimic element shares significant similarities with others.
Definition BreakerPms.cpp:464
std::optional< iv::types::color > getColorWorkingState() const override
Retrieves the color representing the current working state of the element.
Definition BreakerPms.cpp:86
void runAlternativeAction(CDialog *dlgFatherRef) override
Ejecuta código específico del control.
Definition BreakerPms.cpp:294
bool hasAlternativeAction() const override
Definition BreakerPms.cpp:272
void addOptionsMenu(const std::shared_ptr< iv::mimics::MimicControlMenu > &menu) override
Definition BreakerPms.cpp:264
std::unique_ptr< CRectangleGraphics > m_rectangleOpt
Definition BreakerPms.hpp:77
bool hasRepeatedChannels(const std::unordered_set< iv::types::channelId > &channelsRepeatedOpt) const override
Checks if the current mimic element contains any repeated channels.
Definition BreakerPms.cpp:459
bool load(const iv::file::xml::node &nodeControlMimic) override
Definition BreakerPms.cpp:34
void drawLimitCircles(IGraphics *graphics, iv::types::color colorWorkingState) const
Definition BreakerPms.cpp:510
std::shared_ptr< iv::mimics::AbstractMimicElement > clone() const override
Definition BreakerPms.cpp:77
void changeHeight(const iv::types::height &height)
Definition BreakerPms.cpp:448
bool save(iv::file::xml::node &nodeControlMimic) const override
Definition BreakerPms.cpp:52
AbstractComponentGUI * panelEditControl() override
UI methods ///.
Definition BreakerPms.cpp:204
void drawLocalRemote(IGraphics *graphics) const
Definition BreakerPms.cpp:535
bool canShowCircularMenu() const override
Behaviours gets ///.
Definition BreakerPms.cpp:268
std::unique_ptr< CRectangleGraphics > m_topLimitCircle
Definition BreakerPms.hpp:78
BreakerPms()
Definition BreakerPms.cpp:20
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 BreakerPms.cpp:66
void drawBreaker(IGraphics *graphics, iv::types::color colorWorkingState) const
Definition BreakerPms.cpp:489
void updateBreakerTraits()
Definition BreakerPms.cpp:574
std::optional< std::string > getStringWorkingState() const override
Definition BreakerPms.cpp:122
bool checkIntegrity() const override
Definition BreakerPms.cpp:454
Definition CommandsOpCl.hpp:12
Definition ControlLock.hpp:11
Definition FeedbackOpCl.hpp:12
Definition OrderOpCl.hpp:12
Definition RemoteLocal.hpp:20
Definition TripReset.hpp:12
constexpr iv::types::color WonderBitsWhite
Definition color.hpp:252
constexpr iv::types::color SedniElementWorkingGreen
Definition color.hpp:337
constexpr iv::types::color SedniElementNotWorkingGrey
Definition color.hpp:339
constexpr iv::types::color White
Definition color.hpp:222
constexpr iv::types::color WonderBitsGrey3
Definition color.hpp:242
constexpr iv::types::color SedniElementOfflineGrey
Definition color.hpp:346
constexpr iv::types::color WonderBitsBlue
Definition color.hpp:235
constexpr iv::types::color DiamarBlackBackground
Definition color.hpp:288
constexpr iv::types::color SedniElementUndefined
Definition color.hpp:344
Definition BreakerPms.cpp:18
uint16_t elementId
Definition types.hpp:96
double height
Definition types.hpp:14
double degree
Definition types.hpp:18
double width
Definition types.hpp:23
uint32_t color
Definition types.hpp:12
eLanguage
Definition enums.hpp:37
static constexpr iv::types::color workingPowerUnit
Definition BreakerPms.hpp:88
static constexpr iv::types::color workingFrequencyUnit
Definition BreakerPms.hpp:90
static constexpr iv::types::color workingFrequency
Definition BreakerPms.hpp:89
static constexpr iv::types::color workingPriority
Definition BreakerPms.hpp:91
static constexpr iv::types::color offline
Definition BreakerPms.hpp:93
static constexpr iv::types::color workingControlState
Definition BreakerPms.hpp:92
static constexpr iv::types::color workingPower
Definition BreakerPms.hpp:87
static constexpr iv::types::color workingBarBackground
Definition BreakerPms.hpp:86
static constexpr iv::types::color workingBar
Definition BreakerPms.hpp:85
static constexpr iv::types::width frequencyUnitPadding
Definition BreakerPms.hpp:113
static constexpr iv::types::width powerUnitPadding
Definition BreakerPms.hpp:112
static constexpr iv::types::height height
Definition BreakerPms.hpp:97
static constexpr iv::types::degree arcEnd
Definition BreakerPms.hpp:101
static constexpr iv::types::degree arcStart
Definition BreakerPms.hpp:100
static constexpr double widthProportion
Definition BreakerPms.hpp:98
static constexpr double priorityTextSize
Definition BreakerPms.hpp:107
static constexpr double powerTextOffset
Definition BreakerPms.hpp:102
static constexpr double powerTextSize
Definition BreakerPms.hpp:103
static constexpr double breakerNameTextSize
Definition BreakerPms.hpp:108
static constexpr double powerUnitTextSize
Definition BreakerPms.hpp:104
static constexpr double frequencyTextSize
Definition BreakerPms.hpp:105
static constexpr double frequencyUnitTextSize
Definition BreakerPms.hpp:106
static constexpr double arcWidth
Definition BreakerPms.hpp:99
static constexpr iv::types::color workingStateOffline
Definition BreakerPms.hpp:127
static constexpr iv::types::color workingStateUndefined
Definition BreakerPms.hpp:126
static constexpr iv::types::color color
Definition BreakerPms.hpp:123
static constexpr iv::types::color workingStateClose
Definition BreakerPms.hpp:125
static constexpr iv::types::color workingStateOpen
Definition BreakerPms.hpp:124
static constexpr iv::types::color breakerNameColor
Definition BreakerPms.hpp:119
static constexpr iv::types::pms::elementId breakerId
Definition BreakerPms.hpp:118
Definition BreakerPms.hpp:131
static constexpr std::string_view breakerNameColor
Definition BreakerPms.hpp:133
static constexpr std::string_view breaker
Definition BreakerPms.hpp:132
static constexpr std::string_view breaker
Definition BreakerPms.hpp:137