olp-cpp-sdk  1.22.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
olp::geo::QuadKey64Helper Struct Reference

A helper structure for basic operations on 64-bit Morton quadkeys. More...

#include <TileKey.h>

Public Member Functions

constexpr QuadKey64Helper (std::uint64_t key)
 The default constructor.
 
constexpr QuadKey64Helper Parent () const
 Gets the quadkey of the parent. More...
 
constexpr QuadKey64Helper Child () const
 Gets the quadkey representing the first child of this quad. More...
 
QuadKey64Helper GetSubkey (int delta) const
 Gets a subquadkey that is a relative of its parent. More...
 
QuadKey64Helper AddedSubkey (QuadKey64Helper sub_key) const
 Gets the absolute quadkey that is constructed from its subquadkey. More...
 

Static Public Member Functions

static constexpr std::uint32_t RowsAtLevel (std::uint32_t level)
 Gets the number of rows at a given level. More...
 
static constexpr std::uint32_t ChildrenAtLevel (std::uint32_t level)
 Gets the number of children at a level. More...
 

Public Attributes

std::uint64_t key {0}
 The representation of this quadkey.
 

Detailed Description

A helper structure for basic operations on 64-bit Morton quadkeys.

This class can be used to prevent conversions between tile keys and quadkeys for basic operations.

Member Function Documentation

◆ AddedSubkey()

QuadKey64Helper olp::geo::QuadKey64Helper::AddedSubkey ( QuadKey64Helper  sub_key) const

Gets the absolute quadkey that is constructed from its subquadkey.

It is the reverse function of GetSubkey(). It returns the absolute quad key in the tree based on a subquadkey.

Parameters
sub_keyThe subquadkey generated with ToSubQuadKey().
Returns
The absolute quadkey in the quadtree.

◆ Child()

constexpr QuadKey64Helper olp::geo::QuadKey64Helper::Child ( ) const
inlineconstexpr

Gets the quadkey representing the first child of this quad.

Returns
The quadkey of the first child.

◆ ChildrenAtLevel()

static constexpr std::uint32_t olp::geo::QuadKey64Helper::ChildrenAtLevel ( std::uint32_t  level)
inlinestaticconstexpr

Gets the number of children at a level.

It is 4 to the power of the level.

Parameters
levelThe requested level.
Returns
The number of children at the level.

◆ GetSubkey()

QuadKey64Helper olp::geo::QuadKey64Helper::GetSubkey ( int  delta) const

Gets a subquadkey that is a relative of its parent.

Use this function to generate subkeys that are relatives of a parent that is delta levels up in the subtree.

You can also use this function to create shortened keys for quads on lower levels if the parent is known.

Note
The subquadkeys fit in a 16-bit unsigned integer if the delta is smaller than 8. If the delta is smaller than 16, the subquadkey fits into a 32-bit unsigned integer.
Parameters
deltaThe number of levels that are relatives of the parent quadkey. Must be greater or equal to 0 and smaller than 32.
Returns
The quadkey relative of its parent that is delta levels up the tree.

◆ Parent()

constexpr QuadKey64Helper olp::geo::QuadKey64Helper::Parent ( ) const
inlineconstexpr

Gets the quadkey of the parent.

Returns
The parent quadkey.

◆ RowsAtLevel()

static constexpr std::uint32_t olp::geo::QuadKey64Helper::RowsAtLevel ( std::uint32_t  level)
inlinestaticconstexpr

Gets the number of rows at a given level.

It is 2 to the power of the level.

Parameters
levelThe requested level.
Returns
The number of rows at the level.

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