30 #ifndef RVIZ_SELECTION_MANAGER_H 31 #define RVIZ_SELECTION_MANAGER_H 39 #include "rviz/rviz_export.h" 42 #include <boost/shared_ptr.hpp> 43 #include <boost/unordered_map.hpp> 44 #include <boost/thread/recursive_mutex.hpp> 46 #include <OgreTexture.h> 47 #include <OgreMaterial.h> 48 #include <OgreMaterialManager.h> 49 #include <OgreMovableObject.h> 50 #include <OgreRenderQueueListener.h> 51 #include <OgreSharedPtr.h> 66 class WireBoundingBox;
77 class PropertyTreeModel;
78 class ViewportMouseEvent;
79 class VisualizationManager;
82 public Ogre::MaterialManager::Listener,
83 public Ogre::RenderQueueListener
100 void setDebugMode(
bool debug);
102 void clearHandlers();
107 void highlight(Ogre::Viewport* viewport,
int x1,
int y1,
int x2,
int y2);
108 void removeHighlight();
111 void select(Ogre::Viewport* viewport,
int x1,
int y1,
int x2,
int y2,
SelectType type);
115 void pick(Ogre::Viewport* viewport,
121 bool single_render_pass =
false);
126 void setSelection(
const M_Picked& objs);
127 void addSelection(
const M_Picked& objs);
128 void removeSelection(
const M_Picked& objs);
138 static void setPickColor(
const Ogre::ColourValue& color, Ogre::SceneNode* node)
142 static void setPickColor(
const Ogre::ColourValue& color, Ogre::MovableObject*
object)
148 setPickData(handle, handleToColor(handle), node);
152 setPickData(handle, handleToColor(handle),
object);
154 static void setPickData(
CollObjectHandle handle,
const Ogre::ColourValue& color, Ogre::SceneNode* node);
156 setPickData(
CollObjectHandle handle,
const Ogre::ColourValue& color, Ogre::MovableObject*
object);
159 Ogre::Technique* handleSchemeNotFound(
unsigned short scheme_index,
160 const Ogre::String& scheme_name,
161 Ogre::Material* original_material,
162 unsigned short lod_index,
163 const Ogre::Renderable* rend)
override;
169 void enableInteraction(
bool enable);
172 return interaction_enabled_;
176 void focusOnSelection();
179 void setTextureSize(
unsigned size);
184 bool get3DPoint(Ogre::Viewport* viewport,
const int x,
const int y, Ogre::Vector3& result_point);
202 bool get3DPatch(Ogre::Viewport* viewport,
205 const unsigned width,
206 const unsigned height,
207 const bool skip_missing,
208 std::vector<Ogre::Vector3>& result_points);
226 bool getPatchDepthImage(Ogre::Viewport* viewport,
229 const unsigned width,
230 const unsigned height,
231 std::vector<float>& depth_vector);
234 void renderQueueStarted(uint8_t queueGroupId,
235 const std::string& invocation,
236 bool& skipThisInvocation)
override;
240 return property_model_;
246 void updateProperties();
249 void selectionAdded(
const M_Picked& added);
250 void selectionRemoved(
const M_Picked& removed);
252 std::pair<Picked, bool> addSelectedObject(
const Picked& obj);
253 void removeSelectedObject(
const Picked& obj);
255 void setHighlightRect(Ogre::Viewport* viewport,
int x1,
int y1,
int x2,
int y2);
258 void renderAndUnpack(Ogre::Viewport* viewport,
267 bool render(Ogre::Viewport* viewport,
268 Ogre::TexturePtr tex,
273 Ogre::PixelBox& dst_box,
274 std::string material_scheme,
275 unsigned texture_width,
276 unsigned textured_height);
278 void unpackColors(Ogre::PixelBox& box,
V_CollObject& pixels);
280 void setDepthTextureSize(
unsigned width,
unsigned height);
282 void publishDebugImage(
const Ogre::PixelBox& pixel_box,
const std::string& label);
305 const static uint32_t s_num_render_textures_ = 2;
308 Ogre::TexturePtr render_textures_[s_num_render_textures_];
309 Ogre::PixelBox pixel_boxes_[s_num_render_textures_];
346 #endif // RVIZ_SELECTION_MANAGER_H
ROSCONSOLE_DECL void initialize()
boost::unordered_map< CollObjectHandle, Picked > M_Picked
Ogre::Technique * fallback_black_cull_technique_
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
Ogre::Technique * fallback_pick_cull_technique_
static void setPickHandle(CollObjectHandle handle, Ogre::SceneNode *node)
uint32_t depth_texture_width_
PropertyTreeModel * property_model_
Ogre::Technique * fallback_pick_technique_
std::map< std::string, ros::Publisher > PublisherMap
const M_Picked & getSelection()
V_CollObject pixel_buffer_
Ogre::Technique * fallback_depth_cull_technique_
The VisualizationManager class is the central manager class of rviz, holding all the Displays...
static void setPickColor(const Ogre::ColourValue &color, Ogre::MovableObject *object)
std::vector< CollObjectHandle > V_CollObject
PublisherMap debug_publishers_
boost::unordered_map< CollObjectHandle, SelectionHandler * > M_CollisionObjectToSelectionHandler
Ogre::TexturePtr depth_render_texture_
static void setPickHandle(CollObjectHandle handle, Ogre::MovableObject *object)
Ogre::Technique * fallback_depth_technique_
uint32_t colorToHandle(Ogre::PixelFormat fmt, uint32_t col)
Ogre::SceneNode * highlight_node_
Ogre::Viewport * viewport
VisualizationManager * vis_manager_
static void setPickColor(const Ogre::ColourValue &color, Ogre::SceneNode *node)
Ogre::Rectangle2D * highlight_rectangle_
bool getInteractionEnabled()
Ogre::MaterialPtr fallback_pick_material_
Ogre::Technique * fallback_black_technique_
PropertyTreeModel * getPropertyModel()
Ogre::PixelBox depth_pixel_box_
boost::recursive_mutex global_mutex_
bool interaction_enabled_
M_CollisionObjectToSelectionHandler objects_
uint32_t CollObjectHandle