pi2-view.h 1.85 KB
Newer Older
Martin Kröning's avatar
Martin Kröning committed
1
2
3
4
5
6
7
8
9
#pragma once

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

10
11
12
/**
 * The application to show a map, a list of vehicles and additional information
 */
Martin Kröning's avatar
Martin Kröning committed
13
struct MapApp;
14

15
16
17
18
19
20
21
/**
 * Creates a MapApp and opens the corresponding window.
 *
 * You *have* to call mapAppDestroy(MapApp *) to avoid memory leaks.
 *
 * \returns A pointer to the created MapApp
 */
22
MapApp *mapAppCreate(const char *windowTitle);
23

24
25
26
/**
 * Destroys \p mapApp and frees its memory.
 */
Martin Kröning's avatar
Martin Kröning committed
27
void mapAppDestroy(MapApp *mapApp);
28

29
30
31
32
33
34
/**
 * Adds a junction to \p mapApp
 *
 * The coordinates \p x and \p y mark the middle of the junction and represent
 * amounts of pixels.
 */
Martin Kröning's avatar
Martin Kröning committed
35
void mapAppAddJunction(MapApp *mapApp, double x, double y);
36

37
38
39
40
41
42
43
/**
 * Adds a road to \p mapApp
 *
 * \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
 */
Martin Kröning's avatar
Martin Kröning committed
44
45
46
void mapAppAddRoad(MapApp *mapApp, const char *laneThereName,
                   const char *laneBackName, const double *coordinates,
                   size_t coordinateCount);
47

48
49
50
51
52
53
54
55
56
/**
 * Adds or replaces a vehicle to/in \p mapApp
 *
 * The parameters \p red \p green and \p blue are the RGB components of the
 * color representing the vehicle. They have to be between 0 and 1.
 *
 * \param positionOnLane The relative position of the vehicle on its lane
 * has to be between 0 and 1.
 */
Martin Kröning's avatar
Martin Kröning committed
57
void mapAppAddOrReplaceVehicle(MapApp *mapApp, const char *vehicleName,
Martin Kröning's avatar
Martin Kröning committed
58
59
60
                               const char *roadName, double positionOnLane,
                               double speed, double remainingFuel, double red,
                               double green, double blue);
61

62
63
64
/**
 * Sets the duration label of \p mapApp to \p minutes
 */
Martin Kröning's avatar
Martin Kröning committed
65
66
67
68
69
void mapAppSetDurationLabel(MapApp *mapApp, int64_t minutes);

#ifdef __cplusplus
}
#endif