37 #include <OgreSceneNode.h> 38 #include <OgreSceneManager.h> 39 #include <OgreManualObject.h> 40 #include <OgreWireBoundingBox.h> 41 #include <OgreEntity.h> 42 #include <OgreSubEntity.h> 49 : context_(context), listener_(new
Listener(this))
59 for (; it != end; ++it)
61 Ogre::MovableObject* m = *it;
62 m->setListener(
nullptr);
74 M_HandleToBox::iterator it =
boxes_.begin();
75 M_HandleToBox::iterator end =
boxes_.end();
76 for (; it != end; ++it)
78 Ogre::WireBoundingBox* box = it->second.second;
79 box->setVisible(
false);
85 M_HandleToBox::iterator it =
boxes_.begin();
86 M_HandleToBox::iterator end =
boxes_.end();
87 for (; it != end; ++it)
89 Ogre::WireBoundingBox* box = it->second.second;
90 box->setVisible(
true);
102 Ogre::SceneNode::ObjectIterator obj_it = node->getAttachedObjectIterator();
103 while (obj_it.hasMoreElements())
105 Ogre::MovableObject* obj = obj_it.getNext();
109 Ogre::SceneNode::ChildNodeIterator child_it = node->getChildIterator();
110 while (child_it.hasMoreElements())
112 Ogre::SceneNode* child =
dynamic_cast<Ogre::SceneNode*
>(child_it.getNext());
128 object->setListener(
nullptr);
135 M_HandleToBox::iterator it =
boxes_.begin();
136 M_HandleToBox::iterator end =
boxes_.end();
137 for (; it != end; ++it)
140 Picked p(it->first.first);
146 Ogre::AxisAlignedBox combined;
147 V_AABB::iterator aabb_it = aabbs.begin();
148 V_AABB::iterator aabb_end = aabbs.end();
149 for (; aabb_it != aabb_end; ++aabb_it)
151 combined.merge(*aabb_it);
154 createBox(std::make_pair(p.
handle, it->first.second), combined,
"RVIZ/Cyan");
163 for (; it != end; ++it)
165 aabbs.push_back((*it)->getWorldBoundingBox());
179 const Ogre::AxisAlignedBox& aabb,
180 const std::string& material_name)
182 Ogre::WireBoundingBox* box =
nullptr;
183 Ogre::SceneNode* node =
nullptr;
185 M_HandleToBox::iterator it =
boxes_.find(handles);
189 node = scene_manager->getRootSceneNode()->createChildSceneNode();
190 box =
new Ogre::WireBoundingBox;
192 bool inserted =
boxes_.insert(std::make_pair(handles, std::make_pair(node, box))).second;
198 node = it->second.first;
199 box = it->second.second;
202 box->setMaterial(material_name);
204 box->setupBoundingBox(aabb);
205 node->detachAllObjects();
206 node->attachObject(box);
211 M_HandleToBox::iterator it =
boxes_.find(handles);
214 Ogre::SceneNode* node = it->second.first;
215 Ogre::WireBoundingBox* box = it->second.second;
217 node->detachAllObjects();
218 node->getParentSceneNode()->removeAndDestroyChild(node->getName());
235 Ogre::AxisAlignedBox combined;
236 V_AABB::iterator it = aabbs.begin();
237 V_AABB::iterator end = aabbs.end();
238 for (; it != end; ++it)
void removeTrackedObject(Ogre::MovableObject *object)
CollObjectHandle createHandle()
void destroyBox(const std::pair< CollObjectHandle, uint64_t > &handles)
Destroy the box associated with the given handle-int pair, if there is one.
virtual void updateTrackedBoxes()
void createBox(const std::pair< CollObjectHandle, uint64_t > &handles, const Ogre::AxisAlignedBox &aabb, const std::string &material_name)
Create or update a box for the given handle-int pair, with the box specified by aabb.
A single element of a property tree, with a name, value, description, and possibly children...
S_Movable tracked_objects_
void removeObject(CollObjectHandle obj)
virtual InteractiveObjectWPtr getInteractiveObject()
Get the object to listen to mouse events and other interaction calls during use of the 'interact' too...
virtual void preRenderPass(uint32_t pass)
void addObject(CollObjectHandle obj, SelectionHandler *handler)
static void setPickHandle(CollObjectHandle handle, Ogre::SceneNode *node)
Pure-virtual base class for objects which give Display subclasses context in which to work...
std::vector< Ogre::AxisAlignedBox > V_AABB
DisplayContext * context_
void addTrackedObject(Ogre::MovableObject *object)
virtual void getAABBs(const Picked &obj, V_AABB &aabbs)
virtual SelectionManager * getSelectionManager() const =0
Return a pointer to the SelectionManager.
SelectionHandler(DisplayContext *context)
virtual void setInteractiveObject(InteractiveObjectWPtr object)
Set an object to listen to mouse events and other interaction calls during use of the 'interact' tool...
InteractiveObjectWPtr interactive_object_
virtual ~SelectionHandler()
void addTrackedObjects(Ogre::SceneNode *node)
virtual void onSelect(const Picked &obj)
boost::weak_ptr< InteractiveObject > InteractiveObjectWPtr
virtual Ogre::SceneManager * getSceneManager() const =0
Returns the Ogre::SceneManager used for the main RenderPanel.
virtual void destroyProperties(const Picked &obj, Property *parent_property)
Destroy all properties for the given picked object(s).
CollObjectHandle pick_handle_
virtual void postRenderPass(uint32_t pass)
QList< Property * > properties_
virtual void onDeselect(const Picked &obj)