manet vizualizer
The following example is given with the Crowdad roma/taxi dataset available here. The traces are of the following format:
DRIVER_ID;TIMESTAMP;POSITION
The regular expression associated with it is:
(\d+);(\d{4}\-\d{2}\-\d{2}\s\d{2}\:\d{2}\:\d{2})[^;]+;POINT\(([^\s;]+)\s([^\s;]+)\)
The time format is:
yyyy-MM-dd HH:mm:ss
The input projection of the coordinates in the dataset is WGS84 (EPSG 4326):
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
Since we want to work with distances and spatial operations, we use a projected coordinate system that fits with the coordinate extent of the dataset, namely UTM zone 33N (EPSG 3065):
+proj=utm +zone=33 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
Note. You can use this website to transform WGS 84 lat/lon coordinates into UTM x/y coordinates. The website also gives the UTM zone associated with the lat/lon coordinates.
To add a new plugin under QT:
Right click on Plugin directory > Add new Subproject > Library > C++ Library > Fill the name > Requires QtWidgets
,QtGui
,QtCore
> Create the files you need to implement the decorator
Add in the *.pro
file:
QT += widgets concurrent
...
INCLUDEPATH += ../../manetviz
DESTDIR = ../../manetviz/plugins
In the <plugin_name>.h
file, add:
#include <QObject>
#include "iplugin.h"
Make the plugin inherit from the interface (eg. IPlugin
):
class <plugin_name>: public QObject, public IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.manet-viz.IPlugin" FILE "<plugin_name>.json")
Q_INTERFACES(IPlugin)
public:
<plugin_name>(); // constructor
// implement the abstract method
// inherited from IPlugin
QObject * getQObject() { return this; }
};
Create a new file in the plugin directory of the name: <plugin_name>.json
that includes:
{
"name" : "<plugin_name>",
"version" : "0.0.1",
"dependencies" : [],
"active" : "true"
}
On the plugin folder, right click > Add new > Qt > Qt Designer Form > Widget > Name control.ui
> Finish
Add the elements you want into the designer view. Do not forget to set a minimum width/height for the QWidget to see it.
In the <plugin_name>.h
, add the following:
namespace Ui {
class Control;
}
Add a private variable ui
:
Ui::Control *ui;
In the <plugin_name>.cpp
, add the following:
#include "ui_control.h"
Set the UI attribute for the plugin in the constructor in the cpp
file:
<plugin_name>::<plugin_name>():
ui(new Ui::Control) { ... }
Implement the QWidget * createControlWidget() const
method:
QWidget * control = new QWidget();
ui->setupUi(control);
... // init the widgets and connections
return control;
Clean all and run qmake