Commit 0bf630e5 authored by Martin Kröning's avatar Martin Kröning

Further seperate MapWindow from MapApplication

Rename MapAppAPIWrapper to MapWindowWrapper and MapApp to MapApplication
parent 1d9dcda7
......@@ -3,13 +3,13 @@
#include "Vehicle.hpp"
#include <string>
#include <string_view>
class MapAppAPIWrapper;
class MapWindowWrapper;
class Bicycle : public Vehicle {
public:
Bicycle(std::string name, double topSpeed, double timeOfStart, double time);
void draw(MapAppAPIWrapper &mapApp, std::string_view laneName,
void draw(MapWindowWrapper &mapWindow, std::string_view laneName,
double laneLength, double speedLimit) const override;
double getSpeed(double speedLimit) const override;
......
......@@ -3,7 +3,7 @@
#include "Vehicle.hpp"
#include <string>
#include <string_view>
class MapAppAPIWrapper;
class MapWindowWrapper;
class Car : public Vehicle {
public:
......@@ -11,7 +11,7 @@ public:
Car(std::string name, double topSpeed, double timeOfStart,
double fuelConsumption, double fuelCapacity, double time);
void draw(MapAppAPIWrapper &mapApp, std::string_view laneName,
void draw(MapWindowWrapper &mapWindow, std::string_view laneName,
double laneLength, double speedLimit) const override;
double getSpeed(double speedLimit) const override;
......
......@@ -8,7 +8,7 @@
#include <string_view>
#include <vector>
class Vehicle;
class MapAppAPIWrapper;
class MapWindowWrapper;
class Junction : public Named {
public:
......@@ -25,7 +25,7 @@ public:
void processVehicles(double time);
void drawVehicles(MapAppAPIWrapper &mapApp) const;
void drawVehicles(MapWindowWrapper &mapWindow) const;
void createCar(std::string name, double topSpeed, double fuelConsumption,
double fuelCapacity, double timeOfStart, double time);
......
......@@ -5,7 +5,7 @@
#include <memory>
#include <string>
#include <vector>
class MapAppAPIWrapper;
class MapWindowWrapper;
class Junction;
class Lane : public Named {
......@@ -16,7 +16,7 @@ public:
double speedLimit, bool noPassing,
std::weak_ptr<Junction> destinationJunction);
void drawVehicles(MapAppAPIWrapper &mapApp) const;
void drawVehicles(MapWindowWrapper &mapWindow) const;
void processVehicles(double time);
......
#pragma once
#include "MapAppAPIWrapper.hpp"
#include "MapWindowWrapper.hpp"
#include <chrono>
#include <iosfwd>
#include <memory>
......@@ -18,19 +18,19 @@ public:
private:
double time;
std::vector<std::shared_ptr<Junction>> junctions;
MapAppAPIWrapper mapApp;
MapWindowWrapper mapWindow;
std::weak_ptr<Junction> getJunction(std::string_view name);
/// Required format:
/// `name` `fuelAmount` `x` `y`
void extractJunctionAndDraw(std::istream &is, MapAppAPIWrapper &mapApp);
void extractJunctionAndDraw(std::istream &is, MapWindowWrapper &mapWindow);
/// Required format:
/// `nameJunctionA` `nameJunctionB` `nameLaneAToB` `nameLaneBToA`
/// `length in km` `speedLimit in {1,2,3}` `noPassing` `coordinateCount`
/// `coordinates...`
void extractRoadAndDraw(std::istream &is, MapAppAPIWrapper &mapApp);
void extractRoadAndDraw(std::istream &is, MapWindowWrapper &mapWindow);
/// Required format:
/// `name` `topSpeed` `nameStartJunction` `timeOfStart`
......
......@@ -3,12 +3,12 @@
#include <chrono>
#include <string_view>
#include <vector>
struct MapApp;
struct MapWindow;
class MapAppAPIWrapper {
class MapWindowWrapper {
public:
MapAppAPIWrapper(std::string_view windowTitle);
virtual ~MapAppAPIWrapper();
MapWindowWrapper(std::string_view windowTitle);
virtual ~MapWindowWrapper();
void addJunction(double x, double y);
void addRoad(std::string_view laneThereName, std::string_view laneBackName,
const std::vector<double> &coordinates);
......@@ -21,5 +21,5 @@ public:
void setTimeLabel(std::chrono::minutes time);
private:
MapApp *mapApp;
MapWindow *mapWindow;
};
......@@ -3,13 +3,13 @@
#include "Named.hpp"
#include <string>
#include <string_view>
class MapAppAPIWrapper;
class MapWindowWrapper;
class Vehicle : public Named {
public:
// Draws the vehicle on the provided \p mapApp on the specified \p laneName
// Draws the vehicle on the provided \p mapWindow on the specified \p laneName
// which has a \p laneLength and a \p speedLimit
virtual void draw(MapAppAPIWrapper &mapApp, std::string_view laneName,
virtual void draw(MapWindowWrapper &mapWindow, std::string_view laneName,
double laneLength, double speedLimit) const = 0;
/// \returns The current speed in km/h
......
pi2_demo_inc = include_directories('include')
pi2_demo_src = files(
'src/Named.cpp',
'src/Bicycle.cpp',
'src/Vehicle.cpp',
'src/Junction.cpp',
'src/Car.cpp',
'src/Junction.cpp',
'src/Lane.cpp',
'src/Map.cpp',
'src/main.cpp',
'src/MapAppAPIWrapper.cpp'
'src/Map.cpp',
'src/MapWindowWrapper.cpp',
'src/Named.cpp',
'src/Vehicle.cpp',
)
boost_po_dep = dependency('boost', modules : ['program_options'])
executable('pi2-demo', pi2_demo_src,
......
#include "Bicycle.hpp"
#include "MapAppAPIWrapper.hpp"
#include "MapWindowWrapper.hpp"
#include <algorithm>
#include <cmath>
#include <utility>
......@@ -8,11 +8,11 @@ Bicycle::Bicycle(std::string name, const double topSpeed,
const double timeOfStart, const double time)
: Vehicle(std::move(name), topSpeed, timeOfStart, time) {}
void Bicycle::draw(MapAppAPIWrapper &mapApp, std::string_view laneName,
void Bicycle::draw(MapWindowWrapper &mapWindow, std::string_view laneName,
const double laneLength, const double speedLimit) const {
const auto positionOnLane = getDistanceOnLane() / laneLength;
mapApp.addOrReplaceBicycle(getName(), laneName, positionOnLane,
getSpeed(speedLimit));
mapWindow.addOrReplaceBicycle(getName(), laneName, positionOnLane,
getSpeed(speedLimit));
}
double Bicycle::getSpeed(const double speedLimit) const {
......
#include "Car.hpp"
#include "MapAppAPIWrapper.hpp"
#include "MapWindowWrapper.hpp"
#include <algorithm>
#include <utility>
......@@ -10,11 +10,11 @@ Car::Car(std::string name, const double topSpeed, const double timeOfStart,
fuelConsumption(fuelConsumption), fuelCapacity(fuelCapacity),
fuel(fuelCapacity / 2) {}
void Car::draw(MapAppAPIWrapper &mapApp, std::string_view laneName,
void Car::draw(MapWindowWrapper &mapWindow, std::string_view laneName,
const double laneLength, const double speedLimit) const {
const auto positionOnLane = getDistanceOnLane() / laneLength;
mapApp.addOrReplaceCar(getName(), laneName, positionOnLane,
getSpeed(speedLimit), fuel);
mapWindow.addOrReplaceCar(getName(), laneName, positionOnLane,
getSpeed(speedLimit), fuel);
}
double Car::getSpeed(const double speedLimit) const {
......
......@@ -5,7 +5,7 @@
#include <random>
#include <typeinfo>
#include <utility>
class MapAppAPIWrapper;
class MapWindowWrapper;
void Junction::connect(const std::weak_ptr<Junction> &junctionA,
const std::weak_ptr<Junction> &junctionB,
......@@ -33,9 +33,9 @@ void Junction::processVehicles(const double time) {
}
}
void Junction::drawVehicles(MapAppAPIWrapper &mapApp) const {
void Junction::drawVehicles(MapWindowWrapper &mapWindow) const {
for (auto &&weg : outboundLanes) {
weg.drawVehicles(mapApp);
weg.drawVehicles(mapWindow);
}
}
......
......@@ -6,7 +6,7 @@
#include <algorithm>
#include <memory>
#include <utility>
class MapAppAPIWrapper;
class MapWindowWrapper;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
Lane::Lane(Lane &&other) noexcept = default;
......@@ -19,9 +19,9 @@ Lane::Lane(std::string name, std::string oppositeLaneName, const double length,
oppositeLaneName(std::move(oppositeLaneName)), speedLimit(speedLimit),
noPassing(noPassing) {}
void Lane::drawVehicles(MapAppAPIWrapper &mapApp) const {
void Lane::drawVehicles(MapWindowWrapper &mapWindow) const {
for (auto &&fahrzeug : vehicles) {
fahrzeug->draw(mapApp, getName(), length, speedLimit);
fahrzeug->draw(mapWindow, getName(), length, speedLimit);
}
}
......
#include "Map.hpp"
#include "Junction.hpp"
#include "MapAppAPIWrapper.hpp"
#include "MapWindowWrapper.hpp"
#include <algorithm>
#include <chrono>
#include <cstddef>
......@@ -15,13 +15,13 @@
#include <vector>
Map::Map(std::istream &is, std::string_view windowTitle)
: time(0), mapApp(windowTitle) {
: time(0), mapWindow(windowTitle) {
std::string type;
while (is >> type) {
if (type == "KREUZUNG") {
extractJunctionAndDraw(is, mapApp);
extractJunctionAndDraw(is, mapWindow);
} else if (type == "STRASSE") {
extractRoadAndDraw(is, mapApp);
extractRoadAndDraw(is, mapWindow);
} else if (type == "PKW") {
extractCar(is);
} else if (type == "FAHRRAD") {
......@@ -38,9 +38,9 @@ void Map::simulate(const std::chrono::seconds duration,
time += static_cast<double>(duration.count()) / 60 / 60 / count;
for (auto &&junction : junctions) {
junction->processVehicles(time);
junction->drawVehicles(mapApp);
junction->drawVehicles(mapWindow);
}
mapApp.setTimeLabel(std::chrono::minutes(static_cast<int>(time * 60)));
mapWindow.setTimeLabel(std::chrono::minutes(static_cast<int>(time * 60)));
std::this_thread::sleep_for(std::chrono::nanoseconds(
static_cast<size_t>(std::nano::den / frequency)));
}
......@@ -52,7 +52,8 @@ std::weak_ptr<Junction> Map::getJunction(std::string_view name) {
[&name](const auto &junction) { return junction->getName() == name; });
}
void Map::extractJunctionAndDraw(std::istream &is, MapAppAPIWrapper &mapApp) {
void Map::extractJunctionAndDraw(std::istream &is,
MapWindowWrapper &mapWindow) {
std::string name;
double fuelAmount;
is >> name >> fuelAmount;
......@@ -61,10 +62,10 @@ void Map::extractJunctionAndDraw(std::istream &is, MapAppAPIWrapper &mapApp) {
int x;
int y;
is >> x >> y;
mapApp.addJunction(x, y);
mapWindow.addJunction(x, y);
}
void Map::extractRoadAndDraw(std::istream &is, MapAppAPIWrapper &mapApp) {
void Map::extractRoadAndDraw(std::istream &is, MapWindowWrapper &mapWindow) {
std::string nameJunctionA;
std::string nameJunctionB;
std::string nameLaneAToB;
......@@ -103,7 +104,7 @@ void Map::extractRoadAndDraw(std::istream &is, MapAppAPIWrapper &mapApp) {
is >> x;
return x;
});
mapApp.addRoad(nameLaneAToB, nameLaneBToA, coordinates);
mapWindow.addRoad(nameLaneAToB, nameLaneBToA, coordinates);
}
void Map::extractBicycle(std::istream &is) {
......
#include "MapAppAPIWrapper.hpp"
#include "MapWindowWrapper.hpp"
#include <pi2-view.h>
#include <string_view>
#include <vector>
MapAppAPIWrapper::MapAppAPIWrapper(std::string_view windowTitle)
: mapApp(mapAppCreate(windowTitle.data())) {}
MapWindowWrapper::MapWindowWrapper(std::string_view windowTitle)
: mapWindow(mapWindowCreate(windowTitle.data())) {}
MapAppAPIWrapper::~MapAppAPIWrapper() {
mapAppDestroy(mapApp);
mapApp = nullptr;
MapWindowWrapper::~MapWindowWrapper() {
mapWindowDestroy(mapWindow);
mapWindow = nullptr;
}
void MapAppAPIWrapper::addJunction(const double x, const double y) {
mapAppAddJunction(mapApp, x, y);
void MapWindowWrapper::addJunction(const double x, const double y) {
mapWindowAddJunction(mapWindow, x, y);
}
void MapAppAPIWrapper::addRoad(std::string_view laneThereName,
void MapWindowWrapper::addRoad(std::string_view laneThereName,
std::string_view laneBackName,
const std::vector<double> &coordinates) {
mapAppAddRoad(mapApp, laneThereName.data(), laneBackName.data(),
coordinates.data(), coordinates.size());
mapWindowAddRoad(mapWindow, laneThereName.data(), laneBackName.data(),
coordinates.data(), coordinates.size());
}
void MapAppAPIWrapper::addOrReplaceBicycle(std::string_view vehicleName,
void MapWindowWrapper::addOrReplaceBicycle(std::string_view vehicleName,
std::string_view laneName,
const double positionOnLane,
const double speed) {
mapAppAddOrReplaceBicycle(mapApp, vehicleName.data(), laneName.data(),
positionOnLane, speed);
mapWindowAddOrReplaceBicycle(mapWindow, vehicleName.data(), laneName.data(),
positionOnLane, speed);
}
void MapAppAPIWrapper::addOrReplaceCar(std::string_view vehicleName,
void MapWindowWrapper::addOrReplaceCar(std::string_view vehicleName,
std::string_view laneName,
const double positionOnLane,
const double speed,
const double remainingFuel) {
mapAppAddOrReplaceCar(mapApp, vehicleName.data(), laneName.data(),
positionOnLane, speed, remainingFuel);
mapWindowAddOrReplaceCar(mapWindow, vehicleName.data(), laneName.data(),
positionOnLane, speed, remainingFuel);
}
void MapAppAPIWrapper::setTimeLabel(const std::chrono::minutes time) {
mapAppSetTimeLabel(mapApp, time.count());
void MapWindowWrapper::setTimeLabel(const std::chrono::minutes time) {
mapWindowSetTimeLabel(mapWindow, time.count());
}
#pragma once
#include "MapWindow.hpp"
#include <chrono>
#include <string>
#include <thread>
#include <valarray>
#include <vector>
namespace Glib {
template <class T_CppObject> class RefPtr;
}
namespace Gtk {
class Application;
}
class MapApp {
public:
MapApp(std::string windowTitle);
virtual ~MapApp();
void addJunction(double x, double y);
void addRoad(std::string laneThereName, std::string laneBackName,
std::vector<std::valarray<double>> coordinates);
void addOrReplaceBicycle(const std::string &vehicleName,
const std::string &laneName, double positionOnLane,
double speed);
void addOrReplaceCar(const std::string &vehicleName,
const std::string &laneName, double positionOnLane,
double speed, double remainingFuel);
void setTimeLabel(std::chrono::minutes time);
private:
static Glib::RefPtr<Gtk::Application> app;
static std::thread thread;
MapWindow mapWindow;
};
#pragma once
#include <thread>
namespace Glib {
template <class T_CppObject> class RefPtr;
}
namespace Gtk {
class Application;
class Window;
} // namespace Gtk
class MapApplication {
public:
static void addWindow(Gtk::Window &window);
static void removeWindow(Gtk::Window &window);
private:
static Glib::RefPtr<Gtk::Application> application;
static std::thread thread;
};
......@@ -8,67 +8,67 @@ extern "C" {
#endif
/**
* The application to show a map, a list of vehicles and additional information
* A window showing a map, a list of vehicles and additional information
*/
struct MapApp;
struct MapWindow;
/**
* Creates a MapApp and opens the corresponding window.
* Creates and opens a MapWindow.
*
* You *have* to call mapAppDestroy(MapApp *) to avoid memory leaks.
* You *have* to call mapWindowDestroy(MapWindow *) to avoid memory leaks.
*
* \returns A pointer to the created MapApp
* \returns A pointer to the created MapWindow
*/
MapApp *mapAppCreate(const char *windowTitle);
MapWindow *mapWindowCreate(const char *windowTitle);
/**
* Destroys \p mapApp and frees its memory.
* Closes and destroys \p mapWindow and frees its memory.
*/
void mapAppDestroy(MapApp *mapApp);
void mapWindowDestroy(MapWindow *mapWindow);
/**
* Adds a junction to \p mapApp
* Adds a junction to \p mapWindow
*
* The coordinates \p x and \p y mark the middle of the junction and represent
* amounts of pixels.
*/
void mapAppAddJunction(MapApp *mapApp, double x, double y);
void mapWindowAddJunction(MapWindow *mapWindow, double x, double y);
/**
* Adds a road to \p mapApp
* Adds a road to \p mapWindow
*
* \param coordinates A pointer to the begin of an array of the coordinates
* The coordinates have to be alternating values of x and y in pixels.
* \param coordinateCount The count of \p coordinates
*/
void mapAppAddRoad(MapApp *mapApp, const char *laneThereName,
const char *laneBackName, const double *coordinates,
size_t coordinateCount);
void mapWindowAddRoad(MapWindow *mapWindow, const char *laneThereName,
const char *laneBackName, const double *coordinates,
size_t coordinateCount);
/**
* Adds or replaces a bicycle to/in \p mapApp
* Adds or replaces a bicycle to/in \p mapWindow
*
* \param positionOnLane The relative position of the vehicle on its lane
* has to be between 0 and 1.
*/
void mapAppAddOrReplaceBicycle(MapApp *mapApp, const char *vehicleName,
const char *roadName, double positionOnLane,
double speed);
void mapWindowAddOrReplaceBicycle(MapWindow *mapWindow, const char *vehicleName,
const char *roadName, double positionOnLane,
double speed);
/**
* Adds or replaces a car to/in \p mapApp
* Adds or replaces a car to/in \p mapWindow
*
* \param positionOnLane The relative position of the vehicle on its lane
* has to be between 0 and 1.
*/
void mapAppAddOrReplaceCar(MapApp *mapApp, const char *vehicleName,
const char *roadName, double positionOnLane,
double speed, double remainingFuel);
void mapWindowAddOrReplaceCar(MapWindow *mapWindow, const char *vehicleName,
const char *roadName, double positionOnLane,
double speed, double remainingFuel);
/**
* Sets the time label of \p mapApp to \p minutes
* Sets the time label of \p mapWindow to \p minutes
*/
void mapAppSetTimeLabel(MapApp *mapApp, int64_t minutes);
void mapWindowSetTimeLabel(MapWindow *mapWindow, int64_t minutes);
#ifdef __cplusplus
}
......
......@@ -4,10 +4,10 @@ pi2_view_src = files(
'src/DrawableJunction.cpp',
'src/DrawableRoad.cpp',
'src/DrawableVehicle.cpp',
'src/MapApp.cpp',
'src/MapApplication.cpp',
'src/MapArea.cpp',
'src/MapWindow.cpp',
'src/pi2-view.cpp'
'src/pi2-view.cpp',
)
gnome = import('gnome')
ui_resources = gnome.compile_resources(
......
#include "MapApp.hpp"
#include <glibmm/refptr.h>
#include <gtkmm/application.h>
Glib::RefPtr<Gtk::Application> MapApp::app = Gtk::Application::create();
std::thread MapApp::thread;
MapApp::MapApp(std::string windowTitle) : mapWindow(windowTitle) {
if (app->get_windows().empty()) {
thread = std::thread([this]() {
app = Gtk::Application::create();
app->run(mapWindow);
});
} else {
app->add_window(mapWindow);
mapWindow.show();
}
}
MapApp::~MapApp() {
app->remove_window(mapWindow);
if (thread.joinable() && app->get_windows().empty()) {
thread.join();
}
}
void MapApp::setTimeLabel(const std::chrono::minutes minutes) {
mapWindow.setTimeLabel(minutes);
}
void MapApp::addJunction(const double x, const double y) {
mapWindow.addJunction(x, y);
}
void MapApp::addRoad(std::string laneThereName, std::string laneBackName,
std::vector<std::valarray<double>> coordinates) {
mapWindow.addRoad(laneThereName, laneBackName, coordinates);
}
void MapApp::addOrReplaceBicycle(const std::string &vehicleName,
const std::string &laneName,
const double positionOnLane,
const double speed) {
mapWindow.addOrReplaceBicycle(vehicleName, laneName, positionOnLane, speed);
}
void MapApp::addOrReplaceCar(const std::string &vehicleName,
const std::string &laneName,
const double positionOnLane, const double speed,
const double remainingFuel) {
mapWindow.addOrReplaceCar(vehicleName, laneName, positionOnLane, speed,
remainingFuel);
}
#include "MapApplication.hpp"
#include <glibmm/refptr.h>
#include <gtkmm/application.h>
#include <gtkmm/window.h>
#include <vector>
Glib::RefPtr<Gtk::Application> MapApplication::application =
Gtk::Application::create();
std::thread MapApplication::thread;
void MapApplication::addWindow(Gtk::Window &window) {
if (application->get_windows().empty()) {
thread = std::thread([&window]() {
application = Gtk::Application::create();
application->run(window);
});
} else {
application->add_window(window);
window.show();
}
}
void MapApplication::removeWindow(Gtk::Window &window) {
application->remove_window(window);
if (thread.joinable() && application->get_windows().empty()) {
thread.join();
}
}
......@@ -129,11 +129,11 @@ void MapWindow::refreshVehicleLabels(const DrawableVehicle &vehicle) {
remainingFuelLabel->set_text(remainingFuelBuffer.str());
}
void MapWindow::setTimeLabel(const std::chrono::minutes minutes) {
void MapWindow::setTimeLabel(const std::chrono::minutes time) {
std::ostringstream timeBuffer;
timeBuffer << std::setfill('0') << std::setw(2)
<< std::chrono::duration_cast<std::chrono::hours>(minutes).count()
<< ':' << std::setw(2) << minutes.count() % 60;
<< std::chrono::duration_cast<std::chrono::hours>(time).count()
<< ':' << std::setw(2) << time.count() % 60;
Glib::signal_idle().connect_once(
[this, timeString = timeBuffer.str()]() mutable {
timeLabel->set_text(std::move(timeString));
......
#include "pi2-view.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmismatched-tags"
#include "MapApp.hpp"
#include "MapWindow.hpp"
#pragma clang diagnostic pop
#include "MapApplication.hpp"
#include <algorithm>
#include <chrono>
#include <gsl/pointers>
......@@ -12,19 +13,25 @@
#include <valarray>
#include <vector>
gsl::owner<MapApp *> mapAppCreate(gsl::czstring<> windowTitle) {
return new MapApp(windowTitle);
gsl::owner<MapWindow *> mapWindowCreate(gsl::czstring<> windowTitle) {
auto mapWindow = new MapWindow(windowTitle);
MapApplication::addWindow(*mapWindow);
return mapWindow;
}
void mapAppDestroy(gsl::owner<MapApp *> mapApp) { delete mapApp; }
void mapWindowDestroy(gsl::owner<MapWindow *> mapWindow) {
MapApplication::removeWindow(*mapWindow);
delete mapWindow;
}
void mapAppAddJunction(MapApp *mapApp, const double x, const double y) {
mapApp->addJunction(x, y);
void mapWindowAddJunction(MapWindow *mapWindow, const double x,
const double y) {
mapWindow->addJunction(x, y);
}
void mapAppAddRoad(MapApp *mapApp, gsl::czstring<> laneThereName,
gsl::czstring<> laneBackName, const double coordinates[],
const size_t coordinateCount) {
void mapWindowAddRoad(MapWindow *mapWindow, gsl::czstring<> laneThereName,
gsl::czstring<> laneBackName, const double coordinates[],
const size_t coordinateCount) {
const gsl::span<const double> coordinatesSpan(coordinates, coordinateCount);
std::vector<std::valarray<double>> coordinateVector(coordinateCount / 2);
std::generate(coordinateVector.begin(), coordinateVector.end(),
......@@ -32,24 +39,25 @@ void mapAppAddRoad(MapApp *mapApp, gsl::czstring<> laneThereName,
return std::valarray<double>(
{coordinatesSpan.at(i++), coordinatesSpan(i++)});
});
mapApp->addRoad(laneThereName, laneBackName, coordinateVector);
mapWindow->addRoad(laneThereName, laneBackName, coordinateVector);
}
void mapAppAddOrReplaceBicycle(MapApp *mapApp, gsl::czstring<> vehicleName,
gsl::czstring<> roadName,
const double positionOnLane,
const double speed) {
mapApp->addOrReplaceBicycle(vehicleName, roadName, positionOnLane, speed);
void mapWindowAddOrReplaceBicycle(MapWindow *mapWindow,
gsl::czstring<> vehicleName,
gsl::czstring<> roadName,
const double positionOnLane,
const double speed) {
mapWindow->addOrReplaceBicycle(vehicleName, roadName, positionOnLane, speed);
}
void mapAppAddOrReplaceCar(MapApp *mapApp, gsl::czstring<> vehicleName,
gsl::czstring<> roadName,
const double positionOnLane, const double speed,
const double remainingFuel) {