Power System Platform  2026w23a-beta
Loading...
Searching...
No Matches
Gain Class Reference

Provide an output multiplying the input by a constant. More...

#include <Gain.h>

Inheritance diagram for Gain:
Collaboration diagram for Gain:

Public Member Functions

 Gain (int id)
 
virtual void DrawDC (GUIColour *guiColour, wxPoint2DDouble translation, double scale, wxGraphicsContext *gc) const
 Draw the element using GDI+.
 
virtual bool Contains (wxPoint2DDouble position) const
 Checks if the element contains a position.
 
virtual bool Intersects (wxRect2DDouble rect) const
 Check if the element's rect intersects other rect.
 
virtual bool ShowForm (wxWindow *parent, Element *element, wxWindow *workspace=nullptr)
 Show element data form.
 
virtual void Rotate (bool clockwise=true)
 Rotate the element.
 
virtual void Move (wxPoint2DDouble position)
 Move the element other position.
 
virtual void SetFont (wxFont &font)
 
virtual bool UpdateText ()
 Update the OpenGL text in the element (if present).
 
virtual void SetValue (double value)
 
virtual double GetValue () const
 
virtual void UpdatePoints ()
 
virtual bool Solve (double *input, double timeStep)
 Multiply the input by a constant.
 
virtual rapidxml::xml_node * SaveElement (rapidxml::xml_document<> &doc, rapidxml::xml_node<> *elementListNode)
 
virtual bool OpenElement (rapidxml::xml_node<> *elementNode)
 
virtual ElementGetCopy ()
 Get a the element copy.
 
- Public Member Functions inherited from ControlElement
 ControlElement (int id)
 
virtual void StartMove (wxPoint2DDouble position)
 Update the element attributes related to the movement.
 
void SetNodeList (std::vector< Node * > nodeList)
 
std::vector< Node * > GetNodeList () const
 
virtual void DrawDCNodes (wxGraphicsContext *gc) const
 
virtual void ReplaceNode (Node *oldNode, Node *newNode)
 
virtual bool IsSolved () const
 
virtual void SetSolved (bool solved=true)
 
virtual bool Initialize ()
 
virtual double GetOutput () const
 
virtual void SetOutput (double output)
 
- Public Member Functions inherited from Element
 Element ()
 Constructor.
 
virtual ~Element ()
 Destructor.
 
void SetDragging (bool dragging=true)
 Set if the element are being dragged.
 
void SetHeight (double height)
 Set element height.
 
void SetPosition (const wxPoint2DDouble position)
 Set the element position and update the rectangle.
 
void SetSelected (bool selected=true)
 Set element selection.
 
void SetWidth (double width)
 Set element width.
 
void SetAngle (double angle)
 Set element angle.
 
void ShowPickbox (bool showPickbox=true)
 Set if the pickbox is shown.
 
void SetBorderSize (double borderSize)
 Set the size of the border (shown in selected elements).
 
bool SetOnline (bool online=true)
 Set if the element is online or offline.
 
virtual void SetPointList (std::vector< wxPoint2DDouble > pointList)
 Set the list of points that connect the element to the bus.
 
ElementType GetElementType ()
 
wxRect2DDouble GetRect () const
 Get the element rectangle.
 
wxPoint2DDouble GetPosition () const
 Get the element position.
 
bool IsDragging () const
 Checks if the element is being dragged.
 
double GetHeight () const
 Get the element height.
 
bool IsSelected () const
 Checks if the element is selected.
 
double GetWidth () const
 Get the element width.
 
double GetAngle () const
 Get the element angle.
 
double GetRotationAngle () const
 Get the angle of rotation.
 
bool IsPickboxShown () const
 Checks if the pickbox is shown.
 
bool IsOnline () const
 Checks if the element is online or offline.
 
virtual std::vector< wxPoint2DDouble > GetPointList () const
 Get the list of points that connect the element to bus.
 
virtual bool AddParent (Element *parent, wxPoint2DDouble position)
 Add a parent to the element. This method must be used on power elements that connect to a bus, so the parent must be a bus. The element basic points are calculated in this method, so apply this when the element is being inserted.
 
virtual void AddParent (Element *parent)
 Add a parent to the element.
 
virtual void SetID (int id)
 Set the element ID.
 
virtual int GetID () const
 Get the element ID.
 
virtual void AddChild (Element *child)
 Add a child to the child list.
 
virtual void RemoveChild (Element *child)
 Remove a child from the list.
 
virtual void ReplaceChild (Element *oldChild, Element *newChild)
 Replace a child from the list.
 
virtual wxString GetTipText () const
 Get the tip text.
 
virtual void DrawDC (GUIColour *guiColour, wxPoint2DDouble translation, double scale, wxDC &dc) const
 Draw the element using wxDC.
 
virtual bool GetContextMenu (wxMenu &menu)
 Get the element contex menu.
 
virtual void AddPoint (wxPoint2DDouble point)
 Add point to the list of points that connect the element to the bus.
 
virtual void MoveNode (Element *parent, wxPoint2DDouble position)
 Move a node. StartMove(wxPoint2DDouble position) before start moving.
 
virtual bool NodeContains (wxPoint2DDouble position)
 Check if a node contains a point. If contains, set the attributes related to node movement.
 
virtual void UpdateNodes ()
 Update the nodes according to the parents. If a parent is removed, use this method.
 
void SetParent (Element *parent, int num)
 
void SetChild (Element *child, int num)
 
virtual bool SetNodeParent (Element *parent)
 Set a perent to the node. If all conditions are met, a new parent are added to the element and the points related to the nodes will be calculated.
 
virtual void RemoveParent (Element *parent)
 Remove a parent.
 
virtual void ReplaceParent (Element *oldParent, Element *newParent)
 Replace a parent.
 
virtual void RotateNode (Element *parent, bool clockwise=true)
 Rotate a node.
 
virtual bool PickboxContains (wxPoint2DDouble position)
 Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be calculated.
 
virtual void MovePickbox (wxPoint2DDouble position)
 Move the pickbox.
 
virtual wxCursor GetBestPickboxCursor () const
 Get the best cursor to shown to the user when the mouse is above a pickbox.
 
virtual void ResetPickboxes ()
 Remove the pickboxes.
 
virtual void ResetNodes ()
 Remove the active nodes.
 
virtual wxPoint2DDouble WorldToScreen (wxPoint2DDouble translation, double scale, double offsetX=0.0, double offsetY=0.0) const
 Convert the element position to screen position.
 
virtual wxPoint2DDouble WorldToScreen (wxPoint2DDouble position, wxPoint2DDouble translation, double scale, double offsetX=0.0, double offsetY=0.0) const
 Convert a generic position to screen position.
 
virtual bool RotatedRectanglesIntersects (wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const
 Check if two roteted rectangles intersect.
 
virtual void DrawDCRectangle (wxPoint2DDouble position, double width, double height, double angle, wxDC &dc) const
 Draw a circle.
 
virtual void DrawDCRoundedRectRotated (wxDC &dc, const wxPoint2DDouble &center, double width, double height, double radius, double angleDeg, int arcSegments=8) const
 
virtual void DrawDCCircle (wxPoint2DDouble position, double radius, int numSegments, wxGraphicsContext *gc) const
 Draw a circle using device context.
 
virtual void DrawDCCircle (wxPoint2DDouble position, double radius, wxDC &dc) const
 
virtual void DrawDCArc (wxPoint2DDouble position, double radius, double initAngle, double finalAngle, int numSegments, wxGraphicsContext *gc) const
 
virtual void DrawDCArc (wxPoint2DDouble position, double radius, double initAngle, double finalAngle, wxDC &dc) const
 
virtual void DrawDCTriangle (std::vector< wxPoint2DDouble > points, wxGraphicsContext *gc) const
 Draw rectangle.
 
virtual void DrawDCTriangle (std::vector< wxPoint > points, wxDC &dc) const
 
virtual void DrawDCPickbox (wxPoint2DDouble position, wxGraphicsContext *gc) const
 Draw a point.
 
virtual wxPoint2DDouble RotateAtPosition (wxPoint2DDouble pointToRotate, double angle, bool degrees=true) const
 Rotate a point as element position being the origin.
 
virtual wxPoint2DDouble RotateLocal (wxPoint2DDouble local, double angleDeg) const
 
virtual wxPoint RotateAround (const wxPoint2DDouble &p, const wxPoint2DDouble &center, double angleDeg) const
 
virtual std::vector< Element * > GetParentList () const
 Get the parent list.
 
virtual std::vector< Element * > GetChildList () const
 Get the Child list.
 
virtual void CalculateBoundaries (wxPoint2DDouble &leftUp, wxPoint2DDouble &rightBottom) const
 Calculate the element boundaries.
 
virtual void GeneralMenuItens (wxMenu &menu)
 Insert general itens to context menu.
 
virtual double PointToLineDistance (wxPoint2DDouble point, int *segmentNumber=nullptr) const
 Calculate the distance between a line (formed by point list) and a point.
 
bool IsInserted () const
 Check if the element is properly inserted in the workspace.
 
void SetInserted (bool inserted=true)
 Set if the element is properly inserted in the workspace.
 
void SaveCADProperties (rapidxml::xml_document<> &doc, rapidxml::xml_node<> *elementNode)
 
bool OpenCADProperties (rapidxml::xml_node<> *elementNode)
 

Protected Attributes

double m_value = 1.0
 
GCTextm_gcText = nullptr
 
std::vector< wxPoint2DDouble > m_triPts
 
- Protected Attributes inherited from ControlElement
std::vector< Node * > m_nodeList
 
bool m_solved = false
 
double m_output = 0.0
 
- Protected Attributes inherited from Element
ElementType m_elementType = ElementType::TYPE_NONE
 
int m_elementID = 0
 
std::vector< Element * > m_parentList
 
std::vector< Element * > m_childList
 
wxRect2DDouble m_rect
 
wxPoint2DDouble m_position
 
double m_width = 0.0
 
double m_height = 0.0
 
double m_angle = 0.0
 
double m_borderSize = 2.0
 
double m_rotationAngle = 45.0
 
double m_switchSize = 10.0
 
std::vector< wxRect2DDouble > m_switchRect
 
bool m_selected = false
 
bool m_dragging = false
 
bool m_showPickbox = false
 
bool m_inserted = false
 
int m_activePickboxID = ID_PB_NONE
 
int m_activeNodeID = 0
 
std::vector< wxPoint2DDouble > m_pointList
 
std::vector< wxPoint2DDouble > m_movePts
 
wxPoint2DDouble m_moveStartPt
 
wxPoint2DDouble m_movePos
 
bool m_online = true
 

Additional Inherited Members

- Static Public Member Functions inherited from ControlElement
static ControlElementGetControlElementFromID (std::vector< std::shared_ptr< ControlElement > > elementList, int id)
 
- Static Public Member Functions inherited from Element
static bool DoubleFromString (wxWindow *parent, wxString strValue, double &value, wxString errorMsg)
 Get a double value from a string. Show a error message if the conversion fail.
 
static bool IntFromString (wxWindow *parent, wxString strValue, int &value, wxString errorMsg)
 Convert a string to int. Show a error message if the conversion fail.
 
static wxString StringFromDouble (double value, int minDecimal=1, int maxDecimals=13)
 Convert a double value to string.
 
- Protected Member Functions inherited from ControlElement
void SaveControlNodes (rapidxml::xml_document<> &doc, rapidxml::xml_node<> *elementNode)
 
bool OpenControlNodes (rapidxml::xml_node<> *elementNode)
 

Detailed Description

Provide an output multiplying the input by a constant.

Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
Date
05/10/2017

Definition at line 36 of file Gain.h.

Constructor & Destructor Documentation

◆ Gain()

Gain::Gain ( int  id)

Definition at line 21 of file Gain.cpp.

21 : ControlElement(id)
22{
23 m_triPts.resize(3);
24 SetValue(m_value);
25 Node* nodeIn = new Node(m_position + wxPoint2DDouble(-m_width / 2, 0), Node::NodeType::NODE_IN, m_borderSize);
26 nodeIn->StartMove(m_position);
27 Node* nodeOut = new Node(m_position + wxPoint2DDouble(m_width / 2, 0), Node::NodeType::NODE_OUT, m_borderSize);
28 nodeOut->SetAngle(180.0);
29 nodeOut->StartMove(m_position);
30 m_nodeList.push_back(nodeIn);
31 m_nodeList.push_back(nodeOut);
32}
Node of a control element. This class manages the user interaction with the connection and control el...

◆ ~Gain()

Gain::~Gain ( )

Definition at line 34 of file Gain.cpp.

35{
36 //if(m_glText) delete m_glText;
37 if (m_gcText) delete m_gcText;
38 for (auto& node : m_nodeList) if (node) delete node;
39 m_nodeList.clear();
40}

Member Function Documentation

◆ Contains()

virtual bool Gain::Contains ( wxPoint2DDouble  position) const
inlinevirtual

Checks if the element contains a position.

Parameters
positionPosition to be checked.

Implements Element.

Definition at line 44 of file Gain.h.

44{ return m_rect.Contains(position); }

◆ DrawDC()

void Gain::DrawDC ( GUIColour guiColour,
wxPoint2DDouble  translation,
double  scale,
wxGraphicsContext *  gc 
) const
virtual

Draw the element using GDI+.

Parameters
guiColourColours of the system defined in properties.
translationTranslation of the system.
scaleScale of the system.
gcGraphics context

Reimplemented from Element.

Definition at line 42 of file Gain.cpp.

43{
44 if (m_selected) {
45 gc->SetPen(*wxTRANSPARENT_PEN);
46 gc->SetBrush(wxBrush(guiColour->selection));
47 double borderSize = (m_borderSize * 2.0 + 1.0) / scale;
48 std::vector<wxPoint2DDouble> m_triSelectedPts;
49 if (m_angle == 0.0) {
50 m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(borderSize / 2, borderSize / 1.5));
51 m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(borderSize / 2, -borderSize / 1.5));
52 m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(-borderSize, 0));
53 }
54 else if (m_angle == 90.0) {
55 m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(borderSize / 1.5, borderSize / 2));
56 m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(-borderSize / 1.5, borderSize / 2));
57 m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(0, -borderSize));
58 }
59 else if (m_angle == 180.0) {
60 m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(borderSize, 0));
61 m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(-borderSize / 2, borderSize / 1.5));
62 m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(-borderSize / 2, -borderSize / 1.5));
63 }
64 else if (m_angle == 270.0) {
65 m_triSelectedPts.push_back(m_triPts[0] - wxPoint2DDouble(0, borderSize));
66 m_triSelectedPts.push_back(m_triPts[1] - wxPoint2DDouble(-borderSize / 1.5, -borderSize / 2));
67 m_triSelectedPts.push_back(m_triPts[2] - wxPoint2DDouble(borderSize / 1.5, -borderSize / 2));
68 }
69 DrawDCTriangle(m_triSelectedPts, gc);
70 }
71
72 gc->SetPen(wxPen(guiColour->enabled, 1));
73 gc->SetBrush(guiColour->background);
74 DrawDCTriangle(m_triPts, gc);
75
76 // Plot number.
77 if (m_angle == 0.0)
78 m_gcText->Draw(m_position + wxPoint2DDouble(-m_width / 2 + 2 + m_borderSize, -m_gcText->GetHeight() / 2), gc, 0, guiColour->text);
79 else if (m_angle == 90.0)
80 m_gcText->Draw(m_position + wxPoint2DDouble(-m_gcText->GetWidth() / 2, -m_height / 2 + 2 + m_borderSize), gc, 0, guiColour->text);
81 else if (m_angle == 180.0)
82 m_gcText->Draw(m_position + wxPoint2DDouble(m_width / 2 - m_gcText->GetWidth() - 2 - m_borderSize, -m_gcText->GetHeight() / 2), gc, 0, guiColour->text);
83 else if (m_angle == 270.0)
84 m_gcText->Draw(m_position + wxPoint2DDouble(-m_gcText->GetWidth() / 2, m_height / 2 - m_gcText->GetHeight() - 2 - m_borderSize), gc, 0, guiColour->text);
85
86 gc->SetPen(*wxTRANSPARENT_PEN);
87 gc->SetBrush(guiColour->enabled);
88 DrawDCNodes(gc);
89}
virtual void DrawDCTriangle(std::vector< wxPoint2DDouble > points, wxGraphicsContext *gc) const
Draw rectangle.
Definition Element.cpp:209
virtual void Draw(wxPoint2DDouble position, wxGraphicsContext *gc, double angle=0.0, wxColour colour= *wxBLACK) const
Draw the text in wxGraphicsContext.
Definition GCText.cpp:35
Here is the call graph for this function:

◆ GetCopy()

Element * Gain::GetCopy ( )
virtual

Get a the element copy.

Returns
Copy of the element.

Reimplemented from Element.

Definition at line 203 of file Gain.cpp.

204{
205 Gain* copy = new Gain(*this);
206 copy->m_gcText = m_gcText ? m_gcText->GetCopy() : nullptr;
207 return copy;
208}
virtual GCText * GetCopy()
Get a deep text copy.
Definition GCText.cpp:99
Provide an output multiplying the input by a constant.
Definition Gain.h:37
Here is the call graph for this function:

◆ GetValue()

virtual double Gain::GetValue ( ) const
inlinevirtual

Definition at line 52 of file Gain.h.

52{ return m_value; }

◆ Intersects()

virtual bool Gain::Intersects ( wxRect2DDouble  rect) const
inlinevirtual

Check if the element's rect intersects other rect.

Parameters
rectRect to check intersection.

Implements Element.

Definition at line 45 of file Gain.h.

45{ return m_rect.Intersects(rect); }

◆ Move()

void Gain::Move ( wxPoint2DDouble  position)
virtual

Move the element other position.

Parameters
positionPosition that the element will be moved. Use StartMove(wxPoint2DDouble position) before start moving.

Reimplemented from ControlElement.

Definition at line 181 of file Gain.cpp.

182{
183 SetPosition(m_movePos + position - m_moveStartPt);
184 UpdatePoints();
185}
void SetPosition(const wxPoint2DDouble position)
Set the element position and update the rectangle.
Definition Element.cpp:33
Here is the call graph for this function:

◆ OpenElement()

bool Gain::OpenElement ( rapidxml::xml_node<> *  elementNode)
virtual

Reimplemented from Element.

Definition at line 232 of file Gain.cpp.

233{
234 if (!OpenCADProperties(elementNode)) return false;
235 if (!OpenControlNodes(elementNode)) return false;
236
237 // Element properties
238 double value = XMLParser::GetNodeValueDouble(elementNode, "Value");
239 SetValue(value);
240 return true;
241}

◆ Rotate()

void Gain::Rotate ( bool  clockwise = true)
virtual

Rotate the element.

Parameters
clockwiseTrue to rotate clockwise, false to rotate counter-clockwise.

Reimplemented from Element.

Definition at line 101 of file Gain.cpp.

102{
103 if (clockwise)
104 m_angle += 90.0;
105 else
106 m_angle -= 90.0;
107 if (m_angle >= 360.0)
108 m_angle = 0.0;
109 else if (m_angle < 0)
110 m_angle = 270.0;
111
112 UpdatePoints();
113
114 for (auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) {
115 Node* node = *it;
116 node->Rotate(clockwise);
117 }
118}

◆ SaveElement()

rapidxml::xml_node * Gain::SaveElement ( rapidxml::xml_document<> &  doc,
rapidxml::xml_node<> *  elementListNode 
)
virtual

Reimplemented from Element.

Definition at line 217 of file Gain.cpp.

218{
219 auto elementNode = XMLParser::AppendNode(doc, elementListNode, "Gain");
220 XMLParser::SetNodeAttribute(doc, elementNode, "ID", m_elementID);
221
222 SaveCADProperties(doc, elementNode);
223 SaveControlNodes(doc, elementNode);
224
225 // Element properties
226 auto value = XMLParser::AppendNode(doc, elementNode, "Value");
227 XMLParser::SetNodeValue(doc, value, m_value);
228
229 return elementNode;
230}

◆ SetFont()

void Gain::SetFont ( wxFont &  font)
virtual

Reimplemented from ControlElement.

Definition at line 187 of file Gain.cpp.

188{
189 if (m_gcText) m_gcText->SetFont(font);
190 UpdateText();
191}
virtual bool UpdateText()
Update the OpenGL text in the element (if present).
Definition Gain.cpp:210

◆ SetValue()

void Gain::SetValue ( double  value)
virtual

Definition at line 120 of file Gain.cpp.

121{
122 m_value = value;
123 wxString text = "";
124 if (std::abs(m_value) > 1e3 || std::abs(m_value) < 1e-3)
125 text = wxString::Format("%g", m_value);
126 else
127 text = StringFromDouble(m_value);
128
129 if (m_gcText)
130 m_gcText->SetText(text);
131 else
132 m_gcText = new GCText(text);
133
134 m_width = m_gcText->GetWidth() + 18 + 2 * m_borderSize;
135 m_height = m_gcText->GetHeight() + 18 + 2 * m_borderSize;
136
137 if (m_width > m_height)
138 m_height = m_width;
139 else
140 m_width = m_height;
141
142 SetPosition(m_position); // Update rectangle.
143
144 UpdatePoints();
145}
static wxString StringFromDouble(double value, int minDecimal=1, int maxDecimals=13)
Convert a double value to string.
Definition Element.cpp:466
Class to draw text on Graphics Context using wxWidgets.
Definition GCText.h:32
virtual void SetText(wxString text)
Set correctly a new text string.
Definition GCText.cpp:68

◆ ShowForm()

bool Gain::ShowForm ( wxWindow *  parent,
Element element,
wxWindow *  workspace = nullptr 
)
virtual

Show element data form.

Parameters
parentForm parent
elementElement that will be edited.
Returns
True if the form is shown, false otherwise.

Reimplemented from Element.

Definition at line 91 of file Gain.cpp.

92{
93 GainForm form(parent, this);
94 form.CenterOnParent();
95 if (form.ShowModal() == wxID_OK) {
96 return true;
97 }
98 return false;
99}
Form to edit the gain control data.
Definition GainForm.h:32

◆ Solve()

bool Gain::Solve ( double *  input,
double  timeStep 
)
virtual

Multiply the input by a constant.

\( output = K \cdot input \)
Parameters
inputInput value.
timeStepTime step.
Returns
Always true.

Reimplemented from ControlElement.

Definition at line 193 of file Gain.cpp.

194{
195 if (!input) {
196 m_output = 0.0;
197 return true;
198 }
199 m_output = input[0] * m_value;
200 return true;
201}

◆ UpdatePoints()

void Gain::UpdatePoints ( )
virtual

Definition at line 147 of file Gain.cpp.

148{
149 if (m_nodeList.size() != 0) {
150 if (m_angle == 0.0) {
151 m_triPts[0] = m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize);
152 m_triPts[1] = m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize);
153 m_triPts[2] = m_position + wxPoint2DDouble(m_width / 2 - m_borderSize, 0);
154 m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0));
155 m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(m_width / 2 - 2, 0));
156 }
157 else if (m_angle == 90.0) {
158 m_triPts[0] = m_rect.GetLeftTop() + wxPoint2DDouble(m_borderSize, m_borderSize);
159 m_triPts[1] = m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize);
160 m_triPts[2] = m_position + wxPoint2DDouble(0, m_height / 2 - m_borderSize);
161 m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2));
162 m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2 - 2));
163 }
164 else if (m_angle == 180.0) {
165 m_triPts[0] = m_position + wxPoint2DDouble(-m_width / 2 + m_borderSize, 0);
166 m_triPts[1] = m_rect.GetRightTop() + wxPoint2DDouble(-m_borderSize, m_borderSize);
167 m_triPts[2] = m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize);
168 m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0));
169 m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2 + 2, 0));
170 }
171 else if (m_angle == 270.0) {
172 m_triPts[0] = m_position + wxPoint2DDouble(0, -m_height / 2 + m_borderSize);
173 m_triPts[1] = m_rect.GetRightBottom() + wxPoint2DDouble(-m_borderSize, -m_borderSize);
174 m_triPts[2] = m_rect.GetLeftBottom() + wxPoint2DDouble(m_borderSize, -m_borderSize);
175 m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2));
176 m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2 + 2));
177 }
178 }
179}

◆ UpdateText()

bool Gain::UpdateText ( )
virtual

Update the OpenGL text in the element (if present).

Returns
true if OpenGLText is ok, false otherwise.

Reimplemented from ControlElement.

Definition at line 210 of file Gain.cpp.

211{
212 SetValue(m_value);
213 //if (!m_glText->IsTextureOK()) return false;
214 return true;
215}

Member Data Documentation

◆ m_gcText

GCText* Gain::m_gcText = nullptr
protected

Definition at line 73 of file Gain.h.

◆ m_triPts

std::vector<wxPoint2DDouble> Gain::m_triPts
protected

Definition at line 75 of file Gain.h.

◆ m_value

double Gain::m_value = 1.0
protected

Definition at line 70 of file Gain.h.


The documentation for this class was generated from the following files: