diff --git a/lib/include/robofish/mb_ba/robotracker/AgentBehavior.h++ b/lib/include/robofish/mb_ba/robotracker/AgentBehavior.h++ index c3cc9403a61d6ebffd61c2f727fbfe8715b37372..f722d371bfb6b7b041cda720c9bb7940404bb85c 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 a5914cd2f8a189553901448ff0abe699852b5142..28c53d3ac6a4ad7f79f88f690a0176580d124ce9 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 1df9ce301f362c20647a1e79fb2ad6df134023ab..e21129c3ae4152980ce977f7f41b124dd44491c2 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); } }; }