// Loading and saving the flags // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // Tools with a fixed set of Property objects representing adjustable // parameters are typically just created in the tool's constructor and // added to the Property container (getPropertyContainer()). In that // case, the Tool subclass does not need to override load() and save() // because the default behavior is to read all the Properties in the // container from the Config object. // // Here however, we have a list of named flag positions of unknown // length, so we need to implement save() and load() ourselves. // // We first save the class ID to the config object so the // rviz::ToolManager will know what to instantiate when the config // file is read back in. void FlagTool3D::save( rviz::Config config ) const { config.mapSetValue( "Class", getClassId() ); // The top level of this tool's Config is a map, but our flags // should go in a list, since they may or may not have unique keys. // Therefore we make a child of the map (``flags_config``) to store // the list. rviz::Config flags_config = config.mapMakeChild( "Flags" ); // To read the positions and names of the flags, we loop over the // the children of our Property container: rviz::Property* container = getPropertyContainer(); int num_children = container->numChildren(); for( int i = 0; i < num_children; i++ ) { rviz::Property* position_prop = container->childAt( i ); // For each Property, we create a new Config object representing a // single flag and append it to the Config list. rviz::Config flag_config = flags_config.listAppendNew(); // Into the flag's config we store its name: flag_config.mapSetValue( "Name", position_prop->getName() ); // ... and its position. position_prop->save( flag_config ); } }
void AddWayPoint::save(rviz::Config config) const { /// Allowing the user to save the current configuration of the panel ROS_INFO_STREAM("Saving configuration"); rviz::Panel::save(config); config.mapSetValue("TextEntry", QString::fromStdString(std::string("test_field"))); }
void CancelAction::save( rviz::Config config ) const { rviz::Panel::save( config ); rviz::Config topic_list_config = config.mapMakeChild( "topics" ); std::vector<topicListLayout>::const_iterator it = topic_list_layouts_.begin(); while( it != topic_list_layouts_.end()){ topic_list_config.listAppendNew().setValue( it->topic_name_->text() ); it ++; } config.mapSetValue( "Topic", output_topic_ ); }
// Save all configuration data from this panel to the given // Config object. It is important here that you call save() // on the parent class so the class id and panel name get saved. void TeleopPanel::save( rviz::Config config ) const { rviz::Panel::save( config ); config.mapSetValue( "Topic", output_topic_ ); }
void DataRateCheckerPlugin::save(rviz::Config config) const { rviz::Panel::save(config); config.mapSetValue("Topic", ui_.topic_combo_box_->currentText()); config.mapSetValue("Min rate", ui_.min_frequency_spin_box_->value()); } // DataRateCheckerPlugin::save
void TfVisualCalcPanel::save(rviz::Config p_config) const { rviz::Panel::save(p_config); p_config.mapSetValue("TfVisualCalcView", QString::fromStdString(m_calcView->toYAMLString())); }
void TransformableMarkerOperatorAction::save( rviz::Config config ) const { rviz::Panel::save( config ); config.mapSetValue( "ServerName", server_name_editor_->text().toStdString().c_str() ); }