From b8374cc044a538a6df26b2f63159cf68b7467e27 Mon Sep 17 00:00:00 2001 From: Moritz Maxeiner <mm@ucw.sh> Date: Mon, 17 Feb 2020 17:20:35 +0100 Subject: [PATCH] Follow interface changes w.r.t. InteractiveComponents --- .../robofish/mb_ba/robotracker/AgentBehavior.h++ | 14 ++++++++------ robotracker_plugins/couzin/BehaviorFactory.c++ | 4 ++-- robotracker_plugins/mxnet/BehaviorFactory.c++ | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/include/robofish/mb_ba/robotracker/AgentBehavior.h++ b/lib/include/robofish/mb_ba/robotracker/AgentBehavior.h++ index c3cc9403..f722d371 100644 --- a/lib/include/robofish/mb_ba/robotracker/AgentBehavior.h++ +++ b/lib/include/robofish/mb_ba/robotracker/AgentBehavior.h++ @@ -9,6 +9,8 @@ #include <QFormLayout> #include <QComboBox> +#include <robofish/interfaces/InteractiveComponents.h> + #include <robofish/mb_ba/qt/FileSelect.h++> #include <robofish/mb_ba/robotracker/behavior.h++> @@ -24,7 +26,7 @@ namespace robofish::mb_ba std::optional<Agent> agent; interfaces::IModelWorldDescriptor* world; std::shared_ptr<interfaces::IBody> prev_body; - QGridLayout* layout; + InteractiveComponents interactive_components; public: AgentBehavior(QString const& configFile) @@ -32,9 +34,9 @@ namespace robofish::mb_ba setConfig(configFile); } - AgentBehavior(QGridLayout* layout, QGraphicsView* scene) + AgentBehavior(InteractiveComponents components) : world(nullptr) - , layout(layout) + , interactive_components(components) { auto vbox = new QVBoxLayout; vbox->setSpacing(0); @@ -53,13 +55,13 @@ namespace robofish::mb_ba vbox->addStretch(); - layout->addLayout(vbox, 0, 0, -1, -1); + interactive_components.behavior_layout->addLayout(vbox, 0, 0, -1, -1); } ~AgentBehavior() { - if (layout) - removeAll(layout); + if (interactive_components.behavior_layout) + removeAll(interactive_components.behavior_layout); this->agent = std::nullopt; deactivate(); } diff --git a/robotracker_plugins/couzin/BehaviorFactory.c++ b/robotracker_plugins/couzin/BehaviorFactory.c++ index a5914cd2..28c53d3a 100644 --- a/robotracker_plugins/couzin/BehaviorFactory.c++ +++ b/robotracker_plugins/couzin/BehaviorFactory.c++ @@ -18,9 +18,9 @@ namespace robofish::mb_ba return std::make_shared<CouzinBehavior>(configFile); } - std::shared_ptr<interfaces::IBehavior> makeInteractive(QGridLayout* layout, QGraphicsView* scene) override + std::shared_ptr<interfaces::IBehavior> makeInteractive(InteractiveComponents components) override { - return std::make_shared<CouzinBehavior>(layout, scene); + return std::make_shared<CouzinBehavior>(components); } }; } diff --git a/robotracker_plugins/mxnet/BehaviorFactory.c++ b/robotracker_plugins/mxnet/BehaviorFactory.c++ index 1df9ce30..e21129c3 100644 --- a/robotracker_plugins/mxnet/BehaviorFactory.c++ +++ b/robotracker_plugins/mxnet/BehaviorFactory.c++ @@ -18,9 +18,9 @@ namespace robofish::mb_ba return std::make_shared<MXNetBehavior>(configFile); } - std::shared_ptr<interfaces::IBehavior> makeInteractive(QGridLayout* layout, QGraphicsView* scene) override + std::shared_ptr<interfaces::IBehavior> makeInteractive(InteractiveComponents components) override { - return std::make_shared<MXNetBehavior>(layout, scene); + return std::make_shared<MXNetBehavior>(components); } }; } -- GitLab