Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
P
PI2 View
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PI2
PI2 View
Commits
f44058a5
Commit
f44058a5
authored
Feb 04, 2019
by
Martin Kröning
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation to MapWindowWrapper
parent
48f8a3b4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
pi2-demo/include/MapWindowWrapper.hpp
pi2-demo/include/MapWindowWrapper.hpp
+23
-0
pi2-demo/src/MapWindowWrapper.cpp
pi2-demo/src/MapWindowWrapper.cpp
+2
-0
No files found.
pi2-demo/include/MapWindowWrapper.hpp
View file @
f44058a5
...
...
@@ -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:
...
...
pi2-demo/src/MapWindowWrapper.cpp
View file @
f44058a5
...
...
@@ -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
);
})
{}
...
...
Martin Kröning
@mkroening
mentioned in issue
#3 (closed)
·
Feb 04, 2019
mentioned in issue
#3 (closed)
mentioned in issue #3
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment