40 #include <opencv2/core/core.hpp>
50 position_tolerance_(0.0),
52 covariance_checked_(false),
53 show_all_covariances_checked_(false),
56 buffer_holder_(false),
58 static_arrow_sizes_(false),
59 use_latest_transforms_(false),
63 QObject::connect(
this,
67 QObject::connect(
this,
75 ROS_INFO(
"PointDrawingPlugin::ClearHistory()");
84 icon.fill(Qt::transparent);
86 QPainter painter(&icon);
87 painter.setRenderHint(QPainter::Antialiasing,
true);
94 pen.setCapStyle(Qt::RoundCap);
96 painter.drawPoint(8, 8);
101 pen.setCapStyle(Qt::FlatCap);
103 painter.drawLine(1, 14, 14, 1);
108 pen.setCapStyle(Qt::SquareCap);
110 painter.drawLine(2, 13, 13, 2);
111 painter.drawLine(13, 2, 13, 8);
112 painter.drawLine(13, 2, 7, 2);
127 if (style ==
"lines")
131 else if (style ==
"points")
135 else if (style ==
"arrows")
183 for (
auto& lap:
laps_)
185 for (
auto& point: lap)
187 point.transformed =
false;
192 point.transformed =
false;
206 points_.push_back(stamped_point);
265 bool transformed =
true;
308 if (((std::fabs(
check.x()) <= 3) && (std::fabs(
check.y()) <= 3)) &&
321 if (((std::fabs(
check.x()) > 25) && (std::fabs(
check.y()) > 25)) &&
335 glBegin(GL_LINE_STRIP);
345 success &= pt.transformed;
348 glVertex2d(pt.transformed_point.getX(), pt.transformed_point.getY());
456 double arrow_width = size / 5.0;
457 double head_length = size * 0.75;
461 if(std::fabs(q.x()*q.x() + q.y()*q.y() + q.z()*q.z() + q.w()*q.w() - 1) > 0.01)
479 for (uint32_t i = 0; i < point.
cov_points.size(); i++)
504 for (
auto &lap :
laps_)
516 pt.transformed =
false;
519 for (
auto &lap :
laps_)
523 pt.transformed =
false;
532 bool transformed =
false;
540 if (
laps_.size() > 0)
542 for (
auto &lap :
laps_)
560 bool transformed =
points_.size() != 0;
563 QColor base_color =
color_;
565 for (
size_t i = 0; i <
laps_.size(); i++)
571 glBegin(GL_LINE_STRIP);
579 for (
const auto& pt :
laps_[i])
583 glVertex2d(pt.transformed_point.getX(),
584 pt.transformed_point.getY());
593 glBegin(GL_LINE_STRIP);
601 glColor4d(base_color.redF(), base_color.greenF(), base_color.blueF(), 0.5);
607 transformed &= pt.transformed;
610 glVertex2d(pt.transformed_point.getX(),
611 pt.transformed_point.getY());
622 int hue =
static_cast<int>(
color_.hue() + (i + 1.0) * 10.0 * M_PI);
627 int sat =
color_.saturation();
629 base_color.setHsv(hue, sat, v);
630 glColor4d(base_color.redF(), base_color.greenF(), base_color.blueF(),
644 if (!pt.transformed || pt.transformed_cov_points.empty())
648 glBegin(GL_LINE_STRIP);
650 for (uint32_t i = 0; i < pt.transformed_cov_points.size(); i++)
652 glVertex2d(pt.transformed_cov_points[i].getX(),
653 pt.transformed_cov_points[i].getY());
656 glVertex2d(pt.transformed_cov_points.front().getX(),
657 pt.transformed_cov_points.front().getY());
664 glBegin(GL_LINE_STRIP);
681 bool success =
laps_.size() != 0 &&
points_.size() != 0;
684 QColor base_color =
color_;
685 if (
laps_.size() != 0)
687 for (
size_t i = 0; i <
laps_.size(); i++)
690 for (
const auto &pt :
laps_[i])
692 glBegin(GL_LINE_STRIP);
699 int hue =
static_cast<int>(
color_.hue() +
laps_.size() * 10.0 * M_PI);
700 int sat =
color_.saturation();
702 base_color.setHsv(hue, sat, v);
703 glColor4d(base_color.redF(), base_color.greenF(), base_color.blueF(),
711 glBegin(GL_LINE_STRIP);