#include <annotation_collection.hpp>
Public Member Functions | |
bool | add (const world_canvas_msgs::Annotation &annotation, const world_canvas_msgs::AnnotationData &annot_data) |
AnnotationCollection (const std::string &world, const std::string &srv_namespace="") | |
AnnotationCollection (const FilterCriteria &criteria, const std::string &srv_namespace="") | |
bool | clearMarkers (const std::string &topic) |
bool | filterBy (const FilterCriteria &criteria) |
const world_canvas_msgs::Annotation & | getAnnotation (const UniqueIDmsg &id) |
std::vector< UniqueIDmsg > | getAnnotationIDs () |
std::vector < world_canvas_msgs::Annotation > | getAnnotations (const std::string &name) |
const std::vector < world_canvas_msgs::Annotation > & | getAnnotations () |
const world_canvas_msgs::AnnotationData & | getData (const world_canvas_msgs::Annotation &ann) |
template<typename T > | |
unsigned int | getData (std::vector< T > &data) |
bool | hasAnnotation (const UniqueIDmsg &id) |
bool | isSaved () |
bool | load () |
bool | loadData () |
visualization_msgs::Marker | makeLabel (const visualization_msgs::Marker &marker) |
visualization_msgs::Marker | makeMarker (int id, const world_canvas_msgs::Annotation &ann) |
bool | publish (const std::string &topic_name, const std::string &topic_type="", bool by_server=false, bool as_list=false) |
bool | publishMarker (const std::string &topic, int marker_id, const world_canvas_msgs::Annotation &ann, bool clear_existing=true) |
bool | publishMarkers (const std::string &topic, bool clear_existing=true) |
bool | remove (const uuid_msgs::UniqueID &id) |
bool | save () |
bool | update (const world_canvas_msgs::Annotation &annotation, const world_canvas_msgs::AnnotationData &annot_data) |
virtual | ~AnnotationCollection () |
Protected Member Functions | |
bool | endsWith (const std::string &a, const std::string &b) |
std::vector< UniqueIDmsg > | getAnnotsDataIDs () |
bool | saveDeletes () |
Protected Attributes | |
std::vector < world_canvas_msgs::Annotation > | annotations |
std::vector < world_canvas_msgs::AnnotationData > | annots_data |
std::vector < world_canvas_msgs::Annotation > | annots_to_delete |
FilterCriteria | filter |
ros::Publisher | marker_pub |
ros::Publisher | markers_pub |
ros::NodeHandle | nh |
bool | saved |
Manages a collection of annotations and its associated data, initially empty. Annotations and data are retrieved from the world canvas server, filtered by the described parameters. This class can also publish the retrieved annotations and RViz visualization markers, mostly for debug purposes.
Definition at line 34 of file annotation_collection.hpp.
wcf::AnnotationCollection::AnnotationCollection | ( | const std::string & | world, |
const std::string & | srv_namespace = "" |
||
) |
Initializes the collection of annotations and associated data, initially empty.
world,: | Annotations in this collection belong to this world. |
srv_namespace,: | World canvas handles can be found under this namespace. |
Definition at line 22 of file annotation_collection.cpp.
wcf::AnnotationCollection::AnnotationCollection | ( | const FilterCriteria & | criteria, |
const std::string & | srv_namespace = "" |
||
) |
Initializes the collection of annotations and associated data, initially empty.
criteria,: | Annotations filter criteria to pass to the server (must contain at least a valid world name). |
srv_namespace,: | World canvas handles can be found under this namespace. |
Definition at line 28 of file annotation_collection.cpp.
wcf::AnnotationCollection::~AnnotationCollection | ( | ) | [virtual] |
Definition at line 36 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::add | ( | const world_canvas_msgs::Annotation & | annotation, |
const world_canvas_msgs::AnnotationData & | annot_data | ||
) |
Add an annotation with its data to the collection.
annotation | annotation to add. |
annot_data | annotation's data to add. |
Definition at line 258 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::clearMarkers | ( | const std::string & | topic | ) |
Clears RViz visualization markers published on the given topic.
topic,: | The topic on which to clear annotations markers. |
Definition at line 386 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::endsWith | ( | const std::string & | a, |
const std::string & | b | ||
) | [inline, protected] |
Definition at line 60 of file annotation_collection.hpp.
bool wcf::AnnotationCollection::filterBy | ( | const FilterCriteria & | criteria | ) |
Reload annotations collection, filtered by new selection criteria.
criteria,: | Annotations filter criteria to pass to the server. |
Definition at line 41 of file annotation_collection.cpp.
const world_canvas_msgs::Annotation & wcf::AnnotationCollection::getAnnotation | ( | const UniqueIDmsg & | id | ) |
Return the annotation with the given unique id.
id | Target annotation id. |
Definition at line 607 of file annotation_collection.cpp.
std::vector< UniqueIDmsg > wcf::AnnotationCollection::getAnnotationIDs | ( | ) |
Return unique IDs for the current annotations collection.
Definition at line 629 of file annotation_collection.cpp.
std::vector< world_canvas_msgs::Annotation > wcf::AnnotationCollection::getAnnotations | ( | const std::string & | name | ) |
Return the annotations with the given name. Can be more than one, as we don't enforce uniqueness on annotation names.
name | Target annotations name. |
Definition at line 618 of file annotation_collection.cpp.
const std::vector<world_canvas_msgs::Annotation>& wcf::AnnotationCollection::getAnnotations | ( | ) | [inline] |
Return the current annotations collection.
Definition at line 249 of file annotation_collection.hpp.
std::vector< UniqueIDmsg > wcf::AnnotationCollection::getAnnotsDataIDs | ( | ) | [protected] |
Return data IDs for the current annotations collection. This method is private because is only necessary for loading annotations data from server, operation that must be transparent for the user.
Definition at line 639 of file annotation_collection.cpp.
const world_canvas_msgs::AnnotationData & wcf::AnnotationCollection::getData | ( | const world_canvas_msgs::Annotation & | ann | ) |
Return the data for the given annotation.
ann | target annotation. |
Definition at line 650 of file annotation_collection.cpp.
unsigned int wcf::AnnotationCollection::getData | ( | std::vector< T > & | data | ) | [inline] |
Return the data for annotations of the template type.
data | Vector of annotation's data. |
Definition at line 266 of file annotation_collection.hpp.
bool wcf::AnnotationCollection::hasAnnotation | ( | const UniqueIDmsg & | id | ) |
Return true if there's an annotation with the given unique id.
id | Target annotation id. |
Definition at line 597 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::isSaved | ( | ) | [inline] |
Definition at line 119 of file annotation_collection.hpp.
bool wcf::AnnotationCollection::load | ( | ) |
Load annotations collection, filtered by current selection criteria.
Definition at line 94 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::loadData | ( | ) |
Load associated data for the current annotations collection.
Definition at line 100 of file annotation_collection.cpp.
visualization_msgs::Marker wcf::AnnotationCollection::makeLabel | ( | const visualization_msgs::Marker & | marker | ) |
Create a RViz visualization marker to add a label above the given marker.
marker | Marker to create a label for. |
Definition at line 483 of file annotation_collection.cpp.
visualization_msgs::Marker wcf::AnnotationCollection::makeMarker | ( | int | id, |
const world_canvas_msgs::Annotation & | ann | ||
) |
Create a RViz visualization marker for the given annotation.
id | Id to add to the visual marker. |
ann | Annotation to create a marker for. |
Definition at line 465 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::publish | ( | const std::string & | topic_name, |
const std::string & | topic_type = "" , |
||
bool | by_server = false , |
||
bool | as_list = false |
||
) |
Publish the current annotation collection data, by this client or by the server. If no topic name is provided, all annotations must be of the same type (function will return with error otherwise). If it is, only annotation's data of the given type are published.
topic_name,: | Where we must publish annotations data. |
topic_type,: | The message type to publish annotations data. Mandatory if as_list is true; ignored otherwise. |
by_server,: | Request the server to publish the annotations instead of this client. |
as_list,: | If true, annotations will be packed in a list before publishing, so topic_type must be an array of currently loaded annotations. |
Definition at line 497 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::publishMarker | ( | const std::string & | topic, |
int | marker_id, | ||
const world_canvas_msgs::Annotation & | ann, | ||
bool | clear_existing = true |
||
) |
Publish RViz visualization marker for the given annotation.
topic | Where we must publish annotation marker. |
marker_id | Id to add to the visual marker. |
ann | Annotation to publish a marker for. |
clear_existing | Delete all markers previously published on this topic. |
Definition at line 442 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::publishMarkers | ( | const std::string & | topic, |
bool | clear_existing = true |
||
) |
Publish RViz visualization markers for the current collection of annotations.
topic,: | Where we must publish annotations markers. |
clear_existing | Delete all markers previously published on this topic. |
Definition at line 413 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::remove | ( | const uuid_msgs::UniqueID & | id | ) |
Remove an existing annotation and its data.
id | Target annotation's uuid. |
Definition at line 349 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::save | ( | ) |
Save current annotation collection with its data.
Definition at line 152 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::saveDeletes | ( | ) | [protected] |
Definition at line 218 of file annotation_collection.cpp.
bool wcf::AnnotationCollection::update | ( | const world_canvas_msgs::Annotation & | annotation, |
const world_canvas_msgs::AnnotationData & | annot_data | ||
) |
Update an existing annotation and its data.
annotation | annotation to update. |
annot_data | annotation's data to update. |
Definition at line 297 of file annotation_collection.cpp.
std::vector<world_canvas_msgs::Annotation> wcf::AnnotationCollection::annotations [protected] |
Definition at line 43 of file annotation_collection.hpp.
std::vector<world_canvas_msgs::AnnotationData> wcf::AnnotationCollection::annots_data [protected] |
Definition at line 44 of file annotation_collection.hpp.
std::vector<world_canvas_msgs::Annotation> wcf::AnnotationCollection::annots_to_delete [protected] |
Definition at line 46 of file annotation_collection.hpp.
FilterCriteria wcf::AnnotationCollection::filter [protected] |
Definition at line 41 of file annotation_collection.hpp.
ros::Publisher wcf::AnnotationCollection::marker_pub [protected] |
Definition at line 38 of file annotation_collection.hpp.
ros::Publisher wcf::AnnotationCollection::markers_pub [protected] |
Definition at line 39 of file annotation_collection.hpp.
ros::NodeHandle wcf::AnnotationCollection::nh [protected] |
Reimplemented from wcf::WorldCanvasClient.
Definition at line 37 of file annotation_collection.hpp.
bool wcf::AnnotationCollection::saved [protected] |
Definition at line 47 of file annotation_collection.hpp.