mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[routing] Documentation
Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
@@ -218,19 +218,53 @@ public:
|
||||
MaxspeedType GetForward() const { return m_forward; }
|
||||
MaxspeedType GetBackward() const { return m_backward; }
|
||||
|
||||
/**
|
||||
* @brief Whether the maxspeed is valid for the forward direction.
|
||||
*
|
||||
* Valid maxspeeds include numeric values as well as `kNoneMaxSpeed` and `kWalkMaxSpeed`.
|
||||
*
|
||||
* Only the forward direction is evaluated, maxspeed for the backward direction may still be invalid.
|
||||
* To check for valid maxspeed in both directions, use `IsBidirectional()`.
|
||||
*
|
||||
* @return true if valid, false if not.
|
||||
*/
|
||||
bool IsValid() const { return m_forward != kInvalidSpeed; }
|
||||
/// \returns true if Maxspeed is considered as Bidirectional(). It means different
|
||||
/// speed is set for forward and backward direction. Otherwise returns false. It means
|
||||
/// |m_forward| speed should be used for the both directions.
|
||||
|
||||
/**
|
||||
* @brief Whether the maxspeed is valid for both directions.
|
||||
*
|
||||
* @return true if valid for both directions, false if not.
|
||||
*
|
||||
* @todo The documentation previously stated:
|
||||
* “[Returns] true if Maxspeed is considered as Bidirectional(). It means different speed is set
|
||||
* for forward and backward direction. Otherwise returns false. It means `m_forward` speed should
|
||||
* be used for the both directions.” However, this is at odds with the actual code, which just
|
||||
* checks for validity, not identity.
|
||||
*/
|
||||
bool IsBidirectional() const { return IsValid() && m_backward != kInvalidSpeed; }
|
||||
|
||||
/// \brief returns speed according to |m_units|. |kInvalidSpeed|, |kNoneMaxSpeed| or
|
||||
/// |kWalkMaxSpeed| may be returned.
|
||||
/**
|
||||
* @brief Returns maxspeed in native units.
|
||||
*
|
||||
* Native units are the units returned by `GetUnits()`.
|
||||
*
|
||||
* @param forward Whether to return maxspeed for the forward or backward direction.
|
||||
*
|
||||
* @return Speed in native units, or `kInvalidSpeed`, `kNoneMaxSpeed` or `kWalkMaxSpeed`.
|
||||
*/
|
||||
MaxspeedType GetSpeedInUnits(bool forward) const;
|
||||
|
||||
/// \brief returns speed in km per hour. If it's not valid |kInvalidSpeed| is
|
||||
/// returned. Otherwise forward or backward speed in km per hour is returned. |kNoneMaxSpeed| and
|
||||
/// |kWalkMaxSpeed| are converted to some numbers.
|
||||
/**
|
||||
* @brief Returns maxspeed in km per hour.
|
||||
*
|
||||
* If the maxspeed is not valid `kInvalidSpeed` is returned. Otherwise forward or backward speed
|
||||
* in km per hour is returned. `kNoneMaxSpeed` and `kWalkMaxSpeed` are converted to actual speeds
|
||||
* which can be used directly.
|
||||
*
|
||||
* @param forward Whether to return maxspeed for the forward or backward direction.
|
||||
*
|
||||
* @return Speed in km/h, or `kInvalidSpeed`.
|
||||
*/
|
||||
MaxspeedType GetSpeedKmPH(bool forward) const;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user