Skip to content
Snippets Groups Projects
Commit b8374cc0 authored by calrama's avatar calrama
Browse files

Follow interface changes w.r.t. InteractiveComponents

parent 1bbcecf1
Branches master
No related tags found
No related merge requests found
Pipeline #26114 passed
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <QFormLayout> #include <QFormLayout>
#include <QComboBox> #include <QComboBox>
#include <robofish/interfaces/InteractiveComponents.h>
#include <robofish/mb_ba/qt/FileSelect.h++> #include <robofish/mb_ba/qt/FileSelect.h++>
#include <robofish/mb_ba/robotracker/behavior.h++> #include <robofish/mb_ba/robotracker/behavior.h++>
...@@ -24,7 +26,7 @@ namespace robofish::mb_ba ...@@ -24,7 +26,7 @@ namespace robofish::mb_ba
std::optional<Agent> agent; std::optional<Agent> agent;
interfaces::IModelWorldDescriptor* world; interfaces::IModelWorldDescriptor* world;
std::shared_ptr<interfaces::IBody> prev_body; std::shared_ptr<interfaces::IBody> prev_body;
QGridLayout* layout; InteractiveComponents interactive_components;
public: public:
AgentBehavior(QString const& configFile) AgentBehavior(QString const& configFile)
...@@ -32,9 +34,9 @@ namespace robofish::mb_ba ...@@ -32,9 +34,9 @@ namespace robofish::mb_ba
setConfig(configFile); setConfig(configFile);
} }
AgentBehavior(QGridLayout* layout, QGraphicsView* scene) AgentBehavior(InteractiveComponents components)
: world(nullptr) : world(nullptr)
, layout(layout) , interactive_components(components)
{ {
auto vbox = new QVBoxLayout; auto vbox = new QVBoxLayout;
vbox->setSpacing(0); vbox->setSpacing(0);
...@@ -53,13 +55,13 @@ namespace robofish::mb_ba ...@@ -53,13 +55,13 @@ namespace robofish::mb_ba
vbox->addStretch(); vbox->addStretch();
layout->addLayout(vbox, 0, 0, -1, -1); interactive_components.behavior_layout->addLayout(vbox, 0, 0, -1, -1);
} }
~AgentBehavior() ~AgentBehavior()
{ {
if (layout) if (interactive_components.behavior_layout)
removeAll(layout); removeAll(interactive_components.behavior_layout);
this->agent = std::nullopt; this->agent = std::nullopt;
deactivate(); deactivate();
} }
......
...@@ -18,9 +18,9 @@ namespace robofish::mb_ba ...@@ -18,9 +18,9 @@ namespace robofish::mb_ba
return std::make_shared<CouzinBehavior>(configFile); 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);
} }
}; };
} }
......
...@@ -18,9 +18,9 @@ namespace robofish::mb_ba ...@@ -18,9 +18,9 @@ namespace robofish::mb_ba
return std::make_shared<MXNetBehavior>(configFile); 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);
} }
}; };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment