/////////////////////////////////////////////////////////////////////////////////////
| 616 | |
| 617 | ////////////////////////////////////////////////////////////////////////////////////////// |
| 618 | bool |
| 619 | pcl::visualization::ImageViewer::addFilledRectangle ( |
| 620 | unsigned int x_min, unsigned int x_max, unsigned int y_min, unsigned int y_max, |
| 621 | double r, double g, double b, const std::string &layer_id, double opacity) |
| 622 | { |
| 623 | // Check to see if this ID entry already exists (has it been already added to the visualizer?) |
| 624 | auto am_it = std::find_if (layer_map_.begin (), layer_map_.end (), LayerComparator (layer_id)); |
| 625 | if (am_it == layer_map_.end ()) |
| 626 | { |
| 627 | PCL_DEBUG ("[pcl::visualization::ImageViewer::addFilledRectangle] No layer with ID='%s' found. Creating new one...\n", layer_id.c_str ()); |
| 628 | am_it = createLayer (layer_id, getSize ()[0] - 1, getSize ()[1] - 1, opacity, false); |
| 629 | } |
| 630 | |
| 631 | vtkSmartPointer<context_items::FilledRectangle> rect = vtkSmartPointer<context_items::FilledRectangle>::New (); |
| 632 | rect->setColors (static_cast<unsigned char> (255.0 * r), |
| 633 | static_cast<unsigned char> (255.0 * g), |
| 634 | static_cast<unsigned char> (255.0 * b)); |
| 635 | rect->setOpacity (opacity); |
| 636 | rect->set (static_cast<float> (x_min), static_cast<float> (y_min), |
| 637 | static_cast<float> (x_max - x_min), static_cast<float> (y_max - y_min)); |
| 638 | am_it->actor->GetScene ()->AddItem (rect); |
| 639 | |
| 640 | return (true); |
| 641 | } |
| 642 | |
| 643 | ////////////////////////////////////////////////////////////////////////////////////////// |
| 644 | bool |