├── README.md ├── ecosystem ├── 2dvis │ ├── 2dvis.pro │ ├── 2dvis.qrc │ ├── README.md │ ├── agent.cpp │ ├── agent.h │ ├── chartsfield.cpp │ ├── chartsfield.h │ ├── chartswidget.cpp │ ├── chartswidget.h │ ├── darkorange.qss │ ├── documentation │ │ ├── 2dvis.png │ │ └── 2dvis_metrics.png │ ├── globals.cpp │ ├── globals.h │ ├── images │ │ ├── license.txt │ │ └── street.jpg │ ├── item.cpp │ ├── item.h │ ├── itemcontainer.cpp │ ├── itemcontainer.h │ ├── main.cpp │ ├── mainwindow.cpp │ ├── mainwindow.h │ ├── messageparser.cpp │ ├── messageparser.h │ ├── metricsfield.cpp │ ├── metricsfield.h │ ├── metricswidget.cpp │ ├── metricswidget.h │ ├── mygraphicsview.cpp │ ├── mygraphicsview.h │ ├── obstacle.cpp │ ├── obstacle.h │ ├── receiver.cpp │ ├── receiver.h │ ├── waypoint.cpp │ └── waypoint.h ├── 3dvis │ ├── 3dvis.pro │ ├── 3dvis.sln │ ├── 3dvis.vcxproj │ ├── 3dvis.vcxproj.filters │ ├── README.md │ ├── documentation │ │ └── 3dvis.png │ ├── item.cpp │ ├── item.h │ ├── itemagent.cpp │ ├── itemagent.h │ ├── itemcontainer.cpp │ ├── itemcontainer.h │ ├── itemobstacle.cpp │ ├── itemobstacle.h │ ├── main.cpp │ ├── messageparser.cpp │ ├── messageparser.h │ ├── receiver.cpp │ └── receiver.h ├── demoapp │ ├── README.md │ ├── documentation │ │ ├── 20120204-screenshot-v2-2.png │ │ ├── doxygen.conf │ │ ├── footer.html │ │ ├── gui.dox │ │ ├── header.html │ │ ├── scenario.dox │ │ └── screenshot.png │ ├── pedsim.pro │ ├── pedsim.sln │ ├── scene.xml │ ├── scene2.xml │ └── src │ │ ├── agent.cpp │ │ ├── agent.h │ │ ├── application.qrc │ │ ├── cell.cpp │ │ ├── cell.h │ │ ├── config.cpp │ │ ├── config.h │ │ ├── control.cpp │ │ ├── control.h │ │ ├── control.ui │ │ ├── grid.cpp │ │ ├── grid.h │ │ ├── images │ │ ├── backward.png │ │ ├── copy.png │ │ ├── cut.png │ │ ├── forward.png │ │ ├── new.png │ │ ├── open.png │ │ ├── paste.png │ │ ├── pause.png │ │ ├── save.png │ │ ├── start.png │ │ ├── stop.png │ │ ├── zoomin.png │ │ └── zoomout.png │ │ ├── loadscene.cpp │ │ ├── loadscene.h │ │ ├── main.cpp │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ ├── obstacle.cpp │ │ ├── obstacle.h │ │ ├── pedsim.vcxproj │ │ ├── pedsim.vcxproj.filters │ │ ├── scene.cpp │ │ ├── scene.h │ │ ├── src.pro │ │ ├── style.cpp │ │ ├── style.h │ │ ├── tree.cpp │ │ ├── tree.h │ │ ├── waypoint.cpp │ │ └── waypoint.h └── machinelearning │ ├── learning03.cpp │ └── learning04.cpp └── libpedsim ├── LICENSE.md ├── Makefile ├── README.md ├── documentation ├── 01-intro.md ├── 95-setup.md ├── 96-windows.md ├── 98-contributors.md ├── 99-faq.md ├── doxygen.conf ├── footer.html ├── header.html ├── pedsim-2dvis-example05-900.png ├── pedsim-2dvis-example05.png ├── title.png ├── title.tex └── xx-examples.dox ├── examples ├── Example03 │ ├── Example03.sln │ ├── Example03.vcxproj │ └── Example03.vcxproj.filters ├── example01.cpp ├── example02.cpp ├── example03.cpp ├── example04.cpp └── example05.cpp ├── msvc15 ├── libpedsim.sln ├── libpedsim.vcxproj └── libpedsim.vcxproj.filters ├── ped_agent.cpp ├── ped_agent.h ├── ped_includes.h ├── ped_obstacle.cpp ├── ped_obstacle.h ├── ped_outputwriter.cpp ├── ped_outputwriter.h ├── ped_scene.cpp ├── ped_scene.h ├── ped_tree.cpp ├── ped_tree.h ├── ped_vector.cpp ├── ped_vector.h ├── ped_waypoint.cpp ├── ped_waypoint.h └── tests ├── acceptance └── test_dynamics.cpp ├── test_main.cpp └── unit ├── test_Tagent.cpp └── test_Tvector.cpp /README.md: -------------------------------------------------------------------------------- 1 | # pedsim 2 | PEDSIM is a microscopic pedestrian crowd simulation system. It is suitable for use in crowd simulations (e.g. indoor evacuation simulation, large scale outdoor simulations), where quantitative measurements like pedestrian density or evacuation time matter. The quality of the individual agent's trajectory is high enough for creating massive pedestrian crowd animations (e.g. for motion pictures or architectural visualization). Since PEDSIM is easy to use and extend, it is a good starting point for science projects. 3 | 4 | # License 5 | This software is free software: 6 | You can redistribute it and/or modify it under the terms of the GNU General Public License (GPL). The core library libpedsim is licensed under the terms of the GNU Lesser General Public License (LGPL), allowing use in commercial and propietary projects. See source code and documentation for copying conditions. 7 | There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 8 | -------------------------------------------------------------------------------- /ecosystem/2dvis/2dvis.pro: -------------------------------------------------------------------------------- 1 | # 2 | # pedsim - A microscopic pedestrian simulation system. 3 | # Copyright (c) by Christian Gloor 4 | # 5 | 6 | QT += network widgets xml 7 | #CONFIG += c++11 8 | 9 | message(" ================ Qt $$[QT_VERSION] ================ ") 10 | lessThan(QT_MAJOR_VERSION, 6):lessThan(QT_MINOR_VERSION, 7) { 11 | } else { 12 | DEFINES += USE_CHARTS 13 | } 14 | 15 | contains(DEFINES, USE_CHARTS) { 16 | message("Using Charts") 17 | QT += charts 18 | } 19 | 20 | HEADERS += \ 21 | item.h \ 22 | agent.h \ 23 | waypoint.h \ 24 | obstacle.h \ 25 | itemcontainer.h \ 26 | receiver.h \ 27 | messageparser.h \ 28 | mygraphicsview.h \ 29 | globals.h \ 30 | mainwindow.h \ 31 | metricswidget.h \ 32 | metricsfield.h 33 | 34 | contains(DEFINES, USE_CHARTS) { 35 | HEADERS += \ 36 | chartswidget.h \ 37 | chartsfield.h 38 | } 39 | 40 | SOURCES += \ 41 | item.cpp \ 42 | main.cpp \ 43 | agent.cpp \ 44 | waypoint.cpp \ 45 | obstacle.cpp \ 46 | itemcontainer.cpp \ 47 | receiver.cpp \ 48 | messageparser.cpp \ 49 | mygraphicsview.cpp \ 50 | globals.cpp \ 51 | mainwindow.cpp \ 52 | metricswidget.cpp \ 53 | metricsfield.cpp 54 | 55 | contains(DEFINES, USE_CHARTS) { 56 | SOURCES += \ 57 | chartswidget.cpp \ 58 | chartsfield.cpp 59 | } 60 | 61 | RESOURCES += \ 62 | 2dvis.qrc 63 | 64 | message($$HEADERS) 65 | -------------------------------------------------------------------------------- /ecosystem/2dvis/2dvis.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | images/street.jpg 5 | 6 | -------------------------------------------------------------------------------- /ecosystem/2dvis/README.md: -------------------------------------------------------------------------------- 1 | 2-Dimensional Visualizer {#twodvis} 2 | ======================== 3 | 4 | 5 | The 2-dimensional visualizer is a separate application that can be 6 | used to visualize the output of a PEDSIM simulation run. It listens on 7 | a network socket for update information (agent positions, but also 8 | dynamic scene definitions.), which are rendered in real-time. This is 9 | perfectly suited to observe stand-allone simulations or optimizations 10 | which take a long time to run. Also nice for demonstrations, where the 11 | visualizer is installed on the machine connected to the beamer, and 12 | the simulation runs on a separate host. Ah and yes, it is able to 13 | output png files for each frame, which can be combined into a video 14 | easily! 15 | 16 | _2dvis_ is built on _Qt_. If you want to use all the features (especially 17 | charts), you need _Qt 5.7_ or above. It should be possible to compile it 18 | using an older version. However, you will not see the metrics charts in 19 | _2dvis_ then. See documenation for compiling on [Linux](@ref linux) and 20 | [Windows](@ref windows). 21 | 22 | 23 | ## Usage 24 | 25 | ~~~~ .sh 26 | Usage: ./2dvis [options] 27 | 2-dimensional PEDSIM visualizer. 28 | 29 | Options: 30 | -h, --help Displays this help. 31 | -q, --quiet Do not show graphical output 32 | -n, --network Read input from network on port 33 | -f, --file Read input from 34 | -c, --charts Display charts DockWidget 35 | -m, --metrics Display metrics DockWidget 36 | -o, --outputdirectory Write frame-by-frame image output to 37 | ~~~~ 38 | 39 | Usually, `2dvis` is started in network mode, where it listens to 40 | incoming data packets on the specified UDP port. 41 | 42 | ~~~~ .sh 43 | ./2dvis -n 2222 44 | ~~~~ 45 | 46 | ## Metrics and charts display 47 | 48 | 2dvis has the ability to display user-defined metrics coming from the 49 | simulation. It can display the latest metrics in numerical form, and 50 | also chart the values as line graphs. These two dockable windows are 51 | enabled by specifying `-m`/`--metrics` or `-c`/`--charts` respectively 52 | on the command line. Note that the charts window needs _Qt_ version 53 | 5.7 or above. Otherwise the feature will not be compiled in. Numerical 54 | metrics work for all _Qt_ versions. 55 | 56 | These metrics are submitted from the simulation using 57 | Ped::XMLOutputWriter::writeMetrics(std::unordered_map hash). For example like this: 59 | 60 | ~~~~ .cpp 61 | ow->writeMetrics({{"name1", "value1"}, {"name2", "value2"}}); 62 | ~~~~ 63 | 64 | Here is an example with metrics transmitted: 65 | 66 | ~~~~ .cpp 67 | ow->writeMetrics({ 68 | {"Average Timesteps", std::to_string(sum_age/agents.size())}, 69 | {"Average Theta", std::to_string(sum_theta/agents.size())}, 70 | {"Average Sensitivity L", std::to_string(sum_sensitivity_l/agents.size())}, 71 | {"Average Sensitivity R", std::to_string(sum_sensitivity_r/agents.size())}, 72 | {"Average Reach", std::to_string(sum_reach/agents.size())} 73 | }); 74 | ~~~~ 75 | 76 |  77 | @latexonly 78 | \includegraphics[width=\textwidth]{2dvis_metrics.png} 79 | @endlatexonly 80 | 81 | ## Video generation 82 | 83 | Instead of a network stream it is also possible to process a XML file 84 | containing the messages. This is meant for creating videos. At the 85 | moment, 2dvis will try to play all events in full speed, resulting in 86 | an overloaded graphics engine. Use it together with the `-o` output 87 | option only. This mode can be specified using 88 | 89 | ~~~~ .sh 90 | ./2dvis -f filename.xml 91 | ~~~~ 92 | 93 | In order to generate a video sequence out of a PEDSIM run, use these 94 | steps: 95 | 96 | ~~~~ .sh 97 | ./2dvis -f ../../libpedsim/examples/pedsim_out.txt -o output 98 | mencoder mf://output/*.png -mf w=1280:h=720:fps=25:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vbitrate=6000 -oac copy -o example01.avi 99 | ~~~~ 100 | 101 | Find more about _mencoder_, which is part of the _mplayer_ suite, 102 | [here](http://www.mplayerhq.hu/). 103 | 104 | For example videos, see PEDSIM's [YouTube 105 | channel](https://www.youtube.com/watch?v=CxfTYi6CgNs). 106 | 107 | ## Supported XML tags 108 | 109 | See [here](@ref xml) for a list of supported XML tags. 110 | 111 |  112 | @latexonly 113 | \includegraphics[width=\textwidth]{2dvis.png} 114 | @endlatexonly 115 | -------------------------------------------------------------------------------- /ecosystem/2dvis/agent.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include "agent.h" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | static const double SCALE = 10.0; 13 | 14 | 15 | //Agent::Agent() : color(qrand() % 256, qrand() % 256, qrand() % 256) {} 16 | 17 | Agent::Agent() : color(255, 0, 0) { 18 | } 19 | 20 | 21 | QRectF Agent::boundingRect() const { 22 | qreal adjust = 0.5; 23 | return QRectF(SCALE * (-18 - adjust), SCALE * (-22 - adjust), SCALE * (36 + adjust), SCALE * (60 + adjust)); 24 | } 25 | 26 | 27 | QPainterPath Agent::shape() const { 28 | QPainterPath path; 29 | path.addRect(SCALE * -10, SCALE * -20, SCALE * 20, SCALE * 20); 30 | return path; 31 | } 32 | 33 | 34 | void Agent::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { 35 | 36 | // body 37 | painter->setBrush(color); 38 | painter->setPen(QPen(QBrush(Qt::white), .1)); 39 | painter->drawEllipse(SCALE * -0.2, SCALE * -0.5, SCALE * 0.4, SCALE * 1.0); 40 | 41 | // head 42 | painter->setBrush(QColor(255, 192, 0)); 43 | painter->setPen(QPen(QBrush(Qt::white), .1)); 44 | painter->drawEllipse(SCALE * -0.3, SCALE * -0.3, SCALE * 0.6, SCALE * 0.6); 45 | 46 | // eyes 47 | painter->setBrush(Qt::black); 48 | painter->setPen(QPen(QBrush(Qt::white), .05)); 49 | painter->drawEllipse(SCALE * 0.15, SCALE * -0.175, SCALE * 0.1, SCALE * 0.1); 50 | painter->drawEllipse(SCALE * 0.15, SCALE * 0.075, SCALE * 0.1, SCALE * 0.1); 51 | 52 | // hair 53 | painter->setBrush(QColor(139,69,19)); // saddle brown 54 | painter->setPen(QPen(QBrush(Qt::white), .05)); 55 | painter->drawChord(SCALE * -0.3, SCALE * -0.3, SCALE * 0.6, SCALE * 0.6, 90*16, 180*16); 56 | } 57 | 58 | 59 | void Agent::advance(int step) { 60 | if (!step) return; 61 | setPos(SCALE * x, SCALE * y); 62 | } 63 | -------------------------------------------------------------------------------- /ecosystem/2dvis/agent.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef AGENT_H 7 | #define AGENT_H 8 | 9 | #include "item.h" 10 | 11 | #include 12 | 13 | class Agent : public Item { 14 | 15 | public: 16 | Agent(); 17 | 18 | QRectF boundingRect() const; 19 | QPainterPath shape() const; 20 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); 21 | 22 | protected: 23 | void advance(int step); 24 | 25 | private: 26 | QColor color; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /ecosystem/2dvis/chartsfield.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "chartsfield.h" 4 | 5 | #include 6 | 7 | using namespace QtCharts; 8 | 9 | ChartsField::ChartsField(QString name) { 10 | value = 0.0; 11 | 12 | series = new QLineSeries(); 13 | 14 | chart = new QChart(); 15 | chart->legend()->hide(); 16 | // chart->addSeries(series); 17 | // chart->createDefaultAxes(); 18 | chart->setTitle(name); 19 | chart->setTheme(QChart::ChartThemeBlueCerulean); 20 | 21 | chartView = new QChartView(chart); 22 | chartView->setRenderHint(QPainter::Antialiasing); 23 | chartView->setMinimumWidth(100); 24 | chartView->setMaximumWidth(800); 25 | QVBoxLayout *layout; 26 | layout = new QVBoxLayout(); 27 | 28 | layout->addWidget(chartView); 29 | 30 | setLayout(layout); 31 | 32 | } 33 | 34 | void ChartsField::update(long timestep, double pvalue) { 35 | if (value != pvalue) { 36 | value = pvalue; 37 | chart->removeSeries(series); 38 | chart->addSeries(series); 39 | chart->createDefaultAxes(); 40 | series->append(timestep, value); 41 | 42 | QValueAxis *axisX = new QValueAxis; 43 | // axisX->setRange(0, timestep); 44 | axisX->setTickCount(10); 45 | axisX->setMinorTickCount(1); 46 | axisX->setLabelFormat("%d"); 47 | chart->setAxisX(axisX, series); 48 | 49 | chartView->update(); 50 | chartView->repaint(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ecosystem/2dvis/chartsfield.h: -------------------------------------------------------------------------------- 1 | #ifndef CHARTSFIELD_H 2 | #define CHARTSFIELD_H 3 | 4 | #include 5 | #include 6 | using namespace QtCharts; 7 | 8 | class ChartsField : public QWidget { 9 | Q_OBJECT 10 | 11 | public: 12 | ChartsField(QString name); 13 | 14 | void update(long timestep, double value); 15 | 16 | private: 17 | double value; 18 | QLineSeries *series; 19 | QChart *chart; 20 | QChartView *chartView; 21 | }; 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /ecosystem/2dvis/chartswidget.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "chartswidget.h" 4 | #include "chartsfield.h" 5 | 6 | 7 | ChartsWidget::ChartsWidget() { 8 | layout = new QHBoxLayout; 9 | setLayout(layout); 10 | }; 11 | 12 | void ChartsWidget::update(long timestep, QString name, double value) { 13 | if (charts.contains(name)) { 14 | charts[name]->update(timestep, value); 15 | } else { 16 | charts[name] = new ChartsField(name); 17 | layout->addWidget(charts[name]); 18 | } 19 | } 20 | 21 | void ChartsWidget::clear() { 22 | foreach (QWidget* value, charts) { 23 | layout->removeWidget(value); 24 | delete value; 25 | } 26 | charts.clear(); 27 | } 28 | -------------------------------------------------------------------------------- /ecosystem/2dvis/chartswidget.h: -------------------------------------------------------------------------------- 1 | #ifndef CHARTSWIDGET_H 2 | #define CHARTSWIDGET_H 3 | 4 | #include 5 | 6 | class ChartsField; 7 | 8 | class ChartsWidget : public QWidget { 9 | Q_OBJECT 10 | 11 | public: 12 | ChartsWidget(); 13 | 14 | void update(long timestep, QString name, double value); 15 | void clear(); 16 | 17 | private: 18 | QHash charts; 19 | QHBoxLayout *layout; 20 | 21 | }; 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /ecosystem/2dvis/documentation/2dvis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chgloor/pedsim/0d8ff5c652ee2a1a59cea68a638d7ef399f41048/ecosystem/2dvis/documentation/2dvis.png -------------------------------------------------------------------------------- /ecosystem/2dvis/documentation/2dvis_metrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chgloor/pedsim/0d8ff5c652ee2a1a59cea68a638d7ef399f41048/ecosystem/2dvis/documentation/2dvis_metrics.png -------------------------------------------------------------------------------- /ecosystem/2dvis/globals.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include "globals.h" 7 | #include 8 | 9 | // ALL THE GLOBAL DEFINITIONS 10 | 11 | 12 | bool g_option_writefile = false; 13 | QString g_option_writefile_directory = "/tmp/"; 14 | 15 | bool g_option_network = false; 16 | int g_option_network_port = 2222; 17 | 18 | bool g_option_file = false; 19 | QString g_option_file_name = "pedsim_out.txt"; 20 | 21 | bool g_option_charts = false; 22 | bool g_option_metrics = false; 23 | -------------------------------------------------------------------------------- /ecosystem/2dvis/globals.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef GLOBALS_H 7 | #define GLOBALS_H 8 | 9 | // ALL THE GLOBAL DECLARATIONS 10 | 11 | class QString; 12 | 13 | //extern QString g_some_string; 14 | 15 | extern bool g_option_writefile; 16 | extern QString g_option_writefile_directory; 17 | 18 | extern bool g_option_network; 19 | extern int g_option_network_port; 20 | 21 | extern bool g_option_file; 22 | extern QString g_option_file_name; 23 | 24 | extern bool g_option_charts; 25 | extern bool g_option_metrics; 26 | 27 | 28 | #endif // GLOBALS_H 29 | -------------------------------------------------------------------------------- /ecosystem/2dvis/images/license.txt: -------------------------------------------------------------------------------- 1 | Recource Licenses: 2 | 3 | street.jpg 4 | http://www.123rf.com/stock-photo/asphalt_paving.html 5 | ROYALTY FREE STOCK PHOTOS 6 | 7 | -------------------------------------------------------------------------------- /ecosystem/2dvis/images/street.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chgloor/pedsim/0d8ff5c652ee2a1a59cea68a638d7ef399f41048/ecosystem/2dvis/images/street.jpg -------------------------------------------------------------------------------- /ecosystem/2dvis/item.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include "item.h" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | static const double SCALE = 10.0; 13 | 14 | 15 | Item::Item() : color(qrand() % 256, qrand() % 256, qrand() % 256) { 16 | } 17 | 18 | 19 | QRectF Item::boundingRect() const { 20 | qreal adjust = 0.5; 21 | return QRectF(-18 - adjust, -22 - adjust, 36 + adjust, 60 + adjust); 22 | return QRectF(SCALE * (-18 - adjust), SCALE * (-22 - adjust), SCALE * (36 + adjust), SCALE * (60 + adjust)); 23 | } 24 | 25 | 26 | QPainterPath Item::shape() const { 27 | QPainterPath path; 28 | path.addRect(SCALE * -10, SCALE * -20, SCALE * 20, SCALE * 20); 29 | return path; 30 | } 31 | 32 | 33 | void Item::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { 34 | painter->setBrush(color); 35 | painter->setPen(QPen(QBrush(Qt::white), .1)); 36 | painter->drawEllipse(SCALE * -0.5, SCALE * -0.5, SCALE * 1.0, SCALE * 1.0); 37 | } 38 | 39 | 40 | void Item::advance(int step) { 41 | if (!step) return; 42 | setPos(SCALE * x, SCALE * y); 43 | } 44 | -------------------------------------------------------------------------------- /ecosystem/2dvis/item.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef ITEM_H 7 | #define ITEM_H 8 | 9 | #include 10 | 11 | class Item : public QGraphicsItem { 12 | 13 | public: 14 | Item(); 15 | 16 | QRectF boundingRect() const; 17 | QPainterPath shape() const; 18 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); 19 | double x; 20 | double y; 21 | double r; // rotation 22 | double dx; 23 | double dy; 24 | double radius; 25 | 26 | protected: 27 | void advance(int step); 28 | 29 | private: 30 | QColor color; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /ecosystem/2dvis/itemcontainer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include "itemcontainer.h" 7 | #include "item.h" 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | 15 | extern QGraphicsScene *scene; 16 | 17 | 18 | ItemContainer::ItemContainer() { 19 | } 20 | 21 | 22 | // Removes all items from the container 23 | void ItemContainer::clear() { 24 | container.clear(); 25 | } 26 | 27 | 28 | void ItemContainer::for_each(void (*fn)(Item*)) { 29 | QHash::iterator it; 30 | for (it = container.begin(); it != container.end(); ++it) { 31 | fn(*it); 32 | } 33 | } 34 | 35 | void ItemContainer::removeItem(QString id) { 36 | scene->removeItem(container[id]); 37 | container.remove(id); 38 | }; 39 | 40 | 41 | void ItemContainer::updatePosition(QString id, double x, double y) { 42 | double oldx = container[id]->x; 43 | double oldy = container[id]->y; 44 | 45 | container[id]->x = x; 46 | container[id]->y = y; 47 | 48 | double newr = atan2(y-oldy, x-oldx) * 180 / 3.1415; 49 | double oldr = container[id]->rotation(); 50 | double r = oldr * 0.96 + newr * 0.04; 51 | container[id]->setRotation(r); 52 | } 53 | 54 | void ItemContainer::updatePosition(QString id, double x, double y, double radius) { 55 | updatePosition(id, x, y); 56 | container[id]->radius = radius; 57 | } 58 | 59 | 60 | void ItemContainer::updatePosition(QString id, double x, double y, double dx, double dy) { 61 | updatePosition(id, x, y); 62 | container[id]->dx = dx; 63 | container[id]->dy = dy; 64 | } 65 | -------------------------------------------------------------------------------- /ecosystem/2dvis/itemcontainer.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef ITEMCONTAINER_H 7 | #define ITEMCONTAINER_H 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | class ItemContainer : public QObject { 16 | Q_OBJECT 17 | 18 | public: 19 | ItemContainer(); 20 | void addItem(QString id, Item *i) {container[id]=i; }; 21 | void removeItem(QString id); 22 | bool contains(QString id) { return (container.contains(id)); }; 23 | void for_each(void (*fn)(Item*)); 24 | 25 | public slots: 26 | void clear(); 27 | void setRotation(QString id, double r) { container[id]->r = r; container[id]->setRotation(r);}; 28 | void updatePosition(QString id, double x, double y); 29 | void updatePosition(QString id, double x, double y, double radius); 30 | void updatePosition(QString id, double x, double y, double dx, double dy); 31 | 32 | private: 33 | QHash container; 34 | 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /ecosystem/2dvis/main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include "mygraphicsview.h" 11 | #include "agent.h" 12 | #include "waypoint.h" 13 | #include "obstacle.h" 14 | #include "itemcontainer.h" 15 | #include "mainwindow.h" 16 | #include "globals.h" 17 | 18 | // /opt/Qt/5.7/gcc_64/bin/qmake 19 | 20 | 21 | //static const int AgentCount = 50; 22 | static const double SCALE = 1.0; 23 | 24 | 25 | ItemContainer agentcontainer; 26 | ItemContainer waypointcontainer; 27 | ItemContainer obstaclecontainer; 28 | 29 | 30 | int main(int argc, char **argv) { 31 | QApplication app(argc, argv); 32 | 33 | QCommandLineParser cparser; 34 | cparser.setApplicationDescription("2-dimensional PEDSIM visualizer."); 35 | cparser.addHelpOption(); 36 | 37 | 38 | QCommandLineOption quietOption(QStringList() << "q" << "quiet", "Do not show graphical output"); 39 | cparser.addOption(quietOption); 40 | 41 | QCommandLineOption networkOption(QStringList() << "n" << "network", "Read input from network on port ", "port"); 42 | cparser.addOption(networkOption); 43 | 44 | QCommandLineOption fileOption(QStringList() << "f" << "file", "Read input from ", "file"); 45 | cparser.addOption(fileOption); 46 | 47 | QCommandLineOption chartsOption(QStringList() << "c" << "charts", "Display charts DockWidget"); 48 | cparser.addOption(chartsOption); 49 | 50 | QCommandLineOption metricsOption(QStringList() << "m" << "metrics", "Display metrics DockWidget"); 51 | cparser.addOption(metricsOption); 52 | 53 | QCommandLineOption outputOption(QStringList() << "o" << "outputdirectory", "Write frame-by-frame image output to ", "directory"); 54 | cparser.addOption(outputOption); 55 | 56 | // Process the actual command line arguments given by the user 57 | cparser.process(app); 58 | 59 | g_option_writefile = cparser.isSet(outputOption); 60 | g_option_writefile_directory = cparser.value(outputOption); 61 | 62 | g_option_network = cparser.isSet(networkOption); 63 | g_option_network_port = cparser.value(networkOption).toInt(); 64 | 65 | g_option_file = cparser.isSet(fileOption); 66 | g_option_file_name = cparser.value(fileOption); 67 | 68 | g_option_charts = cparser.isSet(chartsOption); 69 | g_option_metrics = cparser.isSet(metricsOption); 70 | 71 | 72 | qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime())); 73 | 74 | 75 | QFile File("darkorange.qss"); 76 | File.open(QFile::ReadOnly); 77 | QString StyleSheet = QLatin1String(File.readAll()); 78 | 79 | qApp->setStyleSheet(StyleSheet); 80 | 81 | 82 | MainWindow mainWin; 83 | 84 | // show output if not disabled (quiet) 85 | if (!cparser.isSet(quietOption)) { 86 | mainWin.show(); 87 | return app.exec(); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /ecosystem/2dvis/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifdef USE_CHARTS 5 | #include "chartswidget.h" 6 | ChartsWidget *chartswidget; 7 | #endif 8 | 9 | #include "mainwindow.h" 10 | #include "metricswidget.h" 11 | #include "receiver.h" 12 | #include "messageparser.h" 13 | 14 | #include "globals.h" 15 | 16 | static const double SCALE = 10.0; 17 | MetricsWidget *metricswidget; 18 | 19 | QGraphicsScene *scene; 20 | 21 | Receiver *receiver; 22 | 23 | 24 | MainWindow::MainWindow() { 25 | scene = new QGraphicsScene(); 26 | scene->setSceneRect(SCALE * -100, SCALE * -100, SCALE * 200, SCALE * 200); 27 | scene->setItemIndexMethod(QGraphicsScene::NoIndex); 28 | scene->setBackgroundBrush(Qt::black); 29 | 30 | view = new MyGraphicsView(scene); 31 | 32 | view->setRenderHint(QPainter::Antialiasing); 33 | //view->setBackgroundBrush(QPixmap(":/images/street.jpg")); 34 | // view->setCacheMode(QGraphicsView::CacheBackground); 35 | view->setBackgroundBrush(QColor(24, 24, 24)); 36 | // view->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); 37 | view->setDragMode(QGraphicsView::ScrollHandDrag); 38 | // view->scale(0.5, 0.5); 39 | 40 | resize(1440, 810); 41 | setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "PEDSIM's 2D Visualizer")); 42 | 43 | setCentralWidget(view); 44 | 45 | // QTimer timer; 46 | // QObject::connect(&timer, SIGNAL(timeout()), scene, SLOT(advance())); 47 | // timer.start(1000 / 33); 48 | 49 | 50 | if (g_option_metrics) { 51 | metricswidget = new MetricsWidget; 52 | QDockWidget *dockWidget = new QDockWidget(tr("Metrics"), this); 53 | dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); 54 | dockWidget->setWidget(metricswidget); 55 | addDockWidget(Qt::LeftDockWidgetArea, dockWidget); 56 | } 57 | 58 | #ifdef USE_CHARTS 59 | if (g_option_charts) { 60 | chartswidget = new ChartsWidget; 61 | QDockWidget *dockWidget = new QDockWidget(tr("Charts"), this); 62 | dockWidget->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); 63 | dockWidget->setWidget(chartswidget); 64 | addDockWidget(Qt::TopDockWidgetArea, dockWidget); 65 | } 66 | #endif 67 | 68 | 69 | // use network stream as input 70 | if (g_option_network) { 71 | receiver = new Receiver(g_option_network_port); 72 | } 73 | 74 | // use provided file as input 75 | if (g_option_file) { 76 | QFile inputFile(g_option_file_name); 77 | if (inputFile.open(QIODevice::ReadOnly)) { 78 | QTextStream in(&inputFile); 79 | while (!in.atEnd()) { 80 | QString line = "" + in.readLine() + ""; 81 | QByteArray datagram = line.toUtf8(); 82 | MessageParser parser(datagram); 83 | parser.parse(); 84 | update(); 85 | } 86 | inputFile.close(); 87 | } 88 | } 89 | 90 | 91 | }; 92 | -------------------------------------------------------------------------------- /ecosystem/2dvis/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include "mygraphicsview.h" 6 | 7 | 8 | class MainWindow : public QMainWindow { 9 | Q_OBJECT 10 | 11 | public: 12 | MainWindow(); 13 | MyGraphicsView *view; 14 | 15 | }; 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /ecosystem/2dvis/messageparser.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef MESSAGEPARSER_H 7 | #define MESSAGEPARSER_H 8 | 9 | #include 10 | #include 11 | 12 | class MessageParser : public QObject { 13 | Q_OBJECT 14 | 15 | public: 16 | MessageParser(QByteArray datagram); 17 | 18 | public: 19 | void parse(); 20 | 21 | signals: 22 | void updateAgentPosition(int id, double x, double y); 23 | void updateObstaclePosition(int id, double x, double y); 24 | 25 | private: 26 | QDomDocument doc; 27 | 28 | 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /ecosystem/2dvis/metricsfield.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "metricsfield.h" 4 | 5 | 6 | MetricsField::MetricsField(QString name) { 7 | value = 0.0; 8 | 9 | 10 | QGroupBox *groupbox = new QGroupBox(name); 11 | label = new QLabel(QString::number(value)); 12 | 13 | QVBoxLayout *vbox = new QVBoxLayout; 14 | vbox->addWidget(label); 15 | groupbox->setLayout(vbox); 16 | 17 | QVBoxLayout *layout; 18 | layout = new QVBoxLayout(); 19 | 20 | layout->addWidget(groupbox); 21 | 22 | setLayout(layout); 23 | 24 | 25 | } 26 | 27 | void MetricsField::update(double pvalue) { 28 | value = pvalue; 29 | label->setText(QString::number(value)); 30 | } 31 | -------------------------------------------------------------------------------- /ecosystem/2dvis/metricsfield.h: -------------------------------------------------------------------------------- 1 | #ifndef METRICSFIELD_H 2 | #define METRICSFIELD_H 3 | 4 | #include 5 | 6 | class MetricsField : public QWidget { 7 | Q_OBJECT 8 | 9 | public: 10 | MetricsField(QString name); 11 | 12 | void update(double value); 13 | 14 | private: 15 | double value; 16 | QLabel *label; 17 | }; 18 | 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /ecosystem/2dvis/metricswidget.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "metricswidget.h" 4 | #include "metricsfield.h" 5 | 6 | 7 | 8 | MetricsWidget::MetricsWidget() { 9 | 10 | // MetricsField *button1 = new MetricsField("Timestep"); 11 | QSpacerItem *spacer = new QSpacerItem(100, 20, QSizePolicy::Expanding, QSizePolicy::Expanding); 12 | 13 | layout = new QVBoxLayout; 14 | 15 | layout->addItem(spacer); 16 | // layout->addWidget(button1); 17 | 18 | setLayout(layout); 19 | }; 20 | 21 | void MetricsWidget::update(QString name, double value) { 22 | if (metrics.contains(name)) { 23 | metrics[name]->update(value); 24 | } else { 25 | metrics[name] = new MetricsField(name); 26 | layout->addWidget(metrics[name]); 27 | } 28 | } 29 | 30 | void MetricsWidget::clear() { 31 | foreach (QWidget* value, metrics) { 32 | layout->removeWidget(value); 33 | delete value; 34 | } 35 | metrics.clear(); 36 | } 37 | -------------------------------------------------------------------------------- /ecosystem/2dvis/metricswidget.h: -------------------------------------------------------------------------------- 1 | #ifndef METRICSWIDGET_H 2 | #define METRICSWIDGET_H 3 | 4 | #include 5 | 6 | class MetricsField; 7 | 8 | class MetricsWidget : public QWidget { 9 | Q_OBJECT 10 | 11 | public: 12 | MetricsWidget(); 13 | 14 | void update(QString name, double value); 15 | void clear(); 16 | 17 | private: 18 | QHash metrics; 19 | QVBoxLayout *layout; 20 | 21 | }; 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /ecosystem/2dvis/mygraphicsview.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include "mygraphicsview.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | MyGraphicsView::MyGraphicsView(QGraphicsScene * scene, QWidget* parent) : QGraphicsView(parent) { 18 | setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); 19 | setScene(scene); 20 | } 21 | 22 | 23 | void MyGraphicsView::wheelEvent(QWheelEvent* event) { 24 | setTransformationAnchor(QGraphicsView::AnchorUnderMouse); 25 | 26 | // Scale the view / do the zoom 27 | double scaleFactor = 1.15; 28 | if(event->delta() > 0) { 29 | // Zoom in 30 | scale(scaleFactor, scaleFactor); 31 | } else { 32 | // Zooming out 33 | scale(1.0 / scaleFactor, 1.0 / scaleFactor); 34 | } 35 | // Don't call superclass handler here 36 | // as wheel is normally used for moving scrollbars 37 | } 38 | -------------------------------------------------------------------------------- /ecosystem/2dvis/mygraphicsview.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | // inherited from http://www.qtcentre.org/wiki/index.php?title=QGraphicsView:_Smooth_Panning_and_Zooming 7 | 8 | #ifndef MYGRAPHICSVIEW_H 9 | #define MYGRAPHICSVIEW_H 10 | 11 | #include 12 | #include 13 | 14 | class MyGraphicsView : public QGraphicsView { 15 | public: 16 | MyGraphicsView(QGraphicsScene *scene, QWidget* parent = NULL); 17 | 18 | protected: 19 | virtual void wheelEvent(QWheelEvent* event); 20 | 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /ecosystem/2dvis/obstacle.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include "obstacle.h" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | static const double SCALE = 10.0; 15 | 16 | 17 | Obstacle::Obstacle() : color(qrand() % 256, qrand() % 256, qrand() % 256) { 18 | } 19 | 20 | 21 | QRectF Obstacle::boundingRect() const { 22 | qreal adjust = 0.5; 23 | return QRectF(SCALE * (-1800 - adjust), SCALE * (-2200 - adjust), SCALE * (3600 + adjust), SCALE * (6000 + adjust)); 24 | } 25 | 26 | 27 | QPainterPath Obstacle::shape() const { 28 | QPainterPath path; 29 | path.addRect(SCALE * -1000, SCALE * -1000, SCALE * 2000, SCALE * 2000); 30 | return path; 31 | } 32 | 33 | 34 | void Obstacle::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { 35 | painter->setBrush(color); 36 | 37 | painter->setPen(QPen(QBrush(QColor(255, 255, 255, 255)), SCALE * 0.1)); 38 | painter->drawLine(0, 0, SCALE * dx, SCALE * dy); 39 | painter->setPen(QPen(QBrush(QColor(0, 200, 255, 50)), SCALE * 1)); 40 | painter->drawLine(0, 0, SCALE * dx, SCALE * dy); 41 | } 42 | 43 | 44 | void Obstacle::advance(int step) { 45 | if (!step) return; 46 | setPos(SCALE * x, SCALE * y); 47 | // std::cout << x << "/" << y << " " << dx << "/" << dy << std::endl; 48 | } 49 | -------------------------------------------------------------------------------- /ecosystem/2dvis/obstacle.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef OBSTACLE_H 7 | #define OBSTACLE_H 8 | 9 | #include "item.h" 10 | 11 | #include 12 | 13 | class Obstacle : public Item { 14 | 15 | public: 16 | Obstacle(); 17 | 18 | QRectF boundingRect() const; 19 | QPainterPath shape() const; 20 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); 21 | 22 | protected: 23 | void advance(int step); 24 | 25 | private: 26 | QColor color; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /ecosystem/2dvis/receiver.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #include "messageparser.h" 12 | #include "receiver.h" 13 | 14 | 15 | Receiver::Receiver(int port, QWidget *parent) : QWidget(parent) { 16 | udpSocket = new QUdpSocket(this); 17 | if (udpSocket->bind(QHostAddress::AnyIPv4, port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint) == true) { 18 | connect(udpSocket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams())); 19 | std::cout << "Listening for UDP/XML packets on port " << port << std::endl; 20 | } else { 21 | std::cout << "Can't bind socket to port " << port << std::endl; 22 | } 23 | } 24 | 25 | 26 | void Receiver::processPendingDatagrams() { 27 | while (udpSocket->hasPendingDatagrams()) { 28 | QByteArray datagram; 29 | datagram.resize(udpSocket->pendingDatagramSize()); 30 | udpSocket->readDatagram(datagram.data(), datagram.size()); 31 | // std::cout << QString(datagram).toUtf8().constData() << std::endl; 32 | MessageParser parser(datagram); 33 | parser.parse(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ecosystem/2dvis/receiver.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef RECEIVER_H 7 | #define RECEIVER_H 8 | 9 | #include 10 | 11 | class QLabel; 12 | class QPushButton; 13 | class QUdpSocket; 14 | class QAction; 15 | 16 | class Receiver : public QWidget { 17 | Q_OBJECT 18 | 19 | public: 20 | Receiver(int port, QWidget *parent = 0); 21 | 22 | private slots: 23 | void processPendingDatagrams(); 24 | 25 | private: 26 | QLabel *statusLabel; 27 | QPushButton *quitButton; 28 | QUdpSocket *udpSocket; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /ecosystem/2dvis/waypoint.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include "waypoint.h" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | static const double SCALE = 10.0; 13 | 14 | 15 | //Waypoint::Waypoint() : color(qrand() % 256, qrand() % 256, qrand() % 256) {} 16 | 17 | Waypoint::Waypoint() : color(127, 0, 0, 20) {} 18 | 19 | QRectF Waypoint::boundingRect() const { 20 | // qreal adjust = 0.5; 21 | return QRectF(SCALE * (-radius), SCALE * (-radius), SCALE * radius * 2, SCALE * radius *2); 22 | } 23 | 24 | 25 | QPainterPath Waypoint::shape() const { 26 | QPainterPath path; 27 | path.addRect(SCALE * (-radius), SCALE * (-radius), SCALE * radius * 2, SCALE * radius *2); 28 | return path; 29 | } 30 | 31 | 32 | void Waypoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { 33 | painter->setBrush(color); 34 | painter->setPen(QPen(QBrush(Qt::red), 1)); 35 | painter->drawEllipse(SCALE * (-radius), SCALE * (-radius), SCALE * radius * 2, SCALE * radius *2); 36 | } 37 | 38 | 39 | void Waypoint::advance(int step) { 40 | if (!step) return; 41 | setPos(SCALE * x, SCALE * y); 42 | } 43 | -------------------------------------------------------------------------------- /ecosystem/2dvis/waypoint.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef WAYPOINT_H 7 | #define WAYPOINT_H 8 | 9 | #include "item.h" 10 | 11 | #include 12 | 13 | class Waypoint : public Item { 14 | 15 | public: 16 | Waypoint(); 17 | 18 | QRectF boundingRect() const; 19 | QPainterPath shape() const; 20 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); 21 | 22 | protected: 23 | void advance(int step); 24 | 25 | private: 26 | QColor color; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /ecosystem/3dvis/3dvis.pro: -------------------------------------------------------------------------------- 1 | 2 | TEMPLATE = app 3 | 4 | QT += 3dcore 3drender 3dinput 3dextras xml network 5 | 6 | SOURCES += \ 7 | main.cpp \ 8 | item.cpp \ 9 | itemagent.cpp \ 10 | itemcontainer.cpp \ 11 | itemobstacle.cpp \ 12 | messageparser.cpp \ 13 | receiver.cpp 14 | 15 | HEADERS += \ 16 | item.h \ 17 | itemagent.h \ 18 | itemcontainer.h \ 19 | itemobstacle.h \ 20 | messageparser.h \ 21 | receiver.h 22 | 23 | -------------------------------------------------------------------------------- /ecosystem/3dvis/3dvis.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "3dvis", "3dvis.vcxproj", "{3857B26B-BBD3-3690-A53D-EF0F6B59ED66}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {3857B26B-BBD3-3690-A53D-EF0F6B59ED66}.Debug|x64.ActiveCfg = Debug|x64 15 | {3857B26B-BBD3-3690-A53D-EF0F6B59ED66}.Debug|x64.Build.0 = Debug|x64 16 | {3857B26B-BBD3-3690-A53D-EF0F6B59ED66}.Release|x64.ActiveCfg = Release|x64 17 | {3857B26B-BBD3-3690-A53D-EF0F6B59ED66}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /ecosystem/3dvis/3dvis.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} 6 | cpp;c;cxx;moc;h;def;odl;idl;res; 7 | 8 | 9 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} 10 | cpp;c;cxx;moc;h;def;odl;idl;res; 11 | 12 | 13 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 14 | h;hpp;hxx;hm;inl;inc;xsd 15 | 16 | 17 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 18 | h;hpp;hxx;hm;inl;inc;xsd 19 | 20 | 21 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 22 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 23 | 24 | 25 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 26 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 27 | 28 | 29 | {167acb30-849c-40c0-b27b-d8d3222c0cb8} 30 | cpp;moc 31 | False 32 | 33 | 34 | {5b30a7e7-0861-426c-81d3-702d6917957a} 35 | cpp;moc 36 | False 37 | 38 | 39 | 40 | 41 | Source Files 42 | 43 | 44 | Source Files 45 | 46 | 47 | Source Files 48 | 49 | 50 | Source Files 51 | 52 | 53 | Source Files 54 | 55 | 56 | Source Files 57 | 58 | 59 | Source Files 60 | 61 | 62 | Generated Files\Debug 63 | 64 | 65 | Generated Files\Release 66 | 67 | 68 | Generated Files\Debug 69 | 70 | 71 | Generated Files\Release 72 | 73 | 74 | Generated Files\Debug 75 | 76 | 77 | Generated Files\Release 78 | 79 | 80 | 81 | 82 | Header Files 83 | 84 | 85 | Header Files 86 | 87 | 88 | Header Files 89 | 90 | 91 | Header Files 92 | 93 | 94 | Header Files 95 | 96 | 97 | Header Files 98 | 99 | 100 | -------------------------------------------------------------------------------- /ecosystem/3dvis/README.md: -------------------------------------------------------------------------------- 1 | 3-Dimensional Visualizer {#threedvis} 2 | ======================== 3 | 4 | 5 | The 3-dimensional visualizer is a separate application that can be 6 | used to visualize the output of a PEDSIM simulation run. It listens on 7 | a network socket for update information (agent positions, but also 8 | dynamic scene definitions.), which are rendered in real-time. This is 9 | perfectly suited to observe stand-allone simulations or optimizations 10 | which take a long time to run. Also nice for demonstrations, where the 11 | visualizer is installed on the machine connected to the beamer, and 12 | the simulation runs on a separate host. 13 | 14 | The difference between the two visualizers is that [2dvis](@ref 15 | twodvis) is intended for displaying a technical view of the scenario, 16 | while 3dvis show a "real" view. 3dvis does not render the scenario 17 | realistically in any way - however, it only shows what would be 18 | visible in real live - i.e. no waypoints or forces. 19 | 20 | _3dvis_ is built on _Qt_. You need _Qt 5.7_ or above with Qt3D (might 21 | be included, check when you install Qt). See further documenation for 22 | compiling on [Linux](@ref linux) and [Windows](@ref windows). 23 | 24 | 25 | ## Usage 26 | 27 | `3dvis` is always started in network mode, where it listens to 28 | incoming data packets on the specified UDP port. In contrast to 2dvis, 29 | it can not render file based input. 30 | 31 | ~~~~ .sh 32 | ./3dvis 33 | ~~~~ 34 | 35 | ## Video generation 36 | 37 | There is no built in video generation mode for 3dvis. In order to 38 | caputre a video from a 3dvis animation, use a 3rd party capture tool, 39 | ideally one that supports your 3D graphics card natively. 40 | 41 | ## Supported XML tags 42 | 43 | See [here](@ref xml) for a list of valid XML tags. However, 3dvis does 44 | not render all tags. It only renders objects that have a physical 45 | representation, e.g. agents or obstacles. 46 | 47 |  48 | 49 | @latexonly 50 | \includegraphics[width=\textwidth]{3dvis.png} 51 | @endlatexonly 52 | -------------------------------------------------------------------------------- /ecosystem/3dvis/documentation/3dvis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chgloor/pedsim/0d8ff5c652ee2a1a59cea68a638d7ef399f41048/ecosystem/3dvis/documentation/3dvis.png -------------------------------------------------------------------------------- /ecosystem/3dvis/item.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include "item.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | Item::Item(Qt3DCore::QEntity *rootEntity) : Qt3DCore::QEntity(rootEntity), transform(new Qt3DCore::QTransform), r(0) { 15 | // does basically nothing for the time being. 16 | } 17 | 18 | void Item::updateComponents() { 19 | transform->setTranslation(QVector3D(x, z, y)); 20 | //transform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(0, 1, 0), r)); 21 | }; 22 | 23 | -------------------------------------------------------------------------------- /ecosystem/3dvis/item.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef ITEM_H 7 | #define ITEM_H 8 | 9 | #include 10 | #include 11 | 12 | class Item : public Qt3DCore::QEntity { 13 | public: 14 | Item(Qt3DCore::QEntity *rootEntity); 15 | virtual void updateComponents(); 16 | 17 | double x; 18 | double y; 19 | double z; 20 | double r; // rotation 21 | 22 | 23 | protected: 24 | Qt3DCore::QTransform *transform; 25 | 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /ecosystem/3dvis/itemagent.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include "itemagent.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | 15 | ItemAgent::ItemAgent(Qt3DCore::QEntity *rootEntity) : Item(rootEntity) { 16 | Qt3DExtras::QGoochMaterial *material = new Qt3DExtras::QGoochMaterial(rootEntity); 17 | 18 | Qt3DCore::QEntity *entity = new Qt3DCore::QEntity(rootEntity); 19 | material->setDiffuse(QColor(QRgb(0xaaaaaa))); 20 | 21 | Qt3DExtras::QCylinderMesh *m = new Qt3DExtras::QCylinderMesh; 22 | m->setRadius(0.75); 23 | m->setLength(2); 24 | m->setRings(30); 25 | m->setSlices(10); 26 | 27 | entity->addComponent(m); 28 | entity->addComponent(transform); 29 | entity->addComponent(material); 30 | } 31 | 32 | void ItemAgent::updateComponents() { 33 | transform->setTranslation(QVector3D(x, 1.0+z, y)); 34 | //transform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(0, 1, 0), r)); 35 | }; 36 | -------------------------------------------------------------------------------- /ecosystem/3dvis/itemagent.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef ITEMAGENT_H 7 | #define ITEMAGENT_H 8 | 9 | #include 10 | #include 11 | 12 | #include "item.h" 13 | 14 | //class Item : public QGraphicsItem { 15 | class ItemAgent : public Item { 16 | public: 17 | ItemAgent(Qt3DCore::QEntity *rootEntity); 18 | virtual void updateComponents(); 19 | 20 | 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /ecosystem/3dvis/itemcontainer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include "itemcontainer.h" 7 | #include "item.h" 8 | 9 | #include 10 | 11 | extern Qt3DCore::QEntity *scene; 12 | 13 | 14 | ItemContainer::ItemContainer() {} 15 | 16 | // Removes all items from the container 17 | void ItemContainer::clear() { 18 | container.clear(); 19 | } 20 | 21 | void ItemContainer::for_each(void (*fn)(Item*)) { 22 | QHash::iterator it; 23 | for (it = container.begin(); it != container.end(); ++it) { 24 | fn(*it); 25 | } 26 | } 27 | 28 | void ItemContainer::removeItem(QString id) { 29 | // scene->removeItem(container[id]); 30 | container[id]->z = -100; // don't know how to remove from scene. Send to agent heaven (which is below 0) 31 | container[id]->updateComponents(); 32 | container.remove(id); 33 | //container[id]->deleteLater(); 34 | // scene->removeComponent(dynamic_cast(container[id])); 35 | }; 36 | 37 | void ItemContainer::updatePosition(QString id, double x, double y) { 38 | double oldx = container[id]->x; 39 | double oldy = container[id]->y; 40 | 41 | container[id]->x = x; 42 | container[id]->y = y; 43 | 44 | container[id]->updateComponents(); 45 | // double newr = atan2(y-oldy, x-oldx) * 180 / 3.1415; 46 | // double oldr = container[id]->rotation(); 47 | // double r = oldr * 0.96 + newr * 0.04; 48 | // container[id]->setRotation(r); 49 | } 50 | 51 | void ItemContainer::setRotation(QString id, double r) { 52 | container[id]->r = r; 53 | container[id]->updateComponents(); 54 | }; 55 | 56 | Item* ItemContainer::at(QString id) { 57 | return container[id]; 58 | } 59 | -------------------------------------------------------------------------------- /ecosystem/3dvis/itemcontainer.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef ITEMCONTAINER_H 7 | #define ITEMCONTAINER_H 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | class ItemContainer : public QObject { 16 | Q_OBJECT 17 | 18 | public: 19 | ItemContainer(); 20 | void addItem(QString id, Item *i) {container[id]=i; }; 21 | void removeItem(QString id); 22 | bool contains(QString id) { return (container.contains(id)); }; 23 | void for_each(void (*fn)(Item*)); 24 | Item* at(QString id); 25 | 26 | public slots: 27 | void clear(); 28 | void setRotation(QString id, double r); 29 | void updatePosition(QString id, double x, double y); 30 | 31 | 32 | private: 33 | QHash container; 34 | 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /ecosystem/3dvis/itemobstacle.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include "itemobstacle.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | 15 | ItemObstacle::ItemObstacle(Qt3DCore::QEntity *rootEntity, double l) : Item(rootEntity), l(l) { 16 | Qt3DExtras::QGoochMaterial *material = new Qt3DExtras::QGoochMaterial(rootEntity); 17 | material->setDiffuse(QColor(QRgb(0xaaaaaa))); 18 | 19 | Qt3DCore::QEntity *entity = new Qt3DCore::QEntity(rootEntity); 20 | 21 | Qt3DExtras::QCuboidMesh *m = new Qt3DExtras::QCuboidMesh; 22 | m->setXExtent((l>0)? l : 1.0); 23 | m->setYExtent(4); 24 | m->setZExtent(0.5); 25 | 26 | entity->addComponent(m); 27 | entity->addComponent(transform); 28 | entity->addComponent(material); 29 | } 30 | 31 | 32 | void ItemObstacle::updateComponents() { 33 | QMatrix4x4 m; 34 | m.translate(QVector3D(x, 2, y)); 35 | m.rotate(r, QVector3D(0.0f, 1.0f, 0.0f)); 36 | m.translate(QVector3D(l / 2.0, 0, 0)); 37 | transform->setMatrix(m); 38 | }; -------------------------------------------------------------------------------- /ecosystem/3dvis/itemobstacle.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef ITEMOBSTACLE_H 7 | #define ITEMOBSTACLE_H 8 | 9 | #include 10 | #include 11 | 12 | #include "item.h" 13 | 14 | class ItemObstacle : public Item { 15 | public: 16 | ItemObstacle(Qt3DCore::QEntity *rootEntity, double l); 17 | virtual void updateComponents(); 18 | 19 | private: 20 | double l; 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /ecosystem/3dvis/main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | #include "qt3dwindow.h" 28 | 29 | #include "item.h" 30 | #include "itemcontainer.h" 31 | #include "receiver.h" 32 | 33 | 34 | ItemContainer agentcontainer; 35 | ItemContainer obstaclecontainer; 36 | Receiver *receiver; 37 | 38 | Qt3DCore::QEntity *scene; 39 | 40 | Qt3DCore::QEntity *createScene() { 41 | // Root entity 42 | Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity; 43 | 44 | // Material 45 | Qt3DRender::QMaterial *material = new Qt3DExtras::QGoochMaterial(rootEntity); 46 | 47 | Qt3DCore::QEntity *planeEntity; 48 | // Plane shape data 49 | Qt3DExtras::QPlaneMesh *planeMesh = new Qt3DExtras::QPlaneMesh(); 50 | planeMesh->setWidth(100* 2 * 125.0f); 51 | planeMesh->setHeight(100* 2 * 75.0f); 52 | 53 | // Plane mesh transform 54 | Qt3DCore::QTransform *planeTransform = new Qt3DCore::QTransform(); 55 | 56 | Qt3DExtras::QGoochMaterial *planeMaterial = new Qt3DExtras::QGoochMaterial(); 57 | planeMaterial->setDiffuse(QColor(QRgb(0x33aa33))); 58 | 59 | // Light 60 | Qt3DRender::QDirectionalLight *l = new Qt3DRender::QDirectionalLight(); 61 | l->setWorldDirection(QVector3D(0.3, -1, 0.3)); 62 | 63 | // Plane 64 | planeEntity = new Qt3DCore::QEntity(rootEntity); 65 | planeEntity->addComponent(planeMesh); 66 | planeEntity->addComponent(planeMaterial); 67 | planeEntity->addComponent(planeTransform); 68 | planeEntity->addComponent(l); 69 | return rootEntity; 70 | } 71 | 72 | 73 | int main(int argc, char* argv[]) { 74 | QGuiApplication app(argc, argv); 75 | Qt3DExtras::Qt3DWindow view; 76 | 77 | scene = createScene(); 78 | receiver = new Receiver(2222); 79 | 80 | // Camera 81 | Qt3DRender::QCamera *camera = view.camera(); 82 | camera->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f); 83 | camera->setPosition(QVector3D(0, 75.0f, 200.0f)); 84 | camera->setViewCenter(QVector3D(0, 0, 0)); 85 | 86 | // For camera controls 87 | Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(scene); 88 | camController->setLinearSpeed(50.0f); 89 | camController->setLookSpeed(180.0f); 90 | camController->setCamera(camera); 91 | 92 | view.setRootEntity(scene); 93 | view.resize(1280, 720); 94 | view.show(); 95 | 96 | return app.exec(); 97 | } 98 | -------------------------------------------------------------------------------- /ecosystem/3dvis/messageparser.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef MESSAGEPARSER_H 7 | #define MESSAGEPARSER_H 8 | 9 | #include 10 | #include 11 | 12 | class MessageParser : public QObject { 13 | Q_OBJECT 14 | 15 | public: 16 | MessageParser(QByteArray datagram); 17 | 18 | public: 19 | void parse(); 20 | 21 | signals: 22 | void updateAgentPosition(int id, double x, double y); 23 | void updateObstaclePosition(int id, double x, double y); 24 | 25 | private: 26 | QDomDocument doc; 27 | 28 | 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /ecosystem/3dvis/receiver.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #include 7 | #include 8 | #include "messageparser.h" 9 | #include "receiver.h" 10 | 11 | //Receiver::Receiver(int port, QWidget *parent) : QWidget(parent) { 12 | Receiver::Receiver(int port) : QObject() { 13 | udpSocket = new QUdpSocket(this); 14 | if (udpSocket->bind(QHostAddress::AnyIPv4, port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint) == true) { 15 | connect(udpSocket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams())); 16 | std::cout << "Listening for UDP/XML packets on port " << port << std::endl; 17 | } else { 18 | std::cout << "Can't bind socket to port " << port << std::endl; 19 | } 20 | } 21 | 22 | 23 | void Receiver::processPendingDatagrams() { 24 | while (udpSocket->hasPendingDatagrams()) { 25 | QByteArray datagram; 26 | datagram.resize(udpSocket->pendingDatagramSize()); 27 | udpSocket->readDatagram(datagram.data(), datagram.size()); 28 | // std::cout << QString(datagram).toUtf8().constData() << std::endl; 29 | MessageParser parser(datagram); 30 | parser.parse(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ecosystem/3dvis/receiver.h: -------------------------------------------------------------------------------- 1 | // 2 | // pedsim - A microscopic pedestrian simulation system. 3 | // Copyright (c) by Christian Gloor 4 | // 5 | 6 | #ifndef RECEIVER_H 7 | #define RECEIVER_H 8 | 9 | #include 10 | 11 | class QLabel; 12 | class QPushButton; 13 | class QUdpSocket; 14 | class QAction; 15 | 16 | class Receiver : public QObject { 17 | Q_OBJECT 18 | 19 | public: 20 | Receiver(int port); 21 | 22 | private slots: 23 | void processPendingDatagrams(); 24 | 25 | private: 26 | QUdpSocket *udpSocket; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /ecosystem/demoapp/README.md: -------------------------------------------------------------------------------- 1 | PEDSIM Demo Application {#demoapp} 2 | ======================= 3 | 4 | ## Introduction and purpose of the Demo Application 5 | 6 | Originally, PEDSIM was a monolithic software package that was capable 7 | to read simple scenario definitions from a file and run the crowd 8 | simulation. This was PEDSIM version 1.x. For version 2.x, PEDSIM has 9 | been separated into a library and the Demo Application. These two 10 | pieces of software do more or less the same as PEDSIM Version 1.x, but 11 | with less import/export and scenario analysis features. 12 | 13 | The main focus of development is on the PEDSIM library, since it is 14 | assumed that interested users are quickly able to develop their own 15 | software using the library. The Demo Application is still being 16 | maintained, but no longer extended. Its purpose is now to show how 17 | `libpedsim` can be used in a flexible way. It uses OOP inheritance to 18 | achive a tighter integration. These offers possibilities beyond what 19 | is presented in the code examples. 20 | 21 | At the same time the Demo App is used as a _manual_ integration test 22 | case. The library contains unit and user acceptance tests, based on 23 | the Google test framework. These tests are run automatically and are 24 | supposed to cover all possible aspects of failure. However, I believe 25 | that in the end a human has to look at the output of the system and 26 | judge if everything still looks sane. This is what the Demo 27 | Application is used for internally. 28 | 29 | The scenario input features mentioned above are still a good starting 30 | point for your own small experiments. It is possible to define a 31 | scenario by writing a simple XML file, and use the user interface to 32 | quickly play with the various forces of the underlying model. 33 | 34 | ## More Documentation 35 | 36 | - @ref demoapp_gui 37 | - @ref demoapp_scenario 38 | 39 | ## Compilation 40 | 41 | Qt is needed to compile and run the demo application! See the 42 | installation documentation on [Linux](@ref linux) and [Windows](@ref windows) 43 | for more information regarding compillation of the source 44 | code. 45 | 46 | Please note that (at least for the time being) the DemoApp does not 47 | link `libpedsim` dynamically using the .dll on Windows or the .so 48 | library on Linux respectively. This is due to bug related to 49 | incompatible compiler versions or settings in Qt and msvc15, which is 50 | often used to compile the library on Windows. 51 | 52 | The source of `libpedsim` is directly included in the DemoApp Qt 53 | project file. This means that there is no need to compile the library 54 | separately at the moment. Compiling the DemoApp will also compile and 55 | statically link the library into the code. No need to link the 56 | library, or specify its location. 57 | 58 | This method of including `libpedsim` can also be used by your own 59 | project. Make sure you do not violate the terms of the GPL doing this, 60 | e.g. by including the library source into your commercial 61 | projects. (Linking the library is OK under the terms of the 62 | LGPL.) 63 | 64 |  65 | 66 | @latexonly 67 | \includegraphics[width=\textwidth]{screenshot.png} 68 | @endlatexonly 69 | -------------------------------------------------------------------------------- /ecosystem/demoapp/documentation/20120204-screenshot-v2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chgloor/pedsim/0d8ff5c652ee2a1a59cea68a638d7ef399f41048/ecosystem/demoapp/documentation/20120204-screenshot-v2-2.png -------------------------------------------------------------------------------- /ecosystem/demoapp/documentation/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | (c) 1995-2013 by Christian Gloor 23 | 24 | 25 | 26 | 27 |