CartoType C++ API 8.8-7-gb35e4dc71
for Windows, Linux, Qt and other platforms supporting C++ development
|
#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 (InputStream &aInput) |
void | Write (OutputStream &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) |
int32_t | TunnelsBridgesAndDirectionSortValue () const |
int32_t | CompareForDisplay (const FeatureInfo &aOther) 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 |
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.
|
strong |
The Field type is used by SetField, which is intended for advanced and internal use only.
|
inlineconstexpr |
Creates a feature info object of type UnknownNonRoute.
CartoTypeCore::FeatureInfo::FeatureInfo | ( | FeatureType | aType | ) |
Creates a feature info object from a feature type.
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.
|
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.
|
inlineconstexpr |
Returns the access flags as a combination of the KRouteAccess... values.
FeatureInfo CartoTypeCore::FeatureInfo::ArcRouteInfo | ( | bool | aForwards | ) | const |
Converts this object into a FeatureInfo object usable for an arc within route info.
|
inlineconstexpr |
Returns true if this is a route that is a bridge.
int32_t CartoTypeCore::FeatureInfo::CompareForDisplay | ( | const FeatureInfo & | aOther | ) | const |
Compares feature info values to produce the default display order. The ordering is:
|
inlineconstexpr |
Returns true if this is a route and cycle access is allowed.
|
inlineconstexpr |
Returns the feature discriminator.
|
inlineconstexpr |
Returns true if the rule of the road is to drive on the left.
|
inlineconstexpr |
Returns true if the rule of the road is to drive on the right.
|
inlineconstexpr |
Returns true if this is a route and emergency vehicle access is allowed.
|
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.
|
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.
|
static |
Converts a value made from legacy KArc... constants to a FeatureInfo object.
|
inlinestaticconstexpr |
Creates a feature info object from a raw integer value. For internal use.
|
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.
|
inlineconstexpr |
Returns true if this is a route and no normal access is allowed.
|
inlineconstexpr |
Returns the level, which is in the range -8 ... 7.
|
inlineconstexpr |
Returns true if this is a route and motor vehicle access is allowed.
|
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.
|
inlineconstexpr |
Returns true if this is a one-way route.
|
inlineconstexpr |
Returns true if this is a one-way route in the direction in which the route is stored.
|
inlineconstexpr |
Returns true if this is a one-way route in the direction in which the route is stored.
|
inlineconstexpr |
The inequality operator.
|
inlineconstexpr |
The less-than operator.
|
inlineconstexpr |
The equality operator.
|
inlineconstexpr |
Returns true if this is a route and there are access restrictions other than those specified by the standard flags.
|
inlineconstexpr |
Returns true if this is a route and pedestrian access is allowed.
|
inlineconstexpr |
Returns the raw integer value. For internal use.
void CartoTypeCore::FeatureInfo::Read | ( | InputStream & | aInput | ) |
Reads a feature info object from a stream.
|
inlineconstexpr |
Reverses the one-way direction if this is a one-way route.
|
inlineconstexpr |
Returns true if this is a route that is part of a roundabout.
|
inlineconstexpr |
Returns true if this is a route.
|
inlineconstexpr |
Sets the access flags from a combination of the KRouteAccess... values. Does nothing and returns an error if this is not a route.
|
inlineconstexpr |
Makes this object a bridge or an ordinary route. Does nothing and returns an error if this is not a route.
|
inlineconstexpr |
Allows or forbids cycle access. Does nothing and returns an error if this is not a route.
|
inlineconstexpr |
Sets the rule of the road. Does nothing and returns an error if this is not a route.
|
inlineconstexpr |
Allows or forbids emergency vehicle access. Does nothing and returns an error if this is not a route.
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).
|
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.
|
inlineconstexpr |
Sets the level, clamping it to the range -8 ... 7.
|
inlineconstexpr |
Allows or forbids motor vehicle access. Does nothing and returns an error if this is not a route.
|
inlineconstexpr |
Sets whether this route is one-way. Does nothing and returns an error if this is not a route.
|
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.
|
inlineconstexpr |
Allows or forbids pedestrian access. Does nothing and returns an error if this is not a route.
|
inlineconstexpr |
Sets whether this route is part of a roundabout. Does nothing and returns an error if this is not a route.
|
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.
|
inlineconstexpr |
Sets the sub-type. Does nothing and returns an error if this is a route.
|
inlineconstexpr |
Sets whether this route is a toll route. Does nothing and returns an error if this is not a route.
|
inlineconstexpr |
Makes this object a tunnel or an ordinary route. Does nothing and returns an error if this is not a route.
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.
|
inlineconstexpr |
Sets or clears the vehicle access flags. Does nothing and returns an error if this is not a route.
|
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.
|
inlineconstexpr |
Returns the speed limit in kph. A value of zero indicates that no speed limit is known.
|
inlineconstexpr |
Returns the sub-type. Returns 0 if this is a route.
|
inlineconstexpr |
Returns true if this is a toll route.
|
inlineconstexpr |
Returns true if this is a route that is a tunnel.
int32_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.
|
inlineconstexpr |
Returns the feature type.
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.
void CartoTypeCore::FeatureInfo::Write | ( | OutputStream & | aOutput | ) | const |
Writes a feature info object to a stream.
|
inlineconstexpr |
Returns true if this is a directed route arc going the wrong way along a one-way route. Useful only in route calculation.
|
staticconstexpr |
The number of gradient types.
|
staticconstexpr |
The maximum value of a sub-type of a non-route object. The minimum value is zero.
|
staticconstexpr |
A flag to forbid cycle access in a feature info object, or, in a vehicle type, to indicate a cyclist.
|
staticconstexpr |
A flag to forbid emergency vehicle access in a feature info object, or, in a vehicle type, to indicate an emergency vehicle.
|
staticconstexpr |
A mask to select the route access flags.
|
staticconstexpr |
A flag to forbid motor vehicle access in a feature info object, or, in a vehicle type, to indicate a motor vehicle.
|
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.
|
staticconstexpr |
A flag to forbid pedestrian access in a feature info object, or, in a vehicle type, to indicate a pedestrian.
|
staticconstexpr |
A set of flags indicating public access: that is, access for pedestrians, cyclists and motor vehicles.
|
staticconstexpr |
The amount by which the route access flags are shifted.
|
staticconstexpr |
A set of flags covering all vehicles.
|
staticconstexpr |
A flag indicating that this route is one-way but is stored in the opposite direction to the allowed direction of travel.
|
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.