-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdialog.cpp
104 lines (77 loc) · 2.19 KB
/
dialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include "dialog.h"
#include "ui_dialog.h"
#include <QDebug>
#include <QString>
#include <string>
#include <sstream>
#include <pcl/pcl_exports.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog),
pre_x(0.0),
pre_y(0.0),
pre_z(0.60),
isFirstTime(true)
{
ui->setupUi(this);
ui->lineEdit->setText("0.0");
ui->lineEdit_2->setText("0.0");
ui->lineEdit_3->setText("0.9");
}
Dialog::~Dialog()
{
delete ui;
}
double Dialog::getX()
{
ui->lineEdit->setValidator(new QDoubleValidator(this));
QString XMAX=ui->lineEdit->text();
double xmax=XMAX.toDouble();
return xmax;
}
double Dialog::getY()
{
ui->lineEdit_2->setValidator(new QDoubleValidator(this));
QString XMAX=ui->lineEdit_2->text();
double xmax=XMAX.toDouble();
return xmax;
}
double Dialog::getZ()
{
ui->lineEdit_3->setValidator(new QDoubleValidator(this));
QString XMAX=ui->lineEdit_3->text();
double xmax=XMAX.toDouble();
return xmax;
}
void Dialog::on_pushButton_clicked()
{
pre_x = getX();
pre_y = getY();
pre_z = getZ();
qDebug() << "[INF] Coordinates: x: " << pre_x << " y:" << pre_y << " z: " << pre_z;
std::stringstream ss;
#ifdef __linux__
ss << "./concat_point " << pre_x << " " << pre_y << " " << pre_z;
#else
ss << "concat_point.exe " << pre_x << " " << pre_y << " " << pre_z;
#endif
std::string command = ss.str();
qDebug() << "[INF] Concatenate Command: " << command.c_str();
std::system(command.c_str());
qDebug() << "[INF] Loading concated.pcd to show result...";;
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>);
if (pcl::io::loadPCDFile<pcl::PointXYZRGBA> ("concated.pcd", *cloud) == -1) //* load the file
{
std::string msg("[ERR] Couldn't read file concated.pcd\n");
qDebug() << msg.c_str();
return;
}
qDebug() << "[INF] concated.pcd loaded!";
pcl::visualization::CloudViewer viewer("Point Cloud Viewer");
while (!viewer.wasStopped()) {
viewer.showCloud(cloud);
}
}