Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "marker_selection_handler.h"
00031 #include "marker_base.h"
00032 #include "rviz/default_plugin/marker_display.h"
00033 #include "rviz/properties/property_manager.h"
00034 #include "rviz/properties/property.h"
00035 #include "rviz/default_plugin/interactive_markers/interactive_marker_control.h"
00036
00037
00038 #include <OGRE/OgreVector3.h>
00039 #include <OGRE/OgreQuaternion.h>
00040
00041 #include <boost/bind.hpp>
00042
00043 namespace rviz
00044 {
00045
00046 MarkerSelectionHandler::MarkerSelectionHandler(const MarkerBase* marker, MarkerID id)
00047 : marker_(marker)
00048 , id_(id)
00049 {
00050 }
00051
00052 MarkerSelectionHandler::~MarkerSelectionHandler()
00053 {
00054 }
00055
00056 Ogre::Vector3 MarkerSelectionHandler::getPosition()
00057 {
00058 return Ogre::Vector3(marker_->getMessage()->pose.position.x, marker_->getMessage()->pose.position.y, marker_->getMessage()->pose.position.z);
00059 }
00060
00061 Ogre::Quaternion MarkerSelectionHandler::getOrientation()
00062 {
00063 return Ogre::Quaternion(marker_->getMessage()->pose.orientation.w, marker_->getMessage()->pose.orientation.x, marker_->getMessage()->pose.orientation.y, marker_->getMessage()->pose.orientation.z);
00064 }
00065
00066 void MarkerSelectionHandler::createProperties(const Picked& obj, PropertyManager* property_manager)
00067 {
00068 std::stringstream prefix;
00069 prefix << "Marker " << id_.first << "/" << id_.second;
00070 CategoryPropertyWPtr cat = property_manager->createCategory(prefix.str(), prefix.str());
00071 properties_.push_back(property_manager->createProperty<StringProperty>("ID", prefix.str(), boost::bind(&MarkerSelectionHandler::getId, this), StringProperty::Setter(), cat));
00072 properties_.push_back(property_manager->createProperty<Vector3Property>("Position", prefix.str(), boost::bind(&MarkerSelectionHandler::getPosition, this), Vector3Property::Setter(), cat));
00073 properties_.push_back(property_manager->createProperty<QuaternionProperty>("Orientation", prefix.str(), boost::bind(&MarkerSelectionHandler::getOrientation, this), QuaternionProperty::Setter(), cat));
00074 properties_.push_back(cat);
00075 }
00076
00077 }