Commit a434e988 authored by VAN TOLL Wouter's avatar VAN TOLL Wouter
Browse files

- CMake: Renamed the main projects.

- Updated README.md to mention the GUI, Qt, and ORCA.
parent c6f7ee61
......@@ -35,7 +35,7 @@ include_directories( ./src/ ./src/Engine/ )
# === Include the GUI application (which requires Qt)?
option(UMANS_USE_GUI_APPLICATION "Include a GUI demo application (which relies on Qt)" OFF)
option(UMANS_USE_GUI_APPLICATION "Include a GUI demo application (which relies on Qt)" ON)
# === Use multithreading?
......@@ -61,17 +61,17 @@ add_library(Engine STATIC ${src_Engine})
# === Console application
if (WIN32)
add_executable(UMANS_ConsoleApplication_Windows ${src_ConsoleApplication})
target_link_libraries(UMANS_ConsoleApplication_Windows Engine)
add_executable(UMANS-ConsoleApplication-Windows ${src_ConsoleApplication})
target_link_libraries(UMANS-ConsoleApplication-Windows Engine)
else()
add_executable(UMANS_ConsoleApplication_Linux ${src_ConsoleApplication})
target_link_libraries(UMANS_ConsoleApplication_Linux Engine)
add_executable(UMANS-ConsoleApplication-Linux ${src_ConsoleApplication})
target_link_libraries(UMANS-ConsoleApplication-Linux Engine)
endif()
# === Dynamic library (e.g. a DLL on Windows) to include into other programs
add_library(UMANS_Library SHARED ${src_Library})
target_link_libraries(UMANS_Library Engine)
add_library(UMANS-Library SHARED ${src_Library})
target_link_libraries(UMANS-Library Engine)
# === Qt demo project (if enabled)
......@@ -90,16 +90,16 @@ if (UMANS_USE_GUI_APPLICATION)
qt5_add_resources(UI_RESOURCES_RCC ${UI_RESOURCES})
# --- define the project itself
add_executable(UMANS_QtDemo src/QtDemo/main.cpp ${src_QtDemo} ${UI_RESOURCES_RCC})
add_executable(UMANS-GUI src/QtDemo/main.cpp ${src_QtDemo} ${UI_RESOURCES_RCC})
# --- the project depends on some libraries
target_link_libraries(UMANS_QtDemo Engine Qt5::Widgets opengl32.lib glu32.lib)
target_link_libraries(UMANS-GUI Engine Qt5::Widgets opengl32.lib glu32.lib)
# --- post-build command: copy the required Qt DLLs, to prevent runtime errors
add_custom_command(TARGET UMANS_QtDemo POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Core> $<TARGET_FILE_DIR:UMANS_QtDemo>
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Gui> $<TARGET_FILE_DIR:UMANS_QtDemo>
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Widgets> $<TARGET_FILE_DIR:UMANS_QtDemo>
add_custom_command(TARGET UMANS-GUI POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Core> $<TARGET_FILE_DIR:UMANS-GUI>
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Gui> $<TARGET_FILE_DIR:UMANS-GUI>
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Widgets> $<TARGET_FILE_DIR:UMANS-GUI>
)
endif (UMANS_USE_GUI_APPLICATION)
......
......@@ -36,27 +36,35 @@ Please cite this publication when referring to UMANS in your work.
To start using UMANS, perform the following steps:
1. Clone or download the code from [our GitLab repository](https://gitlab.inria.fr/OCSR/UMANS/).
2. Download and install [CMake](https://cmake.org/).
2. Download and install [Qt](https://www.qt.io/) (optional) and [CMake](https://cmake.org/) (required).
(Qt is only needed if you want to compile the *UMANS-GUI* application.)
3. Use CMake to turn the codebase into a programming project for your IDE/compiler of choice.
(You can also disable the UMANS-GUI project here. If you disable it, you do not need a Qt installation.)
4. Compile the code in your IDE/compiler.
This should build two applications (see the [Main projects](#main-projects) section).
5. Test the UMANS console application by running it from the command line, with the desired arguments.
This should build several applications (see the [Main projects](#main-projects) section).
5. If you have compiled the UMANS-GUI program, run it and see an example simulation in action!
6. Test the UMANS console application by running it from the command line, with the desired arguments.
If you run the program without any arguments, it will print more detailed usage instructions.
6. Inspect the CSV files that the application has produced as output.
7. Inspect the CSV files that the application has produced as output.
Each CSV file contains the trajectory of one agent in the crowd.
You could consider using the [ChAOS](https://gitlab.inria.fr/OCSR/ChAOS/) software to visualize the crowd in 3D.
# Main projects
In the source code of UMANS, the simulation engine itself is contained in a static library named *Engine*.
This library can be used to compile two main applications:
This library is used by three main applications:
- *UMANS-ConsoleApplication*: A command-line-only program that can run a crowd-simulation scenario and report the results in various ways.
- *UMANS-Library*: A dynamic library with an API that can be integrated into other software (e.g. as a DLL).
- *UMANS-GUI*: A demo program with a (Qt) GUI, in which users can change the simulation with basic mouse and keyboard interaction.
# Third-party code / licenses
UMANS includes the following third-party code:
UMANS relies on the following third-party code:
### Qt
- Website: https://www.qt.io/
- License: Open Source (https://doc.qt.io/Qt-5/opensourcelicense.html)
### nanoflann (kd-trees)
- Source code: https://github.com/jlblancoc/nanoflann
......@@ -65,6 +73,10 @@ UMANS includes the following third-party code:
### tinyxml (XML parsing)
- Source code: https://github.com/leethomason/tinyxml2
- License: zlib (https://github.com/leethomason/tinyxml2/blob/master/LICENSE.txt)
### ORCA (one of the collision-avoidance algorithms in UMANS)
- Source code: https://github.com/snape/RVO2
- License: Apache (https://github.com/snape/RVO2/blob/master/LICENSE)
### earcut (Polygon triangulation)
- Source code: https://github.com/mapbox/earcut.hpp
......
......@@ -27,6 +27,8 @@
#include <QOpenGLShaderProgram>
#include <QCoreApplication>
#include <QFileDialog>
#include <QMessageBox>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -107,6 +109,12 @@ void UMANSOpenGLWidget::resetVisualization(bool deleteCurrentVisualization)
update();
}
void UMANSOpenGLWidget::showErrorMessage(const std::string& title, const std::string& details) const
{
QMessageBox messageBox(mainApplication);
messageBox.critical(0, QString::fromStdString(title), QString::fromStdString(details));
}
void UMANSOpenGLWidget::startNewSimulation(const std::string& scenarioFilename)
{
bool firstTime = simulator == nullptr;
......@@ -123,6 +131,11 @@ void UMANSOpenGLWidget::startNewSimulation(const std::string& scenarioFilename)
simulator = newSimulator;
}
else
{
showErrorMessage("Error",
"Failed to start a new simulation based on the file \"" + scenarioFilename + "\". Please see the console for more information.");
}
// reset the UI
resetVisualization(!firstTime);
......
......@@ -67,6 +67,7 @@ protected:
void keyReleaseEvent(QKeyEvent *event) override;
private:
void showErrorMessage(const std::string& title, const std::string& details) const;
void startNewSimulation(const std::string& scenarioFilename);
void resetVisualization(bool deleteCurrentVisualization);
......
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