diff options
Diffstat (limited to 'Project/Workspace.h')
-rw-r--r-- | Project/Workspace.h | 68 |
1 files changed, 64 insertions, 4 deletions
diff --git a/Project/Workspace.h b/Project/Workspace.h index e240206..b4d1e54 100644 --- a/Project/Workspace.h +++ b/Project/Workspace.h @@ -8,22 +8,54 @@ #include <wx/statusbr.h> #include "WorkspaceBase.h" +#include "Bus.h" class Camera; class Element; -class Bus; +//class Bus; class Line; +class Transformer; +class SyncGenerator; +class IndMotor; +class SyncMotor; +class Load; +class Inductor; +class Capacitor; + +class Text; + +class PowerFlow; enum WorkspaceMode { MODE_EDIT = 0, MODE_MOVE_ELEMENT, MODE_MOVE_PICKBOX, + MODE_MOVE_NODE, MODE_DRAG, + MODE_DRAG_INSERT, + MODE_DRAG_INSERT_TEXT, MODE_INSERT, + MODE_INSERT_TEXT, MODE_SELECTION_RECT }; +enum ElementID +{ + ID_BUS = 0, + ID_LINE, + ID_TRANSFORMER, + ID_SYNCGENERATOR, + ID_INDMOTOR, + ID_SYNCMOTOR, + ID_LOAD, + ID_CAPACITOR, + ID_INDUCTOR, + ID_TEXT, + + NUM_ELEMENTS +}; + class Workspace : public WorkspaceBase { public: @@ -32,11 +64,30 @@ class Workspace : public WorkspaceBase ~Workspace(); wxString GetName() const { return m_name; } - void SetName(wxString name) { m_name = name; } - std::vector<Element*> GetElementList() { return m_elementList; } - void Redraw() { m_glCanvas->Refresh(); } + std::vector<Element*> GetElementList() const { return m_elementList; } + WorkspaceMode GetWorkspaceMode() const { return m_mode; } + Camera* GetCamera() const { return m_camera; } + + void SetName(wxString name) { m_name = name; } + void SetElementList(std::vector<Element*> elementList) { m_elementList = elementList; } + void SetStatusBarText(wxString text) { m_statusBar->SetStatusText(text); } + void SetWorkspaceMode(WorkspaceMode mode) { m_mode = mode; } + + void Redraw() { m_glCanvas->Refresh(); } + void RotateSelectedElements(bool clockwise = true); + void DeleteSelectedElements(); + void Fit(); + + void ValidateBusesVoltages(Element* initialBus); + void ValidateElementsVoltages(); + + int GetElementNumber(ElementID elementID) { return m_elementNumber[elementID]; } + void IncrementElementNumber(ElementID elementID) { m_elementNumber[elementID]++; } + + bool RunPowerFlow(); protected: + virtual void OnLeftDoubleClick(wxMouseEvent& event); virtual void OnRightClickDown(wxMouseEvent& event); virtual void OnLeftClickUp(wxMouseEvent& event); virtual void OnScroll(wxMouseEvent& event); @@ -58,6 +109,9 @@ class Workspace : public WorkspaceBase WorkspaceMode m_mode = MODE_EDIT; std::vector<Element*> m_elementList; + int m_elementNumber[NUM_ELEMENTS]; + + std::vector<Text*> m_textList; void UpdateStatusBar(); @@ -73,6 +127,7 @@ class Camera ~Camera(); void SetScale(wxPoint2DDouble screenPoint, double delta); + void SetScale(double scale) { m_scale = scale; } void SetTranslation(wxPoint2DDouble screenPoint); void StartTranslation(wxPoint2DDouble startPoint) { this->m_translationStartPt = startPoint; } void UpdateMousePosition(wxPoint2DDouble mousePosition) { this->m_mousePosition = mousePosition; } @@ -80,6 +135,8 @@ class Camera wxPoint2DDouble GetTranslation() const { return m_translation; } wxPoint2DDouble GetMousePosition(bool worldCoords = true) const; wxPoint2DDouble ScreenToWorld(wxPoint2DDouble screenCoords) const; + double GetZoomMin() const { return m_zoomMin; } + double GetZoomMax() const { return m_zoomMax; } protected: wxPoint2DDouble m_translation; @@ -87,6 +144,9 @@ class Camera double m_scale; wxPoint2DDouble m_mousePosition; + + double m_zoomMin = 0.05; + double m_zoomMax = 3.0; }; #endif // WORKSPACE_H |