36 #include <boost/lexical_cast.hpp> 50 GridPlugin::GridPlugin() :
51 config_widget_(new QWidget()),
61 ui_.color->setColor(Qt::red);
65 p.setColor(QPalette::Background, Qt::white);
69 QPalette p3(
ui_.status->palette());
70 p3.setColor(QPalette::Text, Qt::red);
71 ui_.status->setPalette(p3);
73 QObject::connect(
ui_.select_frame, SIGNAL(clicked()),
this, SLOT(
SelectFrame()));
74 QObject::connect(
ui_.frame, SIGNAL(textEdited(
const QString&)),
this, SLOT(
FrameEdited()));
75 QObject::connect(
ui_.alpha, SIGNAL(valueChanged(
double)),
this, SLOT(
SetAlpha(
double)));
76 QObject::connect(
ui_.x, SIGNAL(valueChanged(
double)),
this, SLOT(
SetX(
double)));
77 QObject::connect(
ui_.y, SIGNAL(valueChanged(
double)),
this, SLOT(
SetY(
double)));
78 QObject::connect(
ui_.size, SIGNAL(valueChanged(
double)),
this, SLOT(
SetSize(
double)));
79 QObject::connect(
ui_.rows, SIGNAL(valueChanged(
int)),
this, SLOT(
SetRows(
int)));
80 QObject::connect(
ui_.columns, SIGNAL(valueChanged(
int)),
this, SLOT(
SetColumns(
int)));
81 connect(
ui_.color, SIGNAL(colorEdited(
const QColor &)),
this, SLOT(
DrawIcon()));
98 icon.fill(Qt::transparent);
100 QPainter painter(&icon);
101 painter.setRenderHint(QPainter::Antialiasing,
true);
103 QPen pen(QColor(
ui_.color->color()));
106 pen.setCapStyle(Qt::SquareCap);
109 painter.drawLine(2, 2, 14, 2);
110 painter.drawLine(2, 2, 2, 14);
111 painter.drawLine(14, 2, 14, 14);
112 painter.drawLine(2, 14, 14, 14);
113 painter.drawLine(8, 2, 8, 14);
114 painter.drawLine(2, 8, 14, 8);
165 ui_.frame->setText(QString::fromStdString(frame));
214 QColor color =
ui_.color->color();
217 glColor4d(color.redF(), color.greenF(), color.blueF(),
alpha_);
224 glVertex2d(transformed_left_it->getX(), transformed_left_it->getY());
225 glVertex2d(transformed_right_it->getX(), transformed_right_it->getY());
227 ++transformed_right_it;
234 glVertex2d(transformed_top_it->getX(), transformed_top_it->getY());
235 glVertex2d(transformed_bottom_it->getX(), transformed_bottom_it->getY());
237 ++transformed_bottom_it;
273 for (
int r = 0; r <=
rows_; r++)
302 std::list<tf::Point>::iterator points_it = src.begin();
303 std::list<tf::Point>::iterator transformed_it = dst.begin();
304 for (; points_it != src.end() && transformed_it != dst.end(); ++points_it)
306 (*transformed_it) =
transform_ * (*points_it);
317 node[
"color"] >> color;
318 ui_.color->setColor(QColor(color.c_str()));
324 node[
"frame"] >> frame;
325 ui_.frame->setText(QString::fromStdString(frame));
345 ui_.alpha->setValue(alpha_);
350 node[
"size"] >>
size_;
351 ui_.size->setValue(size_);
356 node[
"rows"] >>
rows_;
357 ui_.rows->setValue(rows_);
363 ui_.columns->setValue(columns_);
371 emitter << YAML::Key <<
"color" << YAML::Value <<
ui_.color->color().name().toStdString();
373 emitter << YAML::Key <<
"alpha" << YAML::Value <<
alpha_;
375 std::string frame =
ui_.frame->text().toStdString();
376 emitter << YAML::Key <<
"frame" << YAML::Value << frame;
378 emitter << YAML::Key <<
"x" << YAML::Value <<
top_left_.
getX();
379 emitter << YAML::Key <<
"y" << YAML::Value <<
top_left_.
getY();
380 emitter << YAML::Key <<
"size" << YAML::Value <<
size_;
381 emitter << YAML::Key <<
"rows" << YAML::Value <<
rows_;
382 emitter << YAML::Key <<
"columns" << YAML::Value <<
columns_;
void LoadConfig(const YAML::Node &node, const std::string &path)
bool Initialize(QGLWidget *canvas)
bool GetTransform(const ros::Time &stamp, swri_transform_util::Transform &transform, bool use_latest_transforms=true)
swri_transform_util::Transform transform_
std::list< tf::Point > transformed_left_points_
void Draw(double x, double y, double scale)
TFSIMD_FORCE_INLINE void setX(tfScalar x)
TFSIMD_FORCE_INLINE void setY(tfScalar y)
static void PrintWarningHelper(QLabel *status_label, const std::string &message, double throttle=0.0)
static void PrintErrorHelper(QLabel *status_label, const std::string &message, double throttle=0.0)
TFSIMD_FORCE_INLINE const tfScalar & getY() const
TFSIMD_FORCE_INLINE const tfScalar & y() const
static void PrintInfoHelper(QLabel *status_label, const std::string &message, double throttle=0.0)
void PrintError(const std::string &message)
void PrintWarning(const std::string &message)
std::string source_frame_
std::list< tf::Point > right_points_
std::list< tf::Point > transformed_top_points_
TFSIMD_FORCE_INLINE const tfScalar & x() const
std::list< tf::Point > top_points_
void PrintInfo(const std::string &message)
std::list< tf::Point > transformed_bottom_points_
void SetAlpha(double alpha)
std::list< tf::Point > bottom_points_
QWidget * GetConfigWidget(QWidget *parent)
TFSIMD_FORCE_INLINE const tfScalar & getX() const
std::list< tf::Point > transformed_right_points_
boost::shared_ptr< tf::TransformListener > tf_
std::list< tf::Point > left_points_
void SaveConfig(YAML::Emitter &emitter, const std::string &path)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
void SetColumns(int columns)
void SetSize(double size)