diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2016-11-23 17:08:20 -0200 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2016-11-23 17:08:20 -0200 |
commit | 8e79aff80e56adbdcfd6a9be5a873c6bb4b1020a (patch) | |
tree | 1e25777555f6964409a6dce64fb1bd722d0e55ae /Project/Text.cpp | |
parent | 8d78d8c052550b9efc1a7de39aa4b776be002396 (diff) | |
download | PSP.git-8e79aff80e56adbdcfd6a9be5a873c6bb4b1020a.tar.gz PSP.git-8e79aff80e56adbdcfd6a9be5a873c6bb4b1020a.tar.xz PSP.git-8e79aff80e56adbdcfd6a9be5a873c6bb4b1020a.zip |
Text under implementation
Diffstat (limited to 'Project/Text.cpp')
-rw-r--r-- | Project/Text.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Project/Text.cpp b/Project/Text.cpp new file mode 100644 index 0000000..25c9b85 --- /dev/null +++ b/Project/Text.cpp @@ -0,0 +1,65 @@ +#include "Text.h" + +#include "Bus.h" +#include "Line.h" +#include "Transformer.h" +#include "SyncGenerator.h" +#include "IndMotor.h" +#include "SyncMotor.h" +#include "Load.h" +#include "Inductor.h" +#include "Capacitor.h" + +Text::Text() : Element() +{ + SetText(m_text); +} + +Text::Text(wxPoint2DDouble position) : Element() +{ + SetText(m_text); + SetPosition(position); +} + +Text::~Text() {} + +bool Text::Contains(wxPoint2DDouble position) const +{ + wxPoint2DDouble ptR = RotateAtPosition(position, -m_angle); + return m_rect.Contains(ptR); +} + +void Text::Draw(wxPoint2DDouble translation, double scale, wxDC& dc) +{ + if(consolidate) { + glString.setFont(wxFont(10, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); + glString.consolidate(&dc); + //glString.bind(); + consolidate = false; + } + /*if(m_selected) { + glColor4d(0.0, 0.5, 1.0, 0.5); + wxGLString backSelection(m_text); + backSelection.setFont(wxFont(10, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD)); + backSelection.consolidate(&dc); + backSelection.bind(); + backSelection.render(m_position.m_x, m_position.m_y); + }*/ + + glColor4d(0.0, 0.0, 0.0, 1.0); + //glString.render(m_position.m_x, m_position.m_y); +} + +bool Text::Intersects(wxRect2DDouble rect) const +{ + if(m_angle == 0.0 || m_angle == 180.0) return m_rect.Intersects(rect); + return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0); +} + +void Text::SetText(wxString text) +{ + m_text = text; + glString = text; + + consolidate = true; +} |