Skip to content

Commit

Permalink
Merge pull request #1049 from mdkus/master
Browse files Browse the repository at this point in the history
fix: misaligned context items in ImageViewer
  • Loading branch information
taketwo committed Dec 22, 2014
2 parents e128e20 + 750caea commit f8854d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions visualization/include/pcl/visualization/impl/image_viewer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pcl::visualization::ImageViewer::addMask (
search.projectPoint (mask[i], p_projected);

xy.push_back (p_projected.x);
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION <= 10))
#if ((VTK_MAJOR_VERSION >= 6) || ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7)))
xy.push_back (image_height_f - p_projected.y);
#else
xy.push_back (p_projected.y);
Expand Down Expand Up @@ -182,7 +182,7 @@ pcl::visualization::ImageViewer::addPlanarPolygon (
pcl::PointXY p;
search.projectPoint (polygon.getContour ()[i], p);
xy.push_back (p.x);
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION <= 10))
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION <= 7))
xy.push_back (image_height_f - p.y);
#else
xy.push_back (p.y);
Expand Down Expand Up @@ -270,7 +270,7 @@ pcl::visualization::ImageViewer::addRectangle (
if (pp_2d[i].x > max_pt_2d.x) max_pt_2d.x = pp_2d[i].x;
if (pp_2d[i].y > max_pt_2d.y) max_pt_2d.y = pp_2d[i].y;
}
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION <= 7))
#if ((VTK_MAJOR_VERSION >= 6) || ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7)))
min_pt_2d.y = float (image->height) - min_pt_2d.y;
max_pt_2d.y = float (image->height) - max_pt_2d.y;
#endif
Expand Down Expand Up @@ -335,7 +335,7 @@ pcl::visualization::ImageViewer::addRectangle (
if (pp_2d[i].x > max_pt_2d.x) max_pt_2d.x = pp_2d[i].x;
if (pp_2d[i].y > max_pt_2d.y) max_pt_2d.y = pp_2d[i].y;
}
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION <= 7))
#if ((VTK_MAJOR_VERSION >= 6) ||((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7)))
min_pt_2d.y = float (image->height) - min_pt_2d.y;
max_pt_2d.y = float (image->height) - max_pt_2d.y;
#endif
Expand Down
16 changes: 8 additions & 8 deletions visualization/src/image_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ pcl::visualization::ImageViewer::addCircle (
static_cast<unsigned char> (255.0 * g),
static_cast<unsigned char> (255.0 * b));
circle->setOpacity (opacity);
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 10))
#if ((VTK_MAJOR_VERSION >= 6) || ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7)))
circle->set (static_cast<float> (x), static_cast<float> (y), static_cast<float> (radius));
#else
circle->set (static_cast<float> (x), static_cast<float> (getSize ()[1] - y), static_cast<float> (radius));
Expand Down Expand Up @@ -745,7 +745,7 @@ pcl::visualization::ImageViewer::addFilledRectangle (
static_cast<unsigned char> (255.0 * g),
static_cast<unsigned char> (255.0 * b));
rect->setOpacity (opacity);
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 10))
#if ((VTK_MAJOR_VERSION >= 6) || (VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7))
rect->set (static_cast<float> (x_min), static_cast<float> (y_min),
static_cast<float> (x_max - x_min), static_cast<float> (y_max - y_min));
#else
Expand Down Expand Up @@ -788,7 +788,7 @@ pcl::visualization::ImageViewer::addRectangle (
static_cast<unsigned char> (255.0 * g),
static_cast<unsigned char> (255.0 * b));
rect->setOpacity (opacity);
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7))
#if ((VTK_MAJOR_VERSION >= 6) || ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7)))
rect->set (static_cast<float> (x_min), static_cast<float> (y_min),
static_cast<float> (x_max), static_cast<float> (y_max));
#else
Expand Down Expand Up @@ -831,7 +831,7 @@ pcl::visualization::ImageViewer::addRectangle (
static_cast<unsigned char> (255.0 * g),
static_cast<unsigned char> (255.0 * b));
rect->setOpacity (opacity);
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7))
#if ((VTK_MAJOR_VERSION >= 6) ||((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7)))
rect->set (min_pt.x, min_pt.y, max_pt.x, max_pt.y);
#else
rect->set (min_pt.x, static_cast<float> (getSize ()[1]) - min_pt.y, max_pt.x, max_pt.y);
Expand Down Expand Up @@ -873,7 +873,7 @@ pcl::visualization::ImageViewer::addLine (unsigned int x_min, unsigned int y_min
static_cast<unsigned char> (255.0 * g),
static_cast<unsigned char> (255.0 * b));
line->setOpacity (opacity);
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 10))
#if ((VTK_MAJOR_VERSION >= 6) || ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7)))
line->set (static_cast<float> (x_min), static_cast<float> (y_min),
static_cast<float> (x_max), static_cast<float> (y_max));
#else
Expand Down Expand Up @@ -917,7 +917,7 @@ pcl::visualization::ImageViewer::addText (unsigned int x, unsigned int y,
static_cast<unsigned char> (255.0 * g),
static_cast<unsigned char> (255.0 * b));
text->setOpacity (opacity);
#if ((VTK_MAJOR_VERSION == 5) && (VTKOR_VERSION > 10))
#if ((VTK_MAJOR_VERSION >= 6) || ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7)))
text->set (static_cast<float> (x), static_cast<float> (y), text_string);
#else
text->set (static_cast<float> (x), static_cast<float> (getSize ()[1] - y), text_string);
Expand Down Expand Up @@ -960,7 +960,7 @@ pcl::visualization::ImageViewer::markPoint (
disk->setColors (bg_color[0], bg_color[1], bg_color[2]);
disk->setOpacity (opacity);

#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 10))
#if ((VTK_MAJOR_VERSION >= 6) || ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7)))
point->set (static_cast<float> (u), static_cast<float> (v));
disk->set (static_cast<float> (u), static_cast<float> (v), static_cast<float> (radius));
#else
Expand Down Expand Up @@ -1009,7 +1009,7 @@ pcl::visualization::ImageViewer::markPoints (

vtkSmartPointer<context_items::Markers> markers = vtkSmartPointer<context_items::Markers>::New ();
markers->setOpacity (opacity);
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 10))
#if ((VTK_MAJOR_VERSION >= 6) || ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7)))
markers->set (uv);
#else
// translate v which is on odd indices
Expand Down

0 comments on commit f8854d5

Please sign in to comment.