Commit f44058a5 authored by Martin Kröning's avatar Martin Kröning

Add documentation to MapWindowWrapper

parent 48f8a3b4
......@@ -7,18 +7,41 @@
#include <vector>
struct MapWindow;
/// A window showing a map, a list of vehicles and additional information
class MapWindowWrapper {
public:
/// Opens a MapWindow with \p windowTitle.
MapWindowWrapper(std::string_view windowTitle);
/// Adds a junction
///
/// The coordinates \p x and \p y mark the middle of the junction and
/// represent amounts of pixels.
void addJunction(double x, double y);
/// Adds a road
///
/// The coordinates have to be alternating values of x and y in pixels.
void addRoad(std::string_view laneThereName, std::string_view laneBackName,
const std::vector<double> &coordinates);
/// Adds or replaces a bicycle
///
/// \param positionOnLane The relative position of the vehicle on its lane
/// has to be between 0 and 1.
void addOrReplaceBicycle(std::string_view vehicleName,
std::string_view laneName, double positionOnLane,
double speed);
/// Adds or replaces a car
///
/// \param positionOnLane The relative position of the vehicle on its lane
/// has to be between 0 and 1.
void addOrReplaceCar(std::string_view vehicleName, std::string_view laneName,
double positionOnLane, double speed,
double remainingFuel);
/// Sets the time label to \p time
void setTimeLabel(std::chrono::minutes time);
private:
......
......@@ -4,6 +4,8 @@
#include <type_traits>
#include <vector>
/// Wraps MapWindow of pi2-view.h
/// Uses custom deleter of std::unique_ptr to properly destroy mapWindow
MapWindowWrapper::MapWindowWrapper(std::string_view windowTitle)
: mapWindow(mapWindowCreate(windowTitle.data()),
[](MapWindow *mapWindow) { mapWindowDestroy(mapWindow); }) {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment