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 @@ ...@@ -3,13 +3,13 @@
#include "Vehicle.hpp" #include "Vehicle.hpp"
#include <string> #include <string>
#include <string_view> #include <string_view>
class MapAppAPIWrapper; class MapWindowWrapper;
class Bicycle : public Vehicle { class Bicycle : public Vehicle {
public: public:
Bicycle(std::string name, double topSpeed, double timeOfStart, double time); 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 laneLength, double speedLimit) const override;
double getSpeed(double speedLimit) const override; double getSpeed(double speedLimit) const override;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "Vehicle.hpp" #include "Vehicle.hpp"
#include <string> #include <string>
#include <string_view> #include <string_view>
class MapAppAPIWrapper; class MapWindowWrapper;
class Car : public Vehicle { class Car : public Vehicle {
public: public:
...@@ -11,7 +11,7 @@ public: ...@@ -11,7 +11,7 @@ public:
Car(std::string name, double topSpeed, double timeOfStart, Car(std::string name, double topSpeed, double timeOfStart,
double fuelConsumption, double fuelCapacity, double time); 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 laneLength, double speedLimit) const override;
double getSpeed(double speedLimit) const override; double getSpeed(double speedLimit) const override;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <string_view> #include <string_view>
#include <vector> #include <vector>
class Vehicle; class Vehicle;
class MapAppAPIWrapper; class MapWindowWrapper;
class Junction : public Named { class Junction : public Named {
public: public:
...@@ -25,7 +25,7 @@ public: ...@@ -25,7 +25,7 @@ public:
void processVehicles(double time); void processVehicles(double time);
void drawVehicles(MapAppAPIWrapper &mapApp) const; void drawVehicles(MapWindowWrapper &mapWindow) const;
void createCar(std::string name, double topSpeed, double fuelConsumption, void createCar(std::string name, double topSpeed, double fuelConsumption,
double fuelCapacity, double timeOfStart, double time); double fuelCapacity, double timeOfStart, double time);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
class MapAppAPIWrapper; class MapWindowWrapper;
class Junction; class Junction;
class Lane : public Named { class Lane : public Named {
...@@ -16,7 +16,7 @@ public: ...@@ -16,7 +16,7 @@ public:
double speedLimit, bool noPassing, double speedLimit, bool noPassing,
std::weak_ptr<Junction> destinationJunction); std::weak_ptr<Junction> destinationJunction);
void drawVehicles(MapAppAPIWrapper &mapApp) const; void drawVehicles(MapWindowWrapper &mapWindow) const;
void processVehicles(double time); void processVehicles(double time);
......
#pragma once #pragma once
#include "MapAppAPIWrapper.hpp" #include "MapWindowWrapper.hpp"
#include <chrono> #include <chrono>
#include <iosfwd> #include <iosfwd>
#include <memory> #include <memory>
...@@ -18,19 +18,19 @@ public: ...@@ -18,19 +18,19 @@ public:
private: private:
double time; double time;
std::vector<std::shared_ptr<Junction>> junctions; std::vector<std::shared_ptr<Junction>> junctions;
MapAppAPIWrapper mapApp; MapWindowWrapper mapWindow;
std::weak_ptr<Junction> getJunction(std::string_view name); std::weak_ptr<Junction> getJunction(std::string_view name);
/// Required format: /// Required format:
/// `name` `fuelAmount` `x` `y` /// `name` `fuelAmount` `x` `y`
void extractJunctionAndDraw(std::istream &is, MapAppAPIWrapper &mapApp); void extractJunctionAndDraw(std::istream &is, MapWindowWrapper &mapWindow);
/// Required format: /// Required format:
/// `nameJunctionA` `nameJunctionB` `nameLaneAToB` `nameLaneBToA` /// `nameJunctionA` `nameJunctionB` `nameLaneAToB` `nameLaneBToA`
/// `length in km` `speedLimit in {1,2,3}` `noPassing` `coordinateCount` /// `length in km` `speedLimit in {1,2,3}` `noPassing` `coordinateCount`
/// `coordinates...` /// `coordinates...`
void extractRoadAndDraw(std::istream &is, MapAppAPIWrapper &mapApp); void extractRoadAndDraw(std::istream &is, MapWindowWrapper &mapWindow);
/// Required format: /// Required format:
/// `name` `topSpeed` `nameStartJunction` `timeOfStart` /// `name` `topSpeed` `nameStartJunction` `timeOfStart`
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
#include <chrono> #include <chrono>
#include <string_view> #include <string_view>
#include <vector> #include <vector>
struct MapApp; struct MapWindow;
class MapAppAPIWrapper { class MapWindowWrapper {
public: public:
MapAppAPIWrapper(std::string_view windowTitle); MapWindowWrapper(std::string_view windowTitle);
virtual ~MapAppAPIWrapper(); virtual ~MapWindowWrapper();
void addJunction(double x, double y); void addJunction(double x, double y);
void addRoad(std::string_view laneThereName, std::string_view laneBackName, void addRoad(std::string_view laneThereName, std::string_view laneBackName,
const std::vector<double> &coordinates); const std::vector<double> &coordinates);
...@@ -21,5 +21,5 @@ public: ...@@ -21,5 +21,5 @@ public:
void setTimeLabel(std::chrono::minutes time); void setTimeLabel(std::chrono::minutes time);
private: private:
MapApp *mapApp; MapWindow *mapWindow;
}; };
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
#include "Named.hpp" #include "Named.hpp"
#include <string> #include <string>
#include <string_view> #include <string_view>
class MapAppAPIWrapper; class MapWindowWrapper;
class Vehicle : public Named { class Vehicle : public Named {
public: 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 // 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; double laneLength, double speedLimit) const = 0;
/// \returns The current speed in km/h /// \returns The current speed in km/h
......
pi2_demo_inc = include_directories('include') pi2_demo_inc = include_directories('include')
pi2_demo_src = files( pi2_demo_src = files(
'src/Named.cpp',
'src/Bicycle.cpp', 'src/Bicycle.cpp',
'src/Vehicle.cpp',
'src/Junction.cpp',
'src/Car.cpp', 'src/Car.cpp',
'src/Junction.cpp',
'src/Lane.cpp', 'src/Lane.cpp',
'src/Map.cpp',
'src/main.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']) boost_po_dep = dependency('boost', modules : ['program_options'])
executable('pi2-demo', pi2_demo_src, executable('pi2-demo', pi2_demo_src,
......
#include "Bicycle.hpp" #include "Bicycle.hpp"
#include "MapAppAPIWrapper.hpp" #include "MapWindowWrapper.hpp"
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <utility> #include <utility>
...@@ -8,11 +8,11 @@ Bicycle::Bicycle(std::string name, const double topSpeed, ...@@ -8,11 +8,11 @@ Bicycle::Bicycle(std::string name, const double topSpeed,
const double timeOfStart, const double time) const double timeOfStart, const double time)
: Vehicle(std::move(name), topSpeed, timeOfStart, 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 double laneLength, const double speedLimit) const {
const auto positionOnLane = getDistanceOnLane() / laneLength; const auto positionOnLane = getDistanceOnLane() / laneLength;
mapApp.addOrReplaceBicycle(getName(), laneName, positionOnLane, mapWindow.addOrReplaceBicycle(getName(), laneName, positionOnLane,
getSpeed(speedLimit)); getSpeed(speedLimit));
} }
double Bicycle::getSpeed(const double speedLimit) const { double Bicycle::getSpeed(const double speedLimit) const {
......
#include "Car.hpp" #include "Car.hpp"
#include "MapAppAPIWrapper.hpp" #include "MapWindowWrapper.hpp"
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
...@@ -10,11 +10,11 @@ Car::Car(std::string name, const double topSpeed, const double timeOfStart, ...@@ -10,11 +10,11 @@ Car::Car(std::string name, const double topSpeed, const double timeOfStart,
fuelConsumption(fuelConsumption), fuelCapacity(fuelCapacity), fuelConsumption(fuelConsumption), fuelCapacity(fuelCapacity),
fuel(fuelCapacity / 2) {} 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 double laneLength, const double speedLimit) const {
const auto positionOnLane = getDistanceOnLane() / laneLength; const auto positionOnLane = getDistanceOnLane() / laneLength;
mapApp.addOrReplaceCar(getName(), laneName, positionOnLane, mapWindow.addOrReplaceCar(getName(), laneName, positionOnLane,
getSpeed(speedLimit), fuel); getSpeed(speedLimit), fuel);
} }
double Car::getSpeed(const double speedLimit) const { double Car::getSpeed(const double speedLimit) const {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <random> #include <random>
#include <typeinfo> #include <typeinfo>
#include <utility> #include <utility>
class MapAppAPIWrapper; class MapWindowWrapper;
void Junction::connect(const std::weak_ptr<Junction> &junctionA, void Junction::connect(const std::weak_ptr<Junction> &junctionA,
const std::weak_ptr<Junction> &junctionB, const std::weak_ptr<Junction> &junctionB,
...@@ -33,9 +33,9 @@ void Junction::processVehicles(const double time) { ...@@ -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) { for (auto &&weg : outboundLanes) {
weg.drawVehicles(mapApp); weg.drawVehicles(mapWindow);
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include <utility> #include <utility>
class MapAppAPIWrapper; class MapWindowWrapper;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
Lane::Lane(Lane &&other) noexcept = default; Lane::Lane(Lane &&other) noexcept = default;
...@@ -19,9 +19,9 @@ Lane::Lane(std::string name, std::string oppositeLaneName, const double length, ...@@ -19,9 +19,9 @@ Lane::Lane(std::string name, std::string oppositeLaneName, const double length,
oppositeLaneName(std::move(oppositeLaneName)), speedLimit(speedLimit), oppositeLaneName(std::move(oppositeLaneName)), speedLimit(speedLimit),
noPassing(noPassing) {} noPassing(noPassing) {}
void Lane::drawVehicles(MapAppAPIWrapper &mapApp) const { void Lane::drawVehicles(MapWindowWrapper &mapWindow) const {
for (auto &&fahrzeug : vehicles) { for (auto &&fahrzeug : vehicles) {
fahrzeug->draw(mapApp, getName(), length, speedLimit); fahrzeug->draw(mapWindow, getName(), length, speedLimit);
} }
} }
......
#include "Map.hpp" #include "Map.hpp"
#include "Junction.hpp" #include "Junction.hpp"
#include "MapAppAPIWrapper.hpp" #include "MapWindowWrapper.hpp"
#include <algorithm> #include <algorithm>
#include <chrono> #include <chrono>
#include <cstddef> #include <cstddef>
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
#include <vector> #include <vector>
Map::Map(std::istream &is, std::string_view windowTitle) Map::Map(std::istream &is, std::string_view windowTitle)
: time(0), mapApp(windowTitle) { : time(0), mapWindow(windowTitle) {
std::string type; std::string type;
while (is >> type) { while (is >> type) {
if (type == "KREUZUNG") { if (type == "KREUZUNG") {
extractJunctionAndDraw(is, mapApp); extractJunctionAndDraw(is, mapWindow);
} else if (type == "STRASSE") { } else if (type == "STRASSE") {
extractRoadAndDraw(is, mapApp); extractRoadAndDraw(is, mapWindow);
} else if (type == "PKW") { } else if (type == "PKW") {
extractCar(is); extractCar(is);
} else if (type == "FAHRRAD") { } else if (type == "FAHRRAD") {
...@@ -38,9 +38,9 @@ void Map::simulate(const std::chrono::seconds duration, ...@@ -38,9 +38,9 @@ void Map::simulate(const std::chrono::seconds duration,
time += static_cast<double>(duration.count()) / 60 / 60 / count; time += static_cast<double>(duration.count()) / 60 / 60 / count;
for (auto &&junction : junctions) { for (auto &&junction : junctions) {
junction->processVehicles(time); 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( std::this_thread::sleep_for(std::chrono::nanoseconds(
static_cast<size_t>(std::nano::den / frequency))); static_cast<size_t>(std::nano::den / frequency)));
} }
...@@ -52,7 +52,8 @@ std::weak_ptr<Junction> Map::getJunction(std::string_view name) { ...@@ -52,7 +52,8 @@ std::weak_ptr<Junction> Map::getJunction(std::string_view name) {
[&name](const auto &junction) { return junction->getName() == 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; std::string name;
double fuelAmount; double fuelAmount;
is >> name >> fuelAmount; is >> name >> fuelAmount;
...@@ -61,10 +62,10 @@ void Map::extractJunctionAndDraw(std::istream &is, MapAppAPIWrapper &mapApp) { ...@@ -61,10 +62,10 @@ void Map::extractJunctionAndDraw(std::istream &is, MapAppAPIWrapper &mapApp) {
int x; int x;
int y; int y;
is >> x >> 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 nameJunctionA;
std::string nameJunctionB; std::string nameJunctionB;
std::string nameLaneAToB; std::string nameLaneAToB;
...@@ -103,7 +104,7 @@ void Map::extractRoadAndDraw(std::istream &is, MapAppAPIWrapper &mapApp) { ...@@ -103,7 +104,7 @@ void Map::extractRoadAndDraw(std::istream &is, MapAppAPIWrapper &mapApp) {
is >> x; is >> x;
return x; return x;
}); });
mapApp.addRoad(nameLaneAToB, nameLaneBToA, coordinates); mapWindow.addRoad(nameLaneAToB, nameLaneBToA, coordinates);
} }
void Map::extractBicycle(std::istream &is) { void Map::extractBicycle(std::istream &is) {
......
#include "MapAppAPIWrapper.hpp" #include "MapWindowWrapper.hpp"
#include <pi2-view.h> #include <pi2-view.h>
#include <string_view> #include <string_view>
#include <vector> #include <vector>
MapAppAPIWrapper::MapAppAPIWrapper(std::string_view windowTitle) MapWindowWrapper::MapWindowWrapper(std::string_view windowTitle)
: mapApp(mapAppCreate(windowTitle.data())) {} : mapWindow(mapWindowCreate(windowTitle.data())) {}
MapAppAPIWrapper::~MapAppAPIWrapper() { MapWindowWrapper::~MapWindowWrapper() {
mapAppDestroy(mapApp); mapWindowDestroy(mapWindow);
mapApp = nullptr; mapWindow = nullptr;
} }
void MapAppAPIWrapper::addJunction(const double x, const double y) { void MapWindowWrapper::addJunction(const double x, const double y) {
mapAppAddJunction(mapApp, x, y); mapWindowAddJunction(mapWindow, x, y);
} }
void MapAppAPIWrapper::addRoad(std::string_view laneThereName, void MapWindowWrapper::addRoad(std::string_view laneThereName,
std::string_view laneBackName, std::string_view laneBackName,
const std::vector<double> &coordinates) { const std::vector<double> &coordinates) {
mapAppAddRoad(mapApp, laneThereName.data(), laneBackName.data(), mapWindowAddRoad(mapWindow, laneThereName.data(), laneBackName.data(),
coordinates.data(), coordinates.size()); coordinates.data(), coordinates.size());
} }
void MapAppAPIWrapper::addOrReplaceBicycle(std::string_view vehicleName, void MapWindowWrapper::addOrReplaceBicycle(std::string_view vehicleName,
std::string_view laneName, std::string_view laneName,
const double positionOnLane, const double positionOnLane,
const double speed) { const double speed) {
mapAppAddOrReplaceBicycle(mapApp, vehicleName.data(), laneName.data(), mapWindowAddOrReplaceBicycle(mapWindow, vehicleName.data(), laneName.data(),
positionOnLane, speed); positionOnLane, speed);
} }
void MapAppAPIWrapper::addOrReplaceCar(std::string_view vehicleName, void MapWindowWrapper::addOrReplaceCar(std::string_view vehicleName,
std::string_view laneName, std::string_view laneName,
const double positionOnLane, const double positionOnLane,
const double speed, const double speed,
const double remainingFuel) { const double remainingFuel) {
mapAppAddOrReplaceCar(mapApp, vehicleName.data(), laneName.data(), mapWindowAddOrReplaceCar(mapWindow, vehicleName.data(), laneName.data(),
positionOnLane, speed, remainingFuel); positionOnLane, speed, remainingFuel);
} }
void MapAppAPIWrapper::setTimeLabel(const std::chrono::minutes time) { void MapWindowWrapper::setTimeLabel(const std::chrono::minutes time) {
mapAppSetTimeLabel(mapApp, time.count()); 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" { ...@@ -8,67 +8,67 @@ extern "C" {
#endif #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 * The coordinates \p x and \p y mark the middle of the junction and represent
* amounts of pixels. * 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 * \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. * The coordinates have to be alternating values of x and y in pixels.
* \param coordinateCount The count of \p coordinates * \param coordinateCount The count of \p coordinates
*/ */
void mapAppAddRoad(MapApp *mapApp, const char *laneThereName, void mapWindowAddRoad(MapWindow *mapWindow, const char *laneThereName,
const char *laneBackName, const double *coordinates, const char *laneBackName, const double *coordinates,
size_t coordinateCount); 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 * \param positionOnLane The relative position of the vehicle on its lane
* has to be between 0 and 1. * has to be between 0 and 1.
*/ */
void mapAppAddOrReplaceBicycle(MapApp *mapApp, const char *vehicleName, void mapWindowAddOrReplaceBicycle(MapWindow *mapWindow, const char *vehicleName,
const char *roadName, double positionOnLane, const char *roadName, double positionOnLane,
double speed); 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 * \param positionOnLane The relative position of the vehicle on its lane
* has to be between 0 and 1. * has to be between 0 and 1.
*/ */
void mapAppAddOrReplaceCar(MapApp *mapApp, const char *vehicleName, void mapWindowAddOrReplaceCar(MapWindow *mapWindow, const char *vehicleName,
const char *roadName, double positionOnLane, const char *roadName, double positionOnLane,
double speed, double remainingFuel); 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 #ifdef __cplusplus
} }
......
...@@ -4,10 +4,10 @@ pi2_view_src = files( ...@@ -4,10 +4,10 @@ pi2_view_src = files(
'src/DrawableJunction.cpp', 'src/DrawableJunction.cpp',
'src/DrawableRoad.cpp', 'src/DrawableRoad.cpp',
'src/DrawableVehicle.cpp', 'src/DrawableVehicle.cpp',