4#include <QRandomGenerator>
9 QRandomGenerator* generator{ QRandomGenerator::global() };
10 auto r =
static_cast<float>(generator->generateDouble());
11 auto g =
static_cast<float>(generator->generateDouble());
12 auto b =
static_cast<float>(generator->generateDouble());
13 return QColor::fromRgbF(r, g, b);
19 : QMainWindow(parent), m_MenuBar{ new
MenuBar(this) },
23 Core::GeographicalCoordinate(59.66584230, 9.65059460), 2700) },
24 m_ScenarioSettingsDialog{ new
MapDialog(this) }
26 setObjectName(
"MainWindow");
27 setWindowTitle(
"Hivemind");
28 setWindowIcon(QIcon(
":/icons/logo_transparent_512.png"));
49 auto keyframeList{ findChild<KeyframeList*>(
"KeyframeList") };
52 SIGNAL(KeyframeAdded()), keyframeList, SLOT(Update()));
57 auto mapViewer{ findChild<MapViewer*>(
"MapViewer") };
61 SIGNAL(KeyframeAdded()), mapViewer, SLOT(update()));
74 std::pair<CompileScenario::Scenario::RouteMap::iterator,
75 CompileScenario::Scenario::RouteMap::iterator>)),
78 std::pair<CompileScenario::Scenario::RouteMap::iterator,
79 CompileScenario::Scenario::RouteMap::iterator>)));
81 auto timeline{ findChild<Timeline*>(
"Timeline") };
83 connect(timeline, SIGNAL(timeStampSelected(
float)), mapViewer,
84 SLOT(UpdateTimeStamp(
float)));
89 auto keyframeControls{ findChild<KeyframeControls*>(
90 "KeyframeControls") };
91 if (keyframeControls && keyframeList) {
92 connect(keyframeControls, SIGNAL(DeleteSelectedKeyframes()),
93 keyframeList, SLOT(DeleteSelected()));
96 auto scenarioControls{ findChild<ScenarioControls*>(
97 "ScenarioControls") };
98 if (scenarioControls) {
99 connect(scenarioControls, SIGNAL(OpenSettingsDialog()),
102 SIGNAL(MapDataReady(
float,
float,
float)),
this,
108 auto agentControls{ findChild<AgentControls*>(
"AgentControls") };
113 connect(agentControls,
115 std::pair<std::vector<Core::Agent>::iterator,
116 std::vector<Core::Agent>::iterator>)),
119 std::pair<std::vector<Core::Agent>::iterator,
120 std::vector<Core::Agent>::iterator>)));
121 connect(agentControls, SIGNAL(ActiveAgentChanged(
int)),
122 mapViewer, SLOT(UpdateActiveAgent(
int)));
127 SIGNAL(
AgentAdded(std::pair<std::vector<Core::Agent>::iterator,
128 std::vector<Core::Agent>::iterator>)),
130 SLOT(UpdateAgents(std::pair<std::vector<Core::Agent>::iterator,
131 std::vector<Core::Agent>::iterator>)));
133 connect(agentControls, SIGNAL(AddAgent()),
this,
157 m_Scenario->SetOrigin(coord,
static_cast<int>(size));
173 for (
auto iter{ agents.first }; iter != agents.second; ++iter) {
174 maxId = std::max(maxId, iter->Id);
176 int id{ maxId == -1 ? 0 : maxId + 1 };
179 m_Scenario->AddAgent({ id,
"Untitled agent", color });
The main content of the main window.
std::shared_ptr< CompileScenario::Scenario > m_Scenario
void UpdateScenario(float, float, float)
~MainWindow()
Descructs the main window.
void AgentAdded(std::pair< std::vector< Core::Agent >::iterator, std::vector< Core::Agent >::iterator >)
void LoadScenario(const std::string &filepath)
MainContent * m_MainContent
The main content of the main window.
MapDialog * m_ScenarioSettingsDialog
MenuBar * m_MenuBar
The menu bar of the main window.
void SaveScenario(const std::string &filepath)
void ScenarioCompiled(std::pair< CompileScenario::Scenario::RouteMap::iterator, CompileScenario::Scenario::RouteMap::iterator >)
MainWindow(QWidget *parent=nullptr)
Constructs the main window.
void ConnectSlotsAndSignals()
The MapDialog class represents a dialog window for inputting map data.
static KeyframeManager & Instance()
Returns the singleton instance of the KeyframeManager.
static MapManager & Instance()
Returns the singleton instance of the class.
void GotImage()
Signal emitted when the map image data has been retrieved.
static QColor getRandomColor()
A structure that represents a geographic coordinate.