summaryrefslogtreecommitdiffstats
path: root/Project/Workspace.h
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-04-24 17:39:03 -0300
committerGitHub <noreply@github.com>2017-04-24 17:39:03 -0300
commit7804c1bd2c0bd2a5f135c30b20991e8187581cc6 (patch)
tree725e524253d6fd714460402194b408cb33b80b3f /Project/Workspace.h
parent69131a727782090ffd7cb467f449e8f26d3d2949 (diff)
parent9529a6ed44645842adc6f938478acc1dfa17a284 (diff)
downloadPSP.git-7804c1bd2c0bd2a5f135c30b20991e8187581cc6.tar.gz
PSP.git-7804c1bd2c0bd2a5f135c30b20991e8187581cc6.tar.xz
PSP.git-7804c1bd2c0bd2a5f135c30b20991e8187581cc6.zip
Merge pull request #28 from Thales1330/wip/generic-controllers
Wip generic controllers. Chart view implementation required, creating new branch....
Diffstat (limited to 'Project/Workspace.h')
-rw-r--r--Project/Workspace.h77
1 files changed, 26 insertions, 51 deletions
diff --git a/Project/Workspace.h b/Project/Workspace.h
index 3b03220..bf03a9e 100644
--- a/Project/Workspace.h
+++ b/Project/Workspace.h
@@ -12,6 +12,8 @@
#include "WorkspaceBase.h"
#include "Bus.h"
+#include "ControlEditor.h"
+
class Camera;
class Element;
// class Bus;
@@ -30,21 +32,6 @@ class Text;
class PowerFlow;
class Fault;
-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,
- MODE_PASTE,
- MODE_DRAG_PASTE
-};
-
enum ElementID {
ID_BUS = 0,
ID_LINE,
@@ -63,6 +50,21 @@ enum ElementID {
class Workspace : public WorkspaceBase
{
public:
+ 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,
+ MODE_PASTE,
+ MODE_DRAG_PASTE
+ };
+
Workspace();
Workspace(wxWindow* parent, wxString name = wxEmptyString, wxStatusBar* statusBar = NULL);
~Workspace();
@@ -73,10 +75,10 @@ public:
std::vector<Element*> GetAllElements() const;
WorkspaceMode GetWorkspaceMode() const { return m_mode; }
Camera* GetCamera() const { return m_camera; }
-
+
void CopySelection();
bool Paste();
-
+
wxFileName GetSavedPath() const { return m_savedPath; }
void SetName(wxString name) { m_name = name; }
@@ -90,13 +92,15 @@ public:
void Redraw() { m_glCanvas->Refresh(); }
void RotateSelectedElements(bool clockwise = true);
void DeleteSelectedElements();
- bool GetElementsCorners(wxPoint2DDouble& leftUpCorner, wxPoint2DDouble& rightDownCorner, std::vector<Element*> elementList);
+ bool GetElementsCorners(wxPoint2DDouble& leftUpCorner,
+ wxPoint2DDouble& rightDownCorner,
+ std::vector<Element*> elementList);
void Fit();
void UnselectAll();
void ValidateBusesVoltages(Element* initialBus);
void ValidateElementsVoltages();
-
+
void UpdateElementsID();
void UpdateTextElements();
@@ -137,42 +141,13 @@ protected:
int m_elementNumber[NUM_ELEMENTS];
std::vector<Text*> m_textList;
-
+
wxFileName m_savedPath;
-
+
wxRect2DDouble m_selectionRect;
wxPoint2DDouble m_startSelRect;
-
- bool m_justOpened = false;
-};
-
-class Camera
-{
-public:
- 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; }
- double GetScale() const { return m_scale; }
- 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;
- wxPoint2DDouble m_translationStartPt;
- double m_scale;
-
- wxPoint2DDouble m_mousePosition;
-
- double m_zoomMin = 0.01;
- double m_zoomMax = 3.0;
+ bool m_justOpened = false;
};
#endif // WORKSPACE_H