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 const Ogre::TexturePtr& tex,
273 Ogre::PixelBox& dst_box,
274 const 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