summaryrefslogtreecommitdiffstats
path: root/Project/SyncGenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Project/SyncGenerator.cpp')
-rw-r--r--Project/SyncGenerator.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/Project/SyncGenerator.cpp b/Project/SyncGenerator.cpp
new file mode 100644
index 0000000..dff180d
--- /dev/null
+++ b/Project/SyncGenerator.cpp
@@ -0,0 +1,33 @@
+#include "SyncGenerator.h"
+
+SyncGenerator::SyncGenerator() : Machines()
+{
+ int numPtsSine = 10;
+ double mx = 15.0;
+ double my = 10.0;
+ double pi = 3.14159265359;
+
+ for(int i = 0; i <= numPtsSine; i++) {
+ double x = (2.0 * pi / double(numPtsSine)) * double(i) - pi;
+ double y = std::sin(x);
+ m_sinePts.push_back(wxPoint2DDouble((x / pi) * mx, y * my));
+ }
+}
+SyncGenerator::~SyncGenerator() {}
+
+void SyncGenerator::DrawSymbol() const
+{
+ // Draw sine.
+ std::vector<wxPoint2DDouble> sinePts;
+ for(int i = 0; i < (int)m_sinePts.size(); i++) {
+ sinePts.push_back(m_sinePts[i] + m_position);
+ }
+ DrawLine(sinePts);
+}
+bool SyncGenerator::GetContextMenu(wxMenu& menu)
+{
+ menu.Append(ID_EDIT_SYNCGENERATOR, _("Edit Generator"));
+ menu.Append(ID_ROTATE, _("Rotate"));
+ menu.Append(ID_DELETE, _("Delete"));
+ return true;
+}