CartoType C++ API 7.8.2, 2022-03-25
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | Public Attributes | List of all members
CartoType::CRoute Class Reference

#include <cartotype_navigation.h>

Public Member Functions

 CRoute (MInputStream &aInput, const CProjection &aProjection)
 
 CRoute (const TRouteProfile &aProfile, double aPointScale)
 
std::unique_ptr< CGeometryGeometry () const
 
void Clear (bool aClearProfile=true)
 
bool Empty () const
 
TResult WriteAsXml (MOutputStream &aOutput, const CProjection &aProjection) const
 
TResult WriteAsGpx (MOutputStream &aOutput, const CProjection &aProjection) const
 
void GetNearestSegment (const TPoint &aPoint, TNearestSegmentInfo &aInfo, int32_t aSection, double aPreviousDistanceAlongRoute) const
 
void GetPointAtDistance (double aDistanceInMeters, TNearestSegmentInfo &aInfo) const
 
void GetPointAtTime (double aTimeInSeconds, TNearestSegmentInfo &aInfo) const
 
void Append (const CRoute &aRoute)
 
std::unique_ptr< CRouteCopy () const
 
std::unique_ptr< CRouteCopyWithoutRestrictedSegments () const
 
CString Instructions (CMap &aMap, const char *aLocale, bool aMetricUnits, bool aAbbreviate) const
 
double TollRoadDistance () const
 
void AppendSegment (const Router::TJunctionInfo &aBestArcInfo, const CString &aJunctionName, const CString &aJunctionRef, const CContour &aContour, const CString &aName, const CString &aRef, TRoadType aRoadType, double aMaxSpeed, double aDistance, double aTime, int32_t aSection, bool aRestricted)
 

Public Attributes

std::vector< std::unique_ptr< CRouteSegment > > iRouteSegment
 
double iDistance = 0
 
double iTime = 0
 
COnCurveContour iPath
 
double iPointScale = 1
 
CPathToJunction iPathToJunctionBefore
 
CPathToJunction iPathToJunctionAfter
 
TRouteProfile iProfile
 

Detailed Description

Information about an entire route.

Constructor & Destructor Documentation

◆ CRoute() [1/2]

CartoType::CRoute::CRoute ( MInputStream aInput,
const CProjection &  aProjection 
)

Creates a route by reading an XML CartoTypeRoute element. Uses aProjection to project the points from latitude and longitude.

◆ CRoute() [2/2]

CartoType::CRoute::CRoute ( const TRouteProfile aProfile,
double  aPointScale 
)
explicit

Creates an empty route with a given route profile and point scale.

Member Function Documentation

◆ Append()

void CartoType::CRoute::Append ( const CRoute aRoute)

Appends one route to another.

◆ AppendSegment()

void CartoType::CRoute::AppendSegment ( const Router::TJunctionInfo &  aBestArcInfo,
const CString aJunctionName,
const CString aJunctionRef,
const CContour aContour,
const CString aName,
const CString aRef,
TRoadType  aRoadType,
double  aMaxSpeed,
double  aDistance,
double  aTime,
int32_t  aSection,
bool  aRestricted 
)

Appends a segment to a route. For internal use only.

◆ Clear()

void CartoType::CRoute::Clear ( bool  aClearProfile = true)

Sets the route to empty. Sets the route profile to a default value (clears it) if aClearProfile is true.

◆ Copy()

std::unique_ptr< CRoute > CartoType::CRoute::Copy ( ) const

Copies a route.

◆ CopyWithoutRestrictedSegments()

std::unique_ptr< CRoute > CartoType::CRoute::CopyWithoutRestrictedSegments ( ) const

Copies a route but does not copy restricted segments (e.g., private roads).

◆ Empty()

bool CartoType::CRoute::Empty ( ) const
inline

Returns true if this route has no route segments.

◆ Geometry()

std::unique_ptr< CGeometry > CartoType::CRoute::Geometry ( ) const

Creates a Geometry object containing the points of a route.

◆ GetNearestSegment()

void CartoType::CRoute::GetNearestSegment ( const TPoint aPoint,
TNearestSegmentInfo aInfo,
int32_t  aSection,
double  aPreviousDistanceAlongRoute 
) const

Gets information about the nearest route segment to a point given in map coordinates.

The parameter aSection gives the current route section (a part of the route between waypoints; simple routes have a single section). The returned segment will always be in the current section or a following section. It is theoretically possible for a section to be completely skipped if it is very short or of zero length, so there is no constraint that section 0 must be followed by section 1 and not by section 2, etc. If aSection is negative it is ignored and the returned segment may be in any section.

The parameter aPreviousDistanceAlongRoute should be provided (set to a value greater than zero) for multi-section routes, so that the correct route segment can be chosen if the route doubles back on itself. Positions further along the route will be given preference over those earlier in the route.

◆ GetPointAtDistance()

void CartoType::CRoute::GetPointAtDistance ( double  aDistanceInMeters,
TNearestSegmentInfo aInfo 
) const

Gets information about the point a certain distance along a route.

◆ GetPointAtTime()

void CartoType::CRoute::GetPointAtTime ( double  aTimeInSeconds,
TNearestSegmentInfo aInfo 
) const

Gets information about the point a certain estimated time along a route.

◆ Instructions()

CString CartoType::CRoute::Instructions ( CMap &  aMap,
const char *  aLocale,
bool  aMetricUnits,
bool  aAbbreviate 
) const

Returns textual instructions for a route. For internal use only.

◆ TollRoadDistance()

double CartoType::CRoute::TollRoadDistance ( ) const

Returns the total distance in metres of the parts of the route that are on toll roads.

◆ WriteAsGpx()

TResult CartoType::CRoute::WriteAsGpx ( MOutputStream aOutput,
const CProjection &  aProjection 
) const

Writes a route in GPX format.

◆ WriteAsXml()

TResult CartoType::CRoute::WriteAsXml ( MOutputStream aOutput,
const CProjection &  aProjection 
) const

Writes a route as an XML CartoTypeRoute element. Uses aProjection to inverse-project the points back to latitude and longitude.

Member Data Documentation

◆ iDistance

double CartoType::CRoute::iDistance = 0

The distance of the route in meters.

◆ iPath

COnCurveContour CartoType::CRoute::iPath

The path along the entire route in map units.

◆ iPathToJunctionAfter

CPathToJunction CartoType::CRoute::iPathToJunctionAfter

The path to the first non-trivial junction after the route: used when creating OpenLR location data.

◆ iPathToJunctionBefore

CPathToJunction CartoType::CRoute::iPathToJunctionBefore

The path to the first non-trivial junction before the route: used when creating OpenLR location data.

◆ iPointScale

double CartoType::CRoute::iPointScale = 1

The scale used to convert map units from fractional to whole units. For example, if the map unit is 32nds of meters this will be 1/32.

◆ iProfile

TRouteProfile CartoType::CRoute::iProfile

The profile used to create the route.

◆ iRouteSegment

std::vector<std::unique_ptr<CRouteSegment> > CartoType::CRoute::iRouteSegment

An array of route segments representing the route.

◆ iTime

double CartoType::CRoute::iTime = 0

The estimated time taken to traverse the route in seconds.


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