summaryrefslogtreecommitdiffstats
path: root/Project/Workspace.h
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-07-07 23:12:04 -0300
committerThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-07-07 23:12:04 -0300
commitab30228b1a57053323363674fa7f137c0329a180 (patch)
tree50849a3680d61a2428665cc1035f1f4215870acb /Project/Workspace.h
parent6c0e98a2727d07e1fbb38b78c27d68e98ad09465 (diff)
downloadPSP.git-ab30228b1a57053323363674fa7f137c0329a180.tar.gz
PSP.git-ab30228b1a57053323363674fa7f137c0329a180.tar.xz
PSP.git-ab30228b1a57053323363674fa7f137c0329a180.zip
Voltage heat map implemented
Voltage heat map implemented using modern OpenGL =) New external library required: -GLEW -GLFW -GLM (incorporeted at the source) Old memory leaks fixed =)
Diffstat (limited to 'Project/Workspace.h')
-rw-r--r--Project/Workspace.h37
1 files changed, 34 insertions, 3 deletions
diff --git a/Project/Workspace.h b/Project/Workspace.h
index ad0c09d..f563a64 100644
--- a/Project/Workspace.h
+++ b/Project/Workspace.h
@@ -18,11 +18,13 @@
#ifndef WORKSPACE_H
#define WORKSPACE_H
+#include <GL/glew.h>
+
#ifdef _MSC_VER
#include <windows.h>
#endif // _MSC_VER
-#include <GL/gl.h>
+//#include <GL/gl.h>
#include <GL/glu.h>
#include <wx/dcclient.h>
#include <wx/msgdlg.h>
@@ -31,6 +33,9 @@
#include <wx/tipwin.h>
#include <wx/stopwatch.h>
+#include <glm/glm.hpp>
+#include <glm/gtc/matrix_transform.hpp>
+
#include "WorkspaceBase.h"
#include "Bus.h"
@@ -63,6 +68,10 @@ class FrequencyResponseForm;
class PropertiesData;
+class HMPlane;
+class Shader;
+class Renderer;
+
enum ElementID {
ID_BUS = 0,
ID_LINE,
@@ -127,7 +136,7 @@ class Workspace : public WorkspaceBase
void SetSavedPath(wxFileName savedPath) { m_savedPath = savedPath; }
void SetJustOpened(bool justOpened) { m_justOpened = justOpened; }
virtual void Redraw() { m_glCanvas->Refresh(); }
- wxGLContext* GetSharedGLContext() const { return m_glContext; }
+ wxGLContext* GetSharedGLContext() { return m_glContext; }
void RotateSelectedElements(bool clockwise = true);
void DeleteSelectedElements();
bool GetElementsCorners(wxPoint2DDouble& leftUpCorner,
@@ -135,12 +144,18 @@ class Workspace : public WorkspaceBase
std::vector<Element*> elementList);
void Fit();
void UnselectAll();
+ void EnableHeatMap(const bool& enable = true);
+ bool IsHeatMapEnable() const { return m_showHM; }
+ HMPlane* GetHeatMap() const { return m_hmPlane; }
+ void EnableAutoHeatMapLabel(const bool& enable = true) { m_hmAutomaticLabel = enable; }
+ bool IsHeatMapAutoLabelEnable() const { return m_hmAutomaticLabel; }
void ValidateBusesVoltages(Element* initialBus);
void ValidateElementsVoltages();
void UpdateElementsID();
bool UpdateTextElements();
+ void UpdateHeatMap();
int GetElementNumber(ElementID elementID) { return m_elementNumber[elementID]; }
void IncrementElementNumber(ElementID elementID) { m_elementNumber[elementID]++; }
@@ -155,7 +170,6 @@ class Workspace : public WorkspaceBase
bool RunStability();
bool RunHarmonicDistortion();
bool RunFrequencyResponse();
-
virtual void OnMiddleDoubleClick(wxMouseEvent& event);
virtual void OnIdle(wxIdleEvent& event);
@@ -173,6 +187,8 @@ class Workspace : public WorkspaceBase
virtual void OnPopupClick(wxCommandEvent& event);
protected:
+ virtual void OnHeatMapTime(wxTimerEvent& event);
+ virtual void OnResize(wxSizeEvent& event);
void SetViewport();
void UpdateStatusBar();
@@ -201,6 +217,21 @@ protected:
bool m_continuousCalc = false;
bool m_disconnectedElement = false;
bool m_justOpened = false;
+
+ float m_width = 0.0;
+ float m_height = 0.0;
+
+ // Modern OpenGL
+ HMPlane* m_hmPlane = nullptr;
+ Shader* m_basicShader = nullptr;
+ Shader* m_hmLabelShader = nullptr;
+ Renderer* m_renderer = nullptr;
+
+ glm::mat4 m_projMatrix;
+
+ bool m_showHM = false;
+ bool m_showHMTimer = false;
+ bool m_hmAutomaticLabel = false;
};
#endif // WORKSPACE_H