diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-06-02 21:47:06 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-06-02 21:47:06 -0300 |
commit | 113a35d0fe8938973fa1c100b77f456ed250e61b (patch) | |
tree | 586d1c3113082cbb2b92cd46c3c96a25a0e75e67 /Project/PowerElement.cpp | |
parent | 6ce2bdcf85dffee6b6ef7b95b888b8b96372a3d6 (diff) | |
download | PSP.git-113a35d0fe8938973fa1c100b77f456ed250e61b.tar.gz PSP.git-113a35d0fe8938973fa1c100b77f456ed250e61b.tar.xz PSP.git-113a35d0fe8938973fa1c100b77f456ed250e61b.zip |
OpenGL bugfixes and wxGC port alternative init
OpenGL major bugfixes;
Device context port alternative to OpenGL code init (WorkspaceDC). Some machines don't support OpenGL 3+;
Fixed some issues with MSVC.
Diffstat (limited to 'Project/PowerElement.cpp')
-rw-r--r-- | Project/PowerElement.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Project/PowerElement.cpp b/Project/PowerElement.cpp index 326c1c8..870a30e 100644 --- a/Project/PowerElement.cpp +++ b/Project/PowerElement.cpp @@ -19,6 +19,7 @@ #ifdef USING_WX_3_0_X #include "DegreesAndRadians.h" #endif +#include <wx/brush.h> PowerElement::PowerElement() : Element() { @@ -107,6 +108,36 @@ void PowerElement::DrawSwitches() const } } +void PowerElement::DrawDCSwitches(wxGraphicsContext* gc) const +{ + gc->SetPen(*wxTRANSPARENT_PEN); + + int i = 0; + for (auto parent : m_parentList) { + if (parent) { + if (m_online) { + gc->SetBrush(wxBrush(wxColour(m_closedSwitchColour.GetDcRGBA()))); + } + else { + gc->SetBrush(wxBrush(wxColour(m_openedSwitchColour.GetDcRGBA()))); + } + + gc->PushState(); + gc->Translate(m_switchRect[i].GetPosition().m_x + m_switchSize / 2.0, + m_switchRect[i].GetPosition().m_y + m_switchSize / 2.0); + gc->Rotate(wxDegToRad(parent->GetAngle())); + gc->Translate(-m_switchRect[i].GetPosition().m_x - m_switchSize / 2.0, + -m_switchRect[i].GetPosition().m_y - m_switchSize / 2.0); + + wxPoint2DDouble switchPos = m_switchRect[i].GetPosition(); + gc->DrawRectangle(switchPos.m_x, switchPos.m_y, m_switchSize, m_switchSize); + + gc->PopState(); + } + i++; + } +} + void PowerElement::CalculatePowerFlowPts(std::vector<wxPoint2DDouble> edges) { double arrowRate = 100.0; // One arrow to each "arrowRate" distance in pixels. @@ -159,6 +190,15 @@ void PowerElement::DrawPowerFlowPts() const } } +void PowerElement::DrawDCPowerFlowPts(wxGraphicsContext* gc) const +{ + gc->SetPen(*wxTRANSPARENT_PEN); + if (m_online) { + gc->SetBrush(wxBrush(wxColour(m_powerFlowArrowColour.GetDcRGBA()))); + for (auto arrow : m_powerFlowArrow) { DrawDCTriangle(arrow, gc); } + } +} + double PowerElement::GetValueFromUnit(double value, ElectricalUnit valueUnit) { switch(valueUnit) { |