mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
moved rtabmap-ros-pkg project in this project
git-svn-id: http://rtabmap.googlecode.com/svn/branches/0.3/rtabmap@52 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
36
guilib/ExamplePlot/CMakeLists.txt
Normal file
36
guilib/ExamplePlot/CMakeLists.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
ADD_DEFINITIONS(-DPLOT_WIDGET_OUT_OF_LIB)
|
||||
|
||||
### Qt Gui stuff ###
|
||||
SET(headers_ui
|
||||
../src/Plot.h
|
||||
MainWindow.h
|
||||
)
|
||||
|
||||
#This will generate moc_* for Qt
|
||||
QT4_WRAP_CPP(moc_srcs ${headers_ui})
|
||||
### Qt Gui stuff end###
|
||||
|
||||
SET(SRC_FILES
|
||||
../src/Plot.cpp
|
||||
main.cpp
|
||||
${moc_srcs}
|
||||
)
|
||||
|
||||
SET(INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../src
|
||||
)
|
||||
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
|
||||
SET(LIBRARIES
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
||||
#include files
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
|
||||
# create an executable file named "examplePlot" from the source files
|
||||
ADD_EXECUTABLE(examplePlot ${SRC_FILES})
|
||||
# Linking with Qt libraries
|
||||
TARGET_LINK_LIBRARIES(examplePlot ${LIBRARIES})
|
||||
45
guilib/ExamplePlot/MainWindow.h
Normal file
45
guilib/ExamplePlot/MainWindow.h
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
#ifndef MAINWINDOW_H_
|
||||
#define MAINWINDOW_H_
|
||||
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtCore/QTimer>
|
||||
#include "Plot.h"
|
||||
|
||||
// Note : compiled with -DPLOT_WIDGET_OUT_OF_LIB to
|
||||
// remove rtabmap's namespace and UtiLite dependency of Plot.
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow() {
|
||||
Plot * plot = new Plot(this);
|
||||
plot->setObjectName("Figure 1");
|
||||
plot->setMaxVisibleItems(25);
|
||||
this->setCentralWidget(plot); // ownership transferred
|
||||
PlotCurve * curveA = new PlotCurve("Curve A", this);
|
||||
PlotCurve * curveB = new PlotCurve("Curve B", this);
|
||||
curveA->setPen(QPen(Qt::red));
|
||||
curveB->setPen(QPen(Qt::blue));
|
||||
plot->addCurve(curveA); // ownership transferred
|
||||
plot->addCurve(curveB); // ownership transferred
|
||||
connect(this, SIGNAL(valueUpdatedA(float)), curveA, SLOT(addValue(float)));
|
||||
connect(this, SIGNAL(valueUpdatedB(float)), curveB, SLOT(addValue(float)));
|
||||
connect(&timer_, SIGNAL(timeout()), this, SLOT(updateCounter()));
|
||||
timer_.start(100);
|
||||
qsrand(1);
|
||||
}
|
||||
~MainWindow() {}
|
||||
public slots:
|
||||
void updateCounter() {
|
||||
emit valueUpdatedA(qrand() % 100);
|
||||
emit valueUpdatedB(qrand() % 50);
|
||||
}
|
||||
signals:
|
||||
void valueUpdatedA(float);
|
||||
void valueUpdatedB(float);
|
||||
private:
|
||||
QTimer timer_;
|
||||
};
|
||||
|
||||
#endif /* MAINWINDOW_H_ */
|
||||
12
guilib/ExamplePlot/main.cpp
Normal file
12
guilib/ExamplePlot/main.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include "MainWindow.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
MainWindow mainWindow;
|
||||
mainWindow.show();
|
||||
app.connect( &app, SIGNAL( lastWindowClosed() ),
|
||||
&app, SLOT( quit() ) );
|
||||
return app.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user