CartoType C++ API 8.2-50-g007fde5ee
for Windows, Linux, Qt and other platforms supporting C++ development
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
CartoTypeCore::FeatureInfo Class Reference

#include <cartotype_feature_info.h>

Public Types

enum class  Field {
  None , Discriminator , Level , Type ,
  OneWayForward , OneWayBackward , DriveOnLeft , Roundabout ,
  Toll , SpeedLimit , Gradient , PublicAccess ,
  Vehicle , Pedestrian , Cycle , Motor ,
  Emergency , AccessOther , SubType , RawValue
}
 

Public Member Functions

constexpr FeatureInfo ()
 
 FeatureInfo (FeatureType aType)
 
 FeatureInfo (FeatureType aType, uint32_t aSubType)
 
 FeatureInfo (uint32_t aSubType)
 
constexpr bool operator== (const FeatureInfo &aOther) const
 
constexpr bool operator!= (const FeatureInfo &aOther) const
 
constexpr bool operator< (const FeatureInfo &aOther) const
 
constexpr FeatureDiscriminator Discriminator () const
 
constexpr bool Route () const
 
constexpr bool Tunnel () const
 
constexpr Result SetTunnel (bool aValue)
 
constexpr bool Bridge () const
 
constexpr Result SetBridge (bool aValue)
 
constexpr int Level () const
 
constexpr void SetLevel (int aLevel)
 
constexpr FeatureType Type () const
 
Result SetType (FeatureType aType)
 
constexpr bool OneWay () const
 
constexpr bool OneWayForward () const
 
constexpr bool OneWayBackward () const
 
constexpr Result SetOneWay (bool aValue)
 
constexpr bool DriveOnLeft () const
 
constexpr bool DriveOnRight () const
 
constexpr Result SetDriveOnLeft (bool aValue)
 
constexpr void ReverseOneWayDirection ()
 
constexpr bool Roundabout () const
 
constexpr Result SetRoundabout (bool aValue)
 
constexpr bool Toll () const
 
constexpr Result SetToll (bool aValue)
 
constexpr bool WrongWay () const
 
constexpr Result SetWrongWay (bool aValue)
 
constexpr uint32_t SpeedLimit () const
 
constexpr Result SetSpeedLimit (uint32_t aValue)
 
constexpr uint32_t Gradient () const
 
constexpr Result SetGradient (uint32_t aValue)
 
constexpr uint32_t Access () const
 
constexpr Result SetAccess (uint32_t aValue)
 
constexpr Result SetVehicleAccess (bool aValue)
 
constexpr bool PedestrianAccess () const
 
constexpr Result SetPedestrianAccess (bool aValue)
 
constexpr bool CycleAccess () const
 
constexpr Result SetCycleAccess (bool aValue)
 
constexpr bool MotorVehicleAccess () const
 
constexpr Result SetMotorVehicleAccess (bool aValue)
 
constexpr bool EmergencyVehicleAccess () const
 
constexpr Result SetEmergencyVehicleAccess (bool aValue)
 
constexpr bool OtherAccessRestricted () const
 
constexpr Result SetOtherAccessRestricted (bool aValue)
 
constexpr bool IsPrivate () const
 
constexpr uint32_t SubType () const
 
constexpr Result SetSubType (uint32_t aValue)
 
void Read (DataInputStream &aInput)
 
void Write (DataOutputStream &aOutput) const
 
uint32_t WeightIndex () const
 
FeatureInfo ArcRouteInfo (bool aForwards) const
 
constexpr uint32_t RawValue () const
 
constexpr bool MotorwayOrLink () const
 
void SetField (Field aField, uint32_t aValue)
 
uint32_t TunnelsBridgesAndDirectionSortValue () const
 

Static Public Member Functions

static constexpr FeatureInfo FromRawValue (uint32_t aRawValue)
 
static FeatureInfo FromCTM1v7 (const MString &aLayer, const MString &aStringAttribute, uint32_t aIntAttribute)
 
static FeatureInfo FromCTM1v7 (uint32_t aRoadTypeMask, const MString &aStringAttribute, uint32_t aIntAttribute)
 
static FeatureInfo FromKArcFlags (uint32_t aArcFlags)
 

Static Public Attributes

static constexpr uint32_t KRouteTypeCount = 32
 
static constexpr uint32_t KGradientCount = 8
 
static constexpr uint32_t KMaxSubType = 2047
 
static constexpr uint32_t KRouteAccessShift = 26
 
static constexpr uint32_t KRouteAccessMask = 63U << KRouteAccessShift
 
static constexpr uint32_t KRouteAccessWrongWayFlag = 1 << 26
 
static constexpr uint32_t KRouteAccessPedestrianFlag = 1 << 27
 
static constexpr uint32_t KRouteAccessCycleFlag = 1 << 28
 
static constexpr uint32_t KRouteAccessMotorVehicleFlag = 1 << 29
 
static constexpr uint32_t KRouteAccessEmergencyVehicleFlag = 1 << 30
 
static constexpr uint32_t KRouteAccessOtherFlag = 1U << 31
 
static constexpr uint32_t KRouteAccessVehicle = KRouteAccessCycleFlag | KRouteAccessMotorVehicleFlag | KRouteAccessEmergencyVehicleFlag
 
static constexpr uint32_t KRouteAccessPublic = KRouteAccessCycleFlag | KRouteAccessMotorVehicleFlag | KRouteAccessPedestrianFlag
 

Detailed Description

Feature information for a map object, represented internally as a 32-bit value.

Every map object has a feature info value. Feature info values fall into two categories: route and non-route.

Route values have a feature type in the range 0...31 (Motorway...UnknownRoute); it is used as the index into the speed and bonus arrays in a route profile. Route values have other information relevant to routing including the speed limit and access restrictions.

Non-route values have a feature type in the range 32...32767. Non-route feature types, apart from the special values UnknownNonRoute (32) and Invalid (32767), may be expressed as three-letter mnemonics, which can be constructed using the FeatureTypeCode function. Non-route values have an 11-bit sub-type that may be used for fine distinctions such as settlement rank or boundary type.

Both route and non-route values have a level in the range -8...7, where 0 represents ground level. The level is used as one of the criteria determining drawing order.

Member Enumeration Documentation

◆ Field

The Field type is used by SetField, which is intended for advanced and internal use only.

Constructor & Destructor Documentation

◆ FeatureInfo() [1/4]

constexpr CartoTypeCore::FeatureInfo::FeatureInfo ( )
inlineconstexpr

Creates a feature info object of type UnknownNonRoute.

◆ FeatureInfo() [2/4]

CartoTypeCore::FeatureInfo::FeatureInfo ( FeatureType  aType)

Creates a feature info object from a feature type.

◆ FeatureInfo() [3/4]

CartoTypeCore::FeatureInfo::FeatureInfo ( FeatureType  aType,
uint32_t  aSubType 
)

Creates a feature info object with a given type and sub-type. The sub-type is clamped to the range 0...2047, and is ignored if aType is a route type, because routes do not have sub-types.

◆ FeatureInfo() [4/4]

CartoTypeCore::FeatureInfo::FeatureInfo ( uint32_t  aSubType)
explicit

Creates a non-route feature info object of type UnknownNonRoute and a given sub-type. The sub-type is clamped to the range 0...2047.

Member Function Documentation

◆ Access()

constexpr uint32_t CartoTypeCore::FeatureInfo::Access ( ) const
inlineconstexpr

Returns the access flags as a combination of the KRouteAccess... values.

◆ ArcRouteInfo()

FeatureInfo CartoTypeCore::FeatureInfo::ArcRouteInfo ( bool  aForwards) const

Converts this object into a FeatureInfo object usable for an arc within route info.

◆ Bridge()

constexpr bool CartoTypeCore::FeatureInfo::Bridge ( ) const
inlineconstexpr

Returns true if this is a route that is a bridge.

◆ CycleAccess()

constexpr bool CartoTypeCore::FeatureInfo::CycleAccess ( ) const
inlineconstexpr

Returns true if this is a route and cycle access is allowed.

◆ Discriminator()

constexpr FeatureDiscriminator CartoTypeCore::FeatureInfo::Discriminator ( ) const
inlineconstexpr

Returns the feature discriminator.

◆ DriveOnLeft()

constexpr bool CartoTypeCore::FeatureInfo::DriveOnLeft ( ) const
inlineconstexpr

Returns true if the rule of the road is to drive on the left.

◆ DriveOnRight()

constexpr bool CartoTypeCore::FeatureInfo::DriveOnRight ( ) const
inlineconstexpr

Returns true if the rule of the road is to drive on the right.

◆ EmergencyVehicleAccess()

constexpr bool CartoTypeCore::FeatureInfo::EmergencyVehicleAccess ( ) const
inlineconstexpr

Returns true if this is a route and emergency vehicle access is allowed.

◆ FromCTM1v7() [1/2]

static FeatureInfo CartoTypeCore::FeatureInfo::FromCTM1v7 ( const MString aLayer,
const MString aStringAttribute,
uint32_t  aIntAttribute 
)
inlinestatic

Creates a feature info object from a layer name, a set of string attributes, and a pre-CTM1-v7 integer attribute. For internal use only.

◆ FromCTM1v7() [2/2]

static FeatureInfo CartoTypeCore::FeatureInfo::FromCTM1v7 ( uint32_t  aRoadTypeMask,
const MString aStringAttribute,
uint32_t  aIntAttribute 
)
inlinestatic

Creates a feature info object from a road type mask, a set of string attributes, and a pre-CTM1-v7 integer attribute. For internal use only.

◆ FromKArcFlags()

FeatureInfo CartoTypeCore::FeatureInfo::FromKArcFlags ( uint32_t  aArcFlags)
static

Converts a value made from legacy KArc... constants to a FeatureInfo object.

◆ FromRawValue()

static constexpr FeatureInfo CartoTypeCore::FeatureInfo::FromRawValue ( uint32_t  aRawValue)
inlinestaticconstexpr

Creates a feature info object from a raw integer value. For internal use.

◆ Gradient()

constexpr uint32_t CartoTypeCore::FeatureInfo::Gradient ( ) const
inlineconstexpr

Returns the gradient as a number in the range 0...7. Values 0...3 are uphill and 4...7 are downhill. Gradients are stored only in route arcs and not usually in other map objects.

◆ IsPrivate()

constexpr bool CartoTypeCore::FeatureInfo::IsPrivate ( ) const
inlineconstexpr

Returns true if this is a route and no normal access is allowed.

◆ Level()

constexpr int CartoTypeCore::FeatureInfo::Level ( ) const
inlineconstexpr

Returns the level, which is in the range -8 ... 7.

◆ MotorVehicleAccess()

constexpr bool CartoTypeCore::FeatureInfo::MotorVehicleAccess ( ) const
inlineconstexpr

Returns true if this is a route and motor vehicle access is allowed.

◆ MotorwayOrLink()

constexpr bool CartoTypeCore::FeatureInfo::MotorwayOrLink ( ) const
inlineconstexpr

Decides whether a road is a one-way motorway lane or a link on to or off the motorway; used in forbidding sharp turns from off-ramps to on-ramps.

◆ OneWay()

constexpr bool CartoTypeCore::FeatureInfo::OneWay ( ) const
inlineconstexpr

Returns true if this is a one-way route.

◆ OneWayBackward()

constexpr bool CartoTypeCore::FeatureInfo::OneWayBackward ( ) const
inlineconstexpr

Returns true if this is a one-way route in the direction in which the route is stored.

◆ OneWayForward()

constexpr bool CartoTypeCore::FeatureInfo::OneWayForward ( ) const
inlineconstexpr

Returns true if this is a one-way route in the direction in which the route is stored.

◆ operator!=()

constexpr bool CartoTypeCore::FeatureInfo::operator!= ( const FeatureInfo aOther) const
inlineconstexpr

The inequality operator.

◆ operator<()

constexpr bool CartoTypeCore::FeatureInfo::operator< ( const FeatureInfo aOther) const
inlineconstexpr

The less-than operator.

◆ operator==()

constexpr bool CartoTypeCore::FeatureInfo::operator== ( const FeatureInfo aOther) const
inlineconstexpr

The equality operator.

◆ OtherAccessRestricted()

constexpr bool CartoTypeCore::FeatureInfo::OtherAccessRestricted ( ) const
inlineconstexpr

Returns true if this is a route and there are access restrictions other than those specified by the standard flags.

◆ PedestrianAccess()

constexpr bool CartoTypeCore::FeatureInfo::PedestrianAccess ( ) const
inlineconstexpr

Returns true if this is a route and pedestrian access is allowed.

◆ RawValue()

constexpr uint32_t CartoTypeCore::FeatureInfo::RawValue ( ) const
inlineconstexpr

Returns the raw integer value. For internal use.

◆ Read()

void CartoTypeCore::FeatureInfo::Read ( DataInputStream aInput)

Reads a feature info object from a data stream.

◆ ReverseOneWayDirection()

constexpr void CartoTypeCore::FeatureInfo::ReverseOneWayDirection ( )
inlineconstexpr

Reverses the one-way direction if this is a one-way route.

◆ Roundabout()

constexpr bool CartoTypeCore::FeatureInfo::Roundabout ( ) const
inlineconstexpr

Returns true if this is a route that is part of a roundabout.

◆ Route()

constexpr bool CartoTypeCore::FeatureInfo::Route ( ) const
inlineconstexpr

Returns true if this is a route.

◆ SetAccess()

constexpr Result CartoTypeCore::FeatureInfo::SetAccess ( uint32_t  aValue)
inlineconstexpr

Sets the access flags from a combination of the KRouteAccess... values. Does nothing and returns an error if this is not a route.

◆ SetBridge()

constexpr Result CartoTypeCore::FeatureInfo::SetBridge ( bool  aValue)
inlineconstexpr

Makes this object a bridge or an ordinary route. Does nothing and returns an error if this is not a route.

◆ SetCycleAccess()

constexpr Result CartoTypeCore::FeatureInfo::SetCycleAccess ( bool  aValue)
inlineconstexpr

Allows or forbids cycle access. Does nothing and returns an error if this is not a route.

◆ SetDriveOnLeft()

constexpr Result CartoTypeCore::FeatureInfo::SetDriveOnLeft ( bool  aValue)
inlineconstexpr

Sets the rule of the road. Does nothing and returns an error if this is not a route.

◆ SetEmergencyVehicleAccess()

constexpr Result CartoTypeCore::FeatureInfo::SetEmergencyVehicleAccess ( bool  aValue)
inlineconstexpr

Allows or forbids emergency vehicle access. Does nothing and returns an error if this is not a route.

◆ SetField()

void CartoTypeCore::FeatureInfo::SetField ( Field  aField,
uint32_t  aValue 
)

Sets any field, retaining internal consistency. For advanced and internal use only (e.g., by makemap).

◆ SetGradient()

constexpr Result CartoTypeCore::FeatureInfo::SetGradient ( uint32_t  aValue)
inlineconstexpr

Sets the gradient. Does nothing and returns an error if this is not a route. Gradients are stored only in route arcs and not usually in other map objects.

◆ SetLevel()

constexpr void CartoTypeCore::FeatureInfo::SetLevel ( int  aLevel)
inlineconstexpr

Sets the level, clamping it to the range -8 ... 7.

◆ SetMotorVehicleAccess()

constexpr Result CartoTypeCore::FeatureInfo::SetMotorVehicleAccess ( bool  aValue)
inlineconstexpr

Allows or forbids motor vehicle access. Does nothing and returns an error if this is not a route.

◆ SetOneWay()

constexpr Result CartoTypeCore::FeatureInfo::SetOneWay ( bool  aValue)
inlineconstexpr

Sets whether this route is one-way. Does nothing and returns an error if this is not a route.

◆ SetOtherAccessRestricted()

constexpr Result CartoTypeCore::FeatureInfo::SetOtherAccessRestricted ( bool  aValue)
inlineconstexpr

Sets or clears the flag indicating that there are other access restrictions. Does nothing and returns an error if this is not a route.

◆ SetPedestrianAccess()

constexpr Result CartoTypeCore::FeatureInfo::SetPedestrianAccess ( bool  aValue)
inlineconstexpr

Allows or forbids pedestrian access. Does nothing and returns an error if this is not a route.

◆ SetRoundabout()

constexpr Result CartoTypeCore::FeatureInfo::SetRoundabout ( bool  aValue)
inlineconstexpr

Sets whether this route is part of a roundabout. Does nothing and returns an error if this is not a route.

◆ SetSpeedLimit()

constexpr Result CartoTypeCore::FeatureInfo::SetSpeedLimit ( uint32_t  aValue)
inlineconstexpr

Sets the speed limit in kph. A value of zero indicates that no speed limit is known. Does nothing and returns an error if this is not a route.

◆ SetSubType()

constexpr Result CartoTypeCore::FeatureInfo::SetSubType ( uint32_t  aValue)
inlineconstexpr

Sets the sub-type. Does nothing and returns an error if this is a route.

◆ SetToll()

constexpr Result CartoTypeCore::FeatureInfo::SetToll ( bool  aValue)
inlineconstexpr

Sets whether this route is a toll route. Does nothing and returns an error if this is not a route.

◆ SetTunnel()

constexpr Result CartoTypeCore::FeatureInfo::SetTunnel ( bool  aValue)
inlineconstexpr

Makes this object a tunnel or an ordinary route. Does nothing and returns an error if this is not a route.

◆ SetType()

Result CartoTypeCore::FeatureInfo::SetType ( FeatureType  aType)

Sets the type. Does nothing and returns an error if the this is a route and the new type is a non-route type, or vice versa.

◆ SetVehicleAccess()

constexpr Result CartoTypeCore::FeatureInfo::SetVehicleAccess ( bool  aValue)
inlineconstexpr

Sets or clears the vehicle access flags. Does nothing and returns an error if this is not a route.

◆ SetWrongWay()

constexpr Result CartoTypeCore::FeatureInfo::SetWrongWay ( bool  aValue)
inlineconstexpr

Sets whether this route is a directed route arc going the wrong way along a one-way route. Does nothing and returns an error if this is not a route. Useful only in route calculation.

◆ SpeedLimit()

constexpr uint32_t CartoTypeCore::FeatureInfo::SpeedLimit ( ) const
inlineconstexpr

Returns the speed limit in kph. A value of zero indicates that no speed limit is known.

◆ SubType()

constexpr uint32_t CartoTypeCore::FeatureInfo::SubType ( ) const
inlineconstexpr

Returns the sub-type. Returns 0 if this is a route.

◆ Toll()

constexpr bool CartoTypeCore::FeatureInfo::Toll ( ) const
inlineconstexpr

Returns true if this is a toll route.

◆ Tunnel()

constexpr bool CartoTypeCore::FeatureInfo::Tunnel ( ) const
inlineconstexpr

Returns true if this is a route that is a tunnel.

◆ TunnelsBridgesAndDirectionSortValue()

uint32_t CartoTypeCore::FeatureInfo::TunnelsBridgesAndDirectionSortValue ( ) const

Returns a sort value to produce the order: ordinary objects, tunnels, bridges, and within that road direction and one-way status.

◆ Type()

constexpr FeatureType CartoTypeCore::FeatureInfo::Type ( ) const
inlineconstexpr

Returns the feature type.

◆ WeightIndex()

uint32_t CartoTypeCore::FeatureInfo::WeightIndex ( ) const

Returns a nine-bit value used as an index into route profile weights: 5 bits for the route type, 3 for the gradient, and one for whether the road has a toll. Returns zero if this is not a route.

◆ Write()

void CartoTypeCore::FeatureInfo::Write ( DataOutputStream aOutput) const

Writes a feature info object to a data stream.

◆ WrongWay()

constexpr bool CartoTypeCore::FeatureInfo::WrongWay ( ) const
inlineconstexpr

Returns true if this is a directed route arc going the wrong way along a one-way route. Useful only in route calculation.

Member Data Documentation

◆ KGradientCount

constexpr uint32_t CartoTypeCore::FeatureInfo::KGradientCount = 8
staticconstexpr

The number of gradient types.

◆ KMaxSubType

constexpr uint32_t CartoTypeCore::FeatureInfo::KMaxSubType = 2047
staticconstexpr

The maximum value of a sub-type of a non-route object. The minimum value is zero.

◆ KRouteAccessCycleFlag

constexpr uint32_t CartoTypeCore::FeatureInfo::KRouteAccessCycleFlag = 1 << 28
staticconstexpr

A flag to forbid cycle access in a feature info object, or, in a vehicle type, to indicate a cyclist.

◆ KRouteAccessEmergencyVehicleFlag

constexpr uint32_t CartoTypeCore::FeatureInfo::KRouteAccessEmergencyVehicleFlag = 1 << 30
staticconstexpr

A flag to forbid emergency vehicle access in a feature info object, or, in a vehicle type, to indicate an emergency vehicle.

◆ KRouteAccessMask

constexpr uint32_t CartoTypeCore::FeatureInfo::KRouteAccessMask = 63U << KRouteAccessShift
staticconstexpr

A mask to select the route access flags.

◆ KRouteAccessMotorVehicleFlag

constexpr uint32_t CartoTypeCore::FeatureInfo::KRouteAccessMotorVehicleFlag = 1 << 29
staticconstexpr

A flag to forbid motor vehicle access in a feature info object, or, in a vehicle type, to indicate a motor vehicle.

◆ KRouteAccessOtherFlag

constexpr uint32_t CartoTypeCore::FeatureInfo::KRouteAccessOtherFlag = 1U << 31
staticconstexpr

A flag to indicate the presence of other access restrictions in a feature info object, or, in a vehicle type, to indicate a type of vehicle not covered by the other flags.

◆ KRouteAccessPedestrianFlag

constexpr uint32_t CartoTypeCore::FeatureInfo::KRouteAccessPedestrianFlag = 1 << 27
staticconstexpr

A flag to forbid pedestrian access in a feature info object, or, in a vehicle type, to indicate a pedestrian.

◆ KRouteAccessPublic

constexpr uint32_t CartoTypeCore::FeatureInfo::KRouteAccessPublic = KRouteAccessCycleFlag | KRouteAccessMotorVehicleFlag | KRouteAccessPedestrianFlag
staticconstexpr

A set of flags indicating public access: that is, access for pedestrians, cyclists and motor vehicles.

◆ KRouteAccessShift

constexpr uint32_t CartoTypeCore::FeatureInfo::KRouteAccessShift = 26
staticconstexpr

The amount by which the route access flags are shifted.

◆ KRouteAccessVehicle

constexpr uint32_t CartoTypeCore::FeatureInfo::KRouteAccessVehicle = KRouteAccessCycleFlag | KRouteAccessMotorVehicleFlag | KRouteAccessEmergencyVehicleFlag
staticconstexpr

A set of flags covering all vehicles.

◆ KRouteAccessWrongWayFlag

constexpr uint32_t CartoTypeCore::FeatureInfo::KRouteAccessWrongWayFlag = 1 << 26
staticconstexpr

A flag indicating that this route is one-way but is stored in the opposite direction to the allowed direction of travel.

◆ KRouteTypeCount

constexpr uint32_t CartoTypeCore::FeatureInfo::KRouteTypeCount = 32
staticconstexpr

The number of feature types that are routes. They are types with the values 0...31, and those values are used as indexes into speed and bonus arrays in route profiles.


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