maliput_viz
MaliputViewerModel Class Reference

Detailed Description

Model of the plugin.

Holds the information, as a map of meshes and materials.

#include <src/maliput_viz/plugins/maliput_viewer_model.hh>

Public Member Functions

 MaliputViewerModel (std::unique_ptr< maliput::api::RoadNetwork > _roadNetwork)
 Constructor. More...
 
 ~MaliputViewerModel ()=default
 Destructor. More...
 
const std::map< std::string, std::unique_ptr< MaliputMesh > > & Meshes () const
 Getter of the map of meshes. More...
 
const std::map< std::string, MaliputLabel > & Labels () const
 Getter of the map of labels. More...
 
void SetLayerState (const std::string &_key, bool _isVisible)
 Modifies the visualization state of key mesh. More...
 
void SetTextLabelState (const std::string &_key, bool _isVisible)
 Modifies the visualization state of _type type text labels. More...
 
void SetTextLabelState (MaliputLabelType _type, bool _isVisible)
 Modifies the visualization state of _type type text labels. More...
 
const maliput::api::Lane * GetLaneFromWorldPosition (const ignition::math::Vector3d &_position)
 Get the lane associated with a point in world space if exists. More...
 
const maliput::api::RoadPositionResult GetRoadPositionResult (const ignition::math::Vector3d &_position)
 Get the maliput::api::RoadPositionResult associated with a point in world space if exists. More...
 
const maliput::api::Lane * GetLaneFromId (const std::string &_id)
 Get the lane associated with an id. More...
 
std::vector< const maliput::api::rules::TrafficLight * > GetTrafficLights () const
 Get all the traffic lights from the underlying traffic light book that lives in the road network if any. More...
 
template<typename ContainerType >
ContainerType GetNLanes (size_t _n) const
 Get N lanes from the underlying road geometry. More...
 
template<typename ContainerType >
ContainerType GetAllLaneIds () const
 Get all the lanes that the road geometry posses. More...
 
template<typename StringType >
StringType GetRulesOfLane (const std::string &_phaseRingId, const std::string &_phaseId, const std::string &_laneId) const
 Get all the rules for a given lane. More...
 
template<typename StringType >
std::unordered_map< std::string, std::vector< StringType > > GetPhaseRings () const
 
maliput::api::rules::BulbStates GetBulbStates (const std::string &_phaseRingId, const std::string &_phaseId) const
 Get the state of all the bulbs for a given phase ring id and phase id. More...
 

Constructor & Destructor Documentation

◆ MaliputViewerModel()

MaliputViewerModel ( std::unique_ptr< maliput::api::RoadNetwork >  _roadNetwork)

Constructor.

Parameters
_roadNetworkA maliput::api::RoadNetwork.

◆ ~MaliputViewerModel()

~MaliputViewerModel ( )
default

Destructor.

Member Function Documentation

◆ GetAllLaneIds()

ContainerType GetAllLaneIds

Get all the lanes that the road geometry posses.

Template Parameters
ContainerTypeA container class that must implement size(), push_back() and reserve() methods. See std::vector for further reference on each one of these methods. Its elements' type must be a string class that must be constructible with a single const char* argument and must support concatenation via operator+.
Returns
All lane ids from the underlying road geometry

◆ GetBulbStates()

maliput::api::rules::BulbStates GetBulbStates ( const std::string &  _phaseRingId,
const std::string &  _phaseId 
) const

Get the state of all the bulbs for a given phase ring id and phase id.

Parameters
[in]_phaseRingIdId of the desired phase ring to get the bulb states from.
[in]_phaseIdId of the desired phase to get the bulb states from.
Returns
The state of all the bulbs in the underlying road network.

◆ GetLaneFromId()

const maliput::api::Lane * GetLaneFromId ( const std::string &  _id)

Get the lane associated with an id.

Parameters
[in]_idId of the lane.
Returns
Lane associated with given id or nullptr if id is invalid.

◆ GetLaneFromWorldPosition()

const maliput::api::Lane * GetLaneFromWorldPosition ( const ignition::math::Vector3d &  _position)

Get the lane associated with a point in world space if exists.

Parameters
[in]_positionWorld position of point that intersected with a plane
Returns
Lane associated with that position or nullptr if not found.

◆ GetNLanes()

ContainerType GetNLanes ( size_t  _n) const

Get N lanes from the underlying road geometry.

Parameters
[in]_nAmount of lanes desired to get from the underlying road geometry.
Template Parameters
ContainerTypeA container class that must implement size(), push_back() and reserve() methods. See std::vector for further reference on each one of these methods. Its elements' type must be a string class that must be constructible with a single const char* argument and must support concatenation via operator+.
Returns
Container that contains N lane ids.

◆ GetPhaseRings()

std::unordered_map< std::string, std::vector< StringType > > GetPhaseRings

◆ GetRoadPositionResult()

const maliput::api::RoadPositionResult GetRoadPositionResult ( const ignition::math::Vector3d &  _position)

Get the maliput::api::RoadPositionResult associated with a point in world space if exists.

Precondition
The RoadGeometry (in case of multilane) or the RoadNetwork must be initialized.
Parameters
[in]_positionWorld position of point that intersected with a plane
Returns
maliput::api::RoadPositionResult associated with that position.

◆ GetRulesOfLane()

StringType GetRulesOfLane ( const std::string &  _phaseRingId,
const std::string &  _phaseId,
const std::string &  _laneId 
) const

Get all the rules for a given lane.

Parameters
[in]_phaseRingIdId of the desired phase ring to get the rules from.
[in]_phaseIdId of the desired phase to get the rules from.
[in]_laneIdId of the desired lane to get the rules from.
Template Parameters
StringTypeA string class that must be constructible with a single const char* argument and must support concatenation via operator+.
Returns
rules separated by brackets. Ex: [Right of way Rule]
.

◆ GetTrafficLights()

std::vector< const maliput::api::rules::TrafficLight * > GetTrafficLights ( ) const

Get all the traffic lights from the underlying traffic light book that lives in the road network if any.

Returns
Vector containing all the traffic lights that the underlying road network contains.

◆ Labels()

const std::map< std::string, MaliputLabel > & Labels ( ) const

Getter of the map of labels.

Returns
The map of labels.

◆ Meshes()

const std::map< std::string, std::unique_ptr< MaliputMesh > > & Meshes ( ) const

Getter of the map of meshes.

Returns
The map of meshes.

◆ SetLayerState()

void SetLayerState ( const std::string &  _key,
bool  _isVisible 
)

Modifies the visualization state of key mesh.

Parameters
[in]_keyThe name of the mesh.
[in]_isVisibleThe new visualization status of the mesh.

◆ SetTextLabelState() [1/2]

void SetTextLabelState ( const std::string &  _key,
bool  _isVisible 
)

Modifies the visualization state of _type type text labels.

Parameters
[in]_keyThe id of the lane or branch point.
[in]_isVisibleThe new visualization status of the text label.

◆ SetTextLabelState() [2/2]

void SetTextLabelState ( MaliputLabelType  _type,
bool  _isVisible 
)

Modifies the visualization state of _type type text labels.

Parameters
[in]_typeThe desired label type to target.
[in]_isVisibleThe new visualization status of the text label.

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