37 #include <OgreSceneNode.h>
38 #include <OgreSceneManager.h>
39 #include <OgreManualObject.h>
40 #include <OgreWireBoundingBox.h>
41 #include <OgreEntity.h>
42 #include <OgreSubEntity.h>
52 : context_(context), listener_(new
Listener(this))
62 for (; it != end; ++it)
64 Ogre::MovableObject* m = *it;
65 m->setListener(
nullptr);
77 M_HandleToBox::iterator it =
boxes_.begin();
78 M_HandleToBox::iterator end =
boxes_.end();
79 for (; it != end; ++it)
81 Ogre::WireBoundingBox* box = it->second.second;
82 box->setVisible(
false);
88 M_HandleToBox::iterator it =
boxes_.begin();
89 M_HandleToBox::iterator end =
boxes_.end();
90 for (; it != end; ++it)
92 Ogre::WireBoundingBox* box = it->second.second;
93 box->setVisible(
true);
105 Ogre::SceneNode::ObjectIterator obj_it = node->getAttachedObjectIterator();
106 while (obj_it.hasMoreElements())
108 Ogre::MovableObject* obj = obj_it.getNext();
112 Ogre::SceneNode::ChildNodeIterator child_it = node->getChildIterator();
113 while (child_it.hasMoreElements())
115 Ogre::SceneNode* child =
dynamic_cast<Ogre::SceneNode*
>(child_it.getNext());
131 object->setListener(
nullptr);
138 M_HandleToBox::iterator it =
boxes_.begin();
139 M_HandleToBox::iterator end =
boxes_.end();
140 for (; it != end; ++it)
143 Picked p(it->first.first);
149 Ogre::AxisAlignedBox combined;
150 V_AABB::iterator aabb_it = aabbs.begin();
151 V_AABB::iterator aabb_end = aabbs.end();
152 for (; aabb_it != aabb_end; ++aabb_it)
154 combined.merge(*aabb_it);
157 createBox(std::make_pair(p.
handle, it->first.second), combined,
"RVIZ/Cyan");
166 for (; it != end; ++it)
168 aabbs.push_back((*it)->getWorldBoundingBox());
182 const Ogre::AxisAlignedBox& aabb,
183 const std::string& material_name)
185 Ogre::WireBoundingBox* box =
nullptr;
186 Ogre::SceneNode* node =
nullptr;
188 M_HandleToBox::iterator it =
boxes_.find(handles);
192 node = scene_manager->getRootSceneNode()->createChildSceneNode();
193 box =
new Ogre::WireBoundingBox;
195 bool inserted =
boxes_.insert(std::make_pair(handles, std::make_pair(node, box))).second;
201 node = it->second.first;
202 box = it->second.second;
207 box->setupBoundingBox(aabb);
208 node->detachAllObjects();
209 node->attachObject(box);
214 M_HandleToBox::iterator it =
boxes_.find(handles);
217 Ogre::SceneNode* node = it->second.first;
218 Ogre::WireBoundingBox* box = it->second.second;
220 node->detachAllObjects();
237 Ogre::AxisAlignedBox combined;
238 V_AABB::iterator it = aabbs.begin();
239 V_AABB::iterator end = aabbs.end();
240 for (; it != end; ++it)