Commit 1d9dcda7 authored by Martin Kröning's avatar Martin Kröning

Clean up includes and reformat code

parent 0c10dde7
#pragma once
#include "Vehicle.hpp"
#include <string>
#include <string_view>
class MapAppAPIWrapper;
......
......@@ -27,8 +27,9 @@ private:
void extractJunctionAndDraw(std::istream &is, MapAppAPIWrapper &mapApp);
/// Required format:
/// `nameJunctionA` `nameJunctionB` `nameLaneAToB` `nameLaneBToA` `length in km`
/// `speedLimit in {1,2,3}` `noPassing` `coordinateCount` `coordinates...`
/// `nameJunctionA` `nameJunctionB` `nameLaneAToB` `nameLaneBToA`
/// `length in km` `speedLimit in {1,2,3}` `noPassing` `coordinateCount`
/// `coordinates...`
void extractRoadAndDraw(std::istream &is, MapAppAPIWrapper &mapApp);
/// Required format:
......
......@@ -14,8 +14,8 @@ void Junction::connect(const std::weak_ptr<Junction> &junctionA,
const bool noPassing) {
Lane laneAToB(laneAToBName, laneBToAName, length, speedLimit, noPassing,
junctionB);
Lane laneBToA(std::move(laneBToAName), std::move(laneAToBName), length, speedLimit, noPassing,
junctionA);
Lane laneBToA(std::move(laneBToAName), std::move(laneAToBName), length,
speedLimit, noPassing, junctionA);
junctionA.lock()->outboundLanes.push_back(std::move(laneAToB));
junctionB.lock()->outboundLanes.push_back(std::move(laneBToA));
}
......
#include "MapAppAPIWrapper.hpp"
#include "pi2-view.h"
#include <pi2-view.h>
#include <string_view>
#include <vector>
......
......@@ -10,7 +10,8 @@ void Vehicle::process(const double time, const double maximumDistanceOnLane,
if (!parking) {
const auto possibleDistance = maximumDistanceOnLane - getDistanceOnLane();
const auto potentialDistance = (time - timeOfLastProcessing) * getSpeed(speedLimit);
const auto potentialDistance =
(time - timeOfLastProcessing) * getSpeed(speedLimit);
const auto deltaDistance = std::min(possibleDistance, potentialDistance);
distanceOnLane += deltaDistance;
odometer += deltaDistance;
......@@ -25,8 +26,9 @@ void Vehicle::resetDistanceOnLane() { distanceOnLane = 0; }
Vehicle::Vehicle(std::string name, const double topSpeed,
const double timeOfStart, const double time)
: Named(std::move(name)), topSpeed(topSpeed), odometer(0), distanceOnLane(0), parking(true),
timeOfStart(timeOfStart), timeOfLastProcessing(time) {}
: Named(std::move(name)), topSpeed(topSpeed), odometer(0),
distanceOnLane(0), parking(true), timeOfStart(timeOfStart),
timeOfLastProcessing(time) {}
double Vehicle::getTopSpeed() const { return topSpeed; }
......
......@@ -3,7 +3,6 @@
#include <chrono>
#include <fstream>
#include <gsl/span>
#include <gsl/string_span>
#include <iostream>
#include <ratio>
#include <string>
......
#pragma once
#include <Drawable.hpp>
#include "Drawable.hpp"
#include <string>
#include <string_view>
#include <valarray>
#include <vector>
......
......@@ -20,7 +20,7 @@ class ComboBoxText;
class Label;
class ListBox;
class ListBoxRow;
}
} // namespace Gtk
class MapWindow : public Gtk::Window {
public:
......
#include "DrawableJunction.hpp"
#include "cairomm/context.h"
#include "cairomm/enums.h"
#include "cairomm/refptr.h"
#include <cairomm/context.h>
#include <cairomm/enums.h>
#include <cairomm/refptr.h>
#include <cmath>
#include <vector>
......
#include "DrawableRoad.hpp"
#include "cairomm/context.h"
#include "cairomm/enums.h"
#include "cairomm/refptr.h"
#include <algorithm>
#include <cairomm/context.h>
#include <cairomm/enums.h>
#include <cairomm/refptr.h>
#include <cmath>
#include <ext/alloc_traits.h>
#include <limits>
......
#include "DrawableVehicle.hpp"
#include "DrawableRoad.hpp"
#include "cairomm/context.h"
#include "cairomm/refptr.h"
#include <cairomm/context.h>
#include <cairomm/refptr.h>
#include <cmath>
#include <utility>
......
......@@ -3,11 +3,11 @@
#include "DrawableJunction.hpp"
#include "DrawableRoad.hpp"
#include "DrawableVehicle.hpp"
#include "cairomm/refptr.h"
#include "gtkmm/widget.h"
#include <algorithm>
#include <cairomm/context.h>
#include <cairomm/refptr.h>
#include <cmath>
#include <gtkmm/widget.h>
const int MapArea::padding = 30;
......
......@@ -8,6 +8,7 @@
#include <gsl/pointers>
#include <gsl/span>
#include <gsl/string_span>
#include <string>
#include <valarray>
#include <vector>
......
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