Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit3cb54ae0a20f45b7681a23c7984592bd3a5aa863 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-07-23 13:48:48 +0300
Committer
 Syndamia <kamen@syndamia.com>
2025-07-23 13:48:48 +0300
Files31eb4e10e617ca8ae2659235202cf6c92d484c77 /src
screen-generator-nemetschek-3cb54ae0a20f45b7681a23c7984592bd3a5aa863.tar
screen-generator-nemetschek-3cb54ae0a20f45b7681a23c7984592bd3a5aa863.tar.gz
screen-generator-nemetschek-3cb54ae0a20f45b7681a23c7984592bd3a5aa863.zip
Parent573bb05f487e490c33c2fa4f201126152d51e4d5 (diff)
feat: Implement freeform LED video wall
2 files changed, 78 insertions, 0 deletions
-rw-r--r--src/LEDVideoWall.cpp58
-rw-r--r--src/LEDVideoWall.h20
diff --git a/src/LEDVideoWall.cpp b/src/LEDVideoWall.cpp
new file mode 100644
index 0000000..b86afb0
--- /dev/null
+++ b/src/LEDVideoWall.cpp
@@ -0,0 +1,58 @@
+#include "LEDVideoWall.h"
+#include "cli.hpp"
+#include <stdio.h>
+
+LEDVideoWall::~LEDVideoWall() { }
+
+LEDVideoWall* LEDVideoWall::Freeform(mm panel_width, mm panel_height, mm wall_max_width, mm wall_max_height) {
+ return new LEDVideoWall(
+ (wall_max_width / panel_width) * panel_width,
+ (wall_max_height / panel_height) * panel_height);
+}
+
+LEDVideoWall::LEDVideoWall(mm width, mm height) : Screen(width, height) { }
+
+enum class LEDVideoWallType {
+ Freeform = 0
+};
+
+LEDVideoWall* LEDVideoWall::fromCommandLine() {
+ mm ipanel_width = 0;
+ cli::readUserInput(
+ ipanel_width,
+ "Enter width for a single panel (in mm): ",
+ "Invalid panel width, try again!");
+
+ mm ipanel_height = 0;
+ cli::readUserInput(
+ ipanel_height,
+ "Enter height for a single panel (in mm): ",
+ "Invalid panel height, try again!");
+
+ unsigned int itype = 1;
+ cli::readUserInputMax(
+ itype,
+ (unsigned int)1,
+ "Select an LED video wall type [0 for Freeform]: ",
+ "Invalid type, try again!");
+
+ LEDVideoWallType type = static_cast<LEDVideoWallType>(itype);
+ switch (type) {
+ case LEDVideoWallType::Freeform: {
+ mm iwall_max_width = 0;
+ cli::readUserInput(
+ iwall_max_width,
+ "Enter width for a single wall_max (in mm): ",
+ "Invalid wall_max width, try again!");
+
+ mm iwall_max_height = 0;
+ cli::readUserInput(
+ iwall_max_height,
+ "Enter height for a single wall_max (in mm): ",
+ "Invalid wall_max height, try again!");
+
+ return LEDVideoWall::Freeform(ipanel_width, ipanel_height, iwall_max_width, iwall_max_height);
+ };
+ }
+ throw std::logic_error("Implementation error: didn't handle all types of LED video walls!");
+}
diff --git a/src/LEDVideoWall.h b/src/LEDVideoWall.h
new file mode 100644
index 0000000..043aaed
--- /dev/null
+++ b/src/LEDVideoWall.h
@@ -0,0 +1,20 @@
+#ifndef SG_LEDVIDEOWALL
+#define SG_LEDVIDEOWALL
+
+#include "Screen.h"
+
+class LEDVideoWall : public Screen {
+public:
+ virtual ~LEDVideoWall();
+
+ // Named constructor idiom https://isocpp.org/wiki/faq/ctors#named-ctor-idiom
+
+ static LEDVideoWall* Freeform(mm panel_width, mm panel_height, mm wall_max_width, mm wall_max_height);
+
+ static LEDVideoWall* fromCommandLine();
+
+private:
+ LEDVideoWall(mm width, mm height);
+};
+
+#endif /* SG_LEDVIDEOWALL */