37 #include <OgreSceneNode.h> 38 #include <OgreSceneManager.h> 39 #include <OgreManualObject.h> 40 #include <OgreWireBoundingBox.h> 41 #include <OgreEntity.h> 42 #include <OgreSubEntity.h> 61 for (; it != end; ++it)
63 Ogre::MovableObject* m = *it;
76 M_HandleToBox::iterator it =
boxes_.begin();
77 M_HandleToBox::iterator end =
boxes_.end();
78 for (; it != end; ++it)
80 Ogre::WireBoundingBox* box = it->second.second;
81 box->setVisible(
false);
87 M_HandleToBox::iterator it =
boxes_.begin();
88 M_HandleToBox::iterator end =
boxes_.end();
89 for (; it != end; ++it)
91 Ogre::WireBoundingBox* box = it->second.second;
92 box->setVisible(
true);
104 Ogre::SceneNode::ObjectIterator obj_it = node->getAttachedObjectIterator();
105 while( obj_it.hasMoreElements() )
107 Ogre::MovableObject* obj = obj_it.getNext();
111 Ogre::SceneNode::ChildNodeIterator child_it = node->getChildIterator();
112 while( child_it.hasMoreElements() )
114 Ogre::SceneNode* child =
dynamic_cast<Ogre::SceneNode*
>( child_it.getNext() );
130 object->setListener(0);
137 M_HandleToBox::iterator it =
boxes_.begin();
138 M_HandleToBox::iterator end =
boxes_.end();
139 for (; it != end; ++it)
142 Picked p(it->first.first);
148 Ogre::AxisAlignedBox combined;
149 V_AABB::iterator aabb_it = aabbs.begin();
150 V_AABB::iterator aabb_end = aabbs.end();
151 for (; aabb_it != aabb_end; ++aabb_it)
153 combined.merge(*aabb_it);
156 createBox(std::make_pair(p.
handle, it->first.second), combined,
"RVIZ/Cyan");
165 for (; it != end; ++it)
167 aabbs.push_back((*it)->getWorldBoundingBox());
180 void SelectionHandler::createBox(
const std::pair<CollObjectHandle, uint64_t>& handles,
const Ogre::AxisAlignedBox& aabb,
const std::string& material_name)
182 Ogre::WireBoundingBox* box = 0;
183 Ogre::SceneNode* node = 0;
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;
197 node = it->second.first;
198 box = it->second.second;
201 box->setMaterial(material_name);
203 box->setupBoundingBox(aabb);
204 node->detachAllObjects();
205 node->attachObject(box);
210 M_HandleToBox::iterator it =
boxes_.find(handles);
213 Ogre::SceneNode* node = it->second.first;
214 Ogre::WireBoundingBox* box = it->second.second;
216 node->detachAllObjects();
217 node->getParentSceneNode()->removeAndDestroyChild(node->getName());
234 Ogre::AxisAlignedBox combined;
235 V_AABB::iterator it = aabbs.begin();
236 V_AABB::iterator end = aabbs.end();
237 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)