Ignition Gazebo

API Reference

5.0.0
ResourceSpawner Class Reference

Provides interface for communicating to backend for generation of local models. More...

#include <ResourceSpawner.hh>

Public Slots

void DisplayResources ()
 Displays the resources to the qml grid abiding by all search and sort criteria. More...
 
void OnDownloadFuelResource (const QString &_path, const QString &_name, const QString &_owner, int index)
 Callback when a request is made to download a fuel resource. More...
 
void OnOwnerClicked (const QString &_owner)
 Callback when a fuel owner is selected, will clear the currently loaded resources and load the ones belonging to the specified owner. More...
 
void OnPathClicked (const QString &_path)
 Callback when a resource path is selected, will clear the currently loaded resources and load the ones at the specified path. More...
 
void OnResourceSpawn (const QString &_sdfPath)
 Callback when a resource is selected. More...
 
void OnSearchEntered (const QString &_searchKeyword)
 Callback when a search request is made. More...
 
void OnSortChosen (const QString &_sortType)
 Callback when a sort request is made. More...
 

Public Member Functions

 ResourceSpawner ()
 Constructor. More...
 
 ~ResourceSpawner () override
 Destructor. More...
 
void AddPath (const std::string &_path)
 Adds a path to the path list model. More...
 
void FilterResources (std::vector< Resource > &_resources)
 Filters the vector of resources by the previously entered search keyword. More...
 
std::vector< ResourceFuelResources (const std::string &_owner)
 Returns the fuel resources as a vector belonging to the passed in owner. More...
 
void LoadConfig (const tinyxml2::XMLElement *_pluginElem) override
 
Resource LocalResource (const std::string &_path)
 Returns the resource corresponding to the model.config file. More...
 
std::vector< ResourceLocalResources (const std::string &_path)
 Returns the local resources as a vector located under the passed in path. More...
 
void Resources (std::vector< Resource > &_resources)
 Populates the passed in _resources vector with the currently selected group of resources. More...
 
void SetThumbnail (const std::string &_thumbnailPath, Resource &_resource)
 Finds a thumbnail on the provided thumbnail path and sets the model's thumbnail path attribute to it, no action is taken if no thumbnail is found. More...
 
void SortResources (std::vector< Resource > &_resources)
 Sorts the vector of resources by the previously entered sort method. The sorting types as a string, are "Most Recent", "A - Z", "Z - A", and "Downloaded." The sort defaults to "Most Recent.". More...
 

Detailed Description

Provides interface for communicating to backend for generation of local models.

Constructor & Destructor Documentation

◆ ResourceSpawner()

Constructor.

◆ ~ResourceSpawner()

~ResourceSpawner ( )
override

Destructor.

Member Function Documentation

◆ AddPath()

void AddPath ( const std::string _path)

Adds a path to the path list model.

Parameters
[in]_pathThe path to add

◆ DisplayResources

void DisplayResources ( )
slot

Displays the resources to the qml grid abiding by all search and sort criteria.

◆ FilterResources()

void FilterResources ( std::vector< Resource > &  _resources)

Filters the vector of resources by the previously entered search keyword.

Parameters
[in,out]_resourcesThe vector of resources to filter

◆ FuelResources()

std::vector<Resource> FuelResources ( const std::string _owner)

Returns the fuel resources as a vector belonging to the passed in owner.

Parameters
[in]_ownerThe name of the owner
Returns
The vector of resources

◆ LoadConfig()

void LoadConfig ( const tinyxml2::XMLElement *  _pluginElem)
override

◆ LocalResource()

Resource LocalResource ( const std::string _path)

Returns the resource corresponding to the model.config file.

Parameters
[in]_pathThe path of the model.config file
Returns
The local resource

◆ LocalResources()

std::vector<Resource> LocalResources ( const std::string _path)

Returns the local resources as a vector located under the passed in path.

Parameters
[in]_pathThe path to search
Returns
The vector of resources

◆ OnDownloadFuelResource

void OnDownloadFuelResource ( const QString &  _path,
const QString &  _name,
const QString &  _owner,
int  index 
)
slot

Callback when a request is made to download a fuel resource.

Parameters
[in]_pathURI to the fuel resource
[in]indexThe index of the grid pane to update

◆ OnOwnerClicked

void OnOwnerClicked ( const QString &  _owner)
slot

Callback when a fuel owner is selected, will clear the currently loaded resources and load the ones belonging to the specified owner.

Parameters
[in]_ownerThe name of the owner

◆ OnPathClicked

void OnPathClicked ( const QString &  _path)
slot

Callback when a resource path is selected, will clear the currently loaded resources and load the ones at the specified path.

Parameters
[in]_pathThe path to search resources

◆ OnResourceSpawn

void OnResourceSpawn ( const QString &  _sdfPath)
slot

Callback when a resource is selected.

Parameters
[in]_sdfPathThe absolute path to the resource's sdf file

◆ OnSearchEntered

void OnSearchEntered ( const QString &  _searchKeyword)
slot

Callback when a search request is made.

Parameters
[in]_searchKeywordThe search keyword, applies to either the resource's name or owner

◆ OnSortChosen

void OnSortChosen ( const QString &  _sortType)
slot

Callback when a sort request is made.

Parameters
[in]_sortTypeThe sorting type as a string, accepts "Most Recent", "A - Z", "Z - A", and "Downloaded." Defaults to "Most Recent."

◆ Resources()

void Resources ( std::vector< Resource > &  _resources)

Populates the passed in _resources vector with the currently selected group of resources.

Parameters
[in,out]_resourcesThe vector of resources to populate

◆ SetThumbnail()

void SetThumbnail ( const std::string _thumbnailPath,
Resource _resource 
)

Finds a thumbnail on the provided thumbnail path and sets the model's thumbnail path attribute to it, no action is taken if no thumbnail is found.

Parameters
[in]_thumbnailPathThe path to search for a thumbnail
[in]_modelThe model to update with the thumbnail information

◆ SortResources()

void SortResources ( std::vector< Resource > &  _resources)

Sorts the vector of resources by the previously entered sort method. The sorting types as a string, are "Most Recent", "A - Z", "Z - A", and "Downloaded." The sort defaults to "Most Recent.".

Parameters
[in,out]_resourcesThe vector of resources to sort

The documentation for this class was generated from the following file: