Public Member Functions | List of all members
sdf::v9::Polyline Class Reference

Polyline represents a 2D path. Multiple polylines can be combined. More...

#include <Polyline.hh>

Public Member Functions

 Polyline ()
 Constructor. More...
 
 Polyline (const Polyline &_polyline)
 Copy constructor. More...
 
 Polyline (Polyline &&_polyline) noexcept
 Move constructor. More...
 
virtual ~Polyline ()
 Destructor. More...
 
bool AddPoint (const gz::math::Vector2d &_point)
 Add a point to the polyline. More...
 
void ClearPoints ()
 Remove all points from the polyline. More...
 
sdf::ElementPtr Element () const
 Get a pointer to the SDF element that was used during load. More...
 
double Height () const
 Get the polyline's height in meters. More...
 
Errors Load (ElementPtr _sdf)
 Load the polyline geometry based on an element pointer. More...
 
Polylineoperator= (const Polyline &_polyline)
 Assignment operator. More...
 
Polylineoperator= (Polyline &&_polyline)
 Move assignment operator. More...
 
gz::math::Vector2d * PointByIndex (uint64_t _index)
 Get a point by its index. More...
 
const gz::math::Vector2d * PointByIndex (uint64_t _index) const
 Get a point by its index. More...
 
uint64_t PointCount () const
 Get the number of points. More...
 
const std::vector< gz::math::Vector2d > & Points () const
 Get the polyline's points. More...
 
void SetHeight (const double _height)
 Set the polyline's height in meters. More...
 

Detailed Description

Polyline represents a 2D path. Multiple polylines can be combined.

Constructor & Destructor Documentation

◆ Polyline() [1/3]

sdf::v9::Polyline::Polyline ( )

Constructor.

◆ Polyline() [2/3]

sdf::v9::Polyline::Polyline ( const Polyline _polyline)

Copy constructor.

Parameters
[in]_polylinePolyline to copy.

◆ Polyline() [3/3]

sdf::v9::Polyline::Polyline ( Polyline &&  _polyline)
noexcept

Move constructor.

Parameters
[in]_polylinePolyline to move.

◆ ~Polyline()

virtual sdf::v9::Polyline::~Polyline ( )
virtual

Destructor.

Member Function Documentation

◆ AddPoint()

bool sdf::v9::Polyline::AddPoint ( const gz::math::Vector2d &  _point)

Add a point to the polyline.

Parameters
[in]_point2D point to add.
Returns
True for success.

◆ ClearPoints()

void sdf::v9::Polyline::ClearPoints ( )

Remove all points from the polyline.

◆ Element()

sdf::ElementPtr sdf::v9::Polyline::Element ( ) const

Get a pointer to the SDF element that was used during load.

Returns
SDF element pointer. The value will be nullptr if Load has not been called.

◆ Height()

double sdf::v9::Polyline::Height ( ) const

Get the polyline's height in meters.

Returns
The height of the polyline in meters.

◆ Load()

Errors sdf::v9::Polyline::Load ( ElementPtr  _sdf)

Load the polyline geometry based on an element pointer.

This is not the usual entry point. Typical usage of the SDF DOM is through the Root object.

Parameters
[in]_sdfThe SDF Element pointer
Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

◆ operator=() [1/2]

Polyline& sdf::v9::Polyline::operator= ( const Polyline _polyline)

Assignment operator.

Parameters
[in]_polylineThe polyline to set values from.
Returns
*this

◆ operator=() [2/2]

Polyline& sdf::v9::Polyline::operator= ( Polyline &&  _polyline)

Move assignment operator.

Parameters
[in]_polylinePolyline to move.
Returns
Reference to this.

◆ PointByIndex() [1/2]

gz::math::Vector2d* sdf::v9::Polyline::PointByIndex ( uint64_t  _index)

Get a point by its index.

Returns
Mutable pointer to the point.

◆ PointByIndex() [2/2]

const gz::math::Vector2d* sdf::v9::Polyline::PointByIndex ( uint64_t  _index) const

Get a point by its index.

Returns
Constant pointer to the point.

◆ PointCount()

uint64_t sdf::v9::Polyline::PointCount ( ) const

Get the number of points.

Returns
Number of points.

◆ Points()

const std::vector<gz::math::Vector2d>& sdf::v9::Polyline::Points ( ) const

Get the polyline's points.

Each point has 2D coordinates in meters.

Returns
The polyline's points.

◆ SetHeight()

void sdf::v9::Polyline::SetHeight ( const double  _height)

Set the polyline's height in meters.

Parameters
[in]_heightThe height of the polyline in meters.

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