Commit 0c10dde7 authored by Martin Kröning's avatar Martin Kröning

Split MapWindow from MapApp

parent 4fd021f2
#pragma once
#include "DrawableJunction.hpp"
#include "DrawableRoad.hpp"
#include "DrawableVehicle.hpp"
#include "MapArea.hpp"
#include "glibmm/refptr.h"
#include "MapWindow.hpp"
#include <chrono>
#include <gtkmm/window.h>
#include <map>
#include <string>
#include <thread>
#include <valarray>
#include <vector>
namespace Glib {
template <class T_CppObject> class RefPtr;
}
namespace Gtk {
class Application;
class ComboBoxText;
class Label;
class ListBox;
class ListBoxRow;
} // namespace Gtk
}
class MapApp {
public:
......@@ -36,29 +29,7 @@ public:
void setTimeLabel(std::chrono::minutes time);
private:
static const std::vector<std::string> zoomLevels;
static Glib::RefPtr<Gtk::Application> app;
static std::thread thread;
void addOrReplaceVehicle(const std::string &vehicleName,
const std::string &laneName, double positionOnLane,
double speed, double remainingFuel, double red,
double green, double blue);
void onZoomEntryActivate();
void onZoomSelectionChanged();
void onVehicleRowSelected(Gtk::ListBoxRow *row);
void refreshVehicleLabels(const DrawableVehicle &vehicle);
void refreshArea(int x, int y, int width, int height);
void resizeWindow();
MapArea mapArea;
Gtk::Window win;
Gtk::ListBox *listBox;
Gtk::Label *timeLabel;
Gtk::Label *laneLabel;
Gtk::Label *lanePositionPercentageLabel;
Gtk::Label *speedLabel;
Gtk::Label *remainingFuelLabel;
Gtk::ComboBoxText *zoomComboBoxText;
std::vector<DrawableJunction> junctions;
std::vector<DrawableRoad> roads;
std::map<std::string, DrawableVehicle> nameVehicleMap;
MapWindow mapWindow;
};
#pragma once
#include "DrawableJunction.hpp"
#include "DrawableRoad.hpp"
#include "DrawableVehicle.hpp"
#include "MapArea.hpp"
#include <chrono>
#include <gtkmm/window.h>
#include <map>
#include <string>
#include <thread>
#include <valarray>
#include <vector>
namespace Glib {
template <class T_CppObject> class RefPtr;
}
namespace Gtk {
class Application;
class ComboBoxText;
class Label;
class ListBox;
class ListBoxRow;
}
class MapWindow : public Gtk::Window {
public:
MapWindow(std::string windowTitle);
virtual ~MapWindow();
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 const std::vector<std::string> zoomLevels;
static Glib::RefPtr<Gtk::Application> app;
static std::thread thread;
void addOrReplaceVehicle(const std::string &vehicleName,
const std::string &laneName, double positionOnLane,
double speed, double remainingFuel, double red,
double green, double blue);
void onZoomEntryActivate();
void onZoomSelectionChanged();
void onVehicleRowSelected(Gtk::ListBoxRow *row);
void refreshVehicleLabels(const DrawableVehicle &vehicle);
void refreshArea(int x, int y, int width, int height);
void resizeWindow();
MapArea mapArea;
Gtk::ListBox *listBox;
Gtk::Label *timeLabel;
Gtk::Label *laneLabel;
Gtk::Label *lanePositionPercentageLabel;
Gtk::Label *speedLabel;
Gtk::Label *remainingFuelLabel;
Gtk::ComboBoxText *zoomComboBoxText;
std::vector<DrawableJunction> junctions;
std::vector<DrawableRoad> roads;
std::map<std::string, DrawableVehicle> nameVehicleMap;
};
......@@ -2,10 +2,11 @@ pi2_view_inc = include_directories('include')
pi2_view_src = files(
'src/Drawable.cpp',
'src/DrawableJunction.cpp',
'src/MapArea.cpp',
'src/MapApp.cpp',
'src/DrawableRoad.cpp',
'src/DrawableVehicle.cpp',
'src/MapApp.cpp',
'src/MapArea.cpp',
'src/MapWindow.cpp',
'src/pi2-view.cpp'
)
gnome = import('gnome')
......
This diff is collapsed.
This diff is collapsed.
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