cesium-native 0.43.0
Loading...
Searching...
No Matches
S2CellID.h
1#pragma once
2
3#include "Cartographic.h"
4#include "GlobeRectangle.h"
5#include "Library.h"
6
7#include <array>
8#include <cstdint>
9#include <string>
10#include <string_view>
11
12namespace CesiumGeometry {
13struct QuadtreeTileID;
14}
15
16namespace CesiumGeospatial {
17
47class CESIUMGEOSPATIAL_API S2CellID {
48public:
56 static S2CellID fromToken(const std::string_view& token);
57
68 static S2CellID
69 fromFaceLevelPosition(uint8_t face, uint32_t level, uint64_t position);
70
79 uint8_t face,
80 const CesiumGeometry::QuadtreeTileID& quadtreeTileID);
81
90 S2CellID(uint64_t id);
91
97 bool isValid() const;
98
104 uint64_t getID() const { return this->_id; }
105
109 std::string toToken() const;
110
116 int32_t getLevel() const;
117
121 uint8_t getFace() const;
122
131
142 std::array<Cartographic, 4> getVertices() const;
143
150
160 S2CellID getChild(size_t index) const;
161
168
169private:
170 uint64_t _id;
171};
172
173} // namespace CesiumGeospatial
A position defined by longitude, latitude, and height.
A two-dimensional, rectangular region on a globe, specified using longitude and latitude coordinates....
A 64-bit unsigned integer that uniquely identifies a cell in the S2 cell decomposition.
Definition S2CellID.h:47
Cartographic getCenter() const
Gets the longitude/latitude position at the center of this cell.
int32_t getLevel() const
Gets the level of the cell from the cell ID.
static S2CellID fromToken(const std::string_view &token)
static S2CellID fromFaceLevelPosition(uint8_t face, uint32_t level, uint64_t position)
Creates a cell given its face (range 0..5), level, and Hilbert curve cell index within that face and ...
std::string toToken() const
Converts the cell ID to a hexadecimal token.
S2CellID getChild(size_t index) const
Gets a child cell of this cell.
GlobeRectangle computeBoundingRectangle() const
Computes the globe rectangle that bounds this cell.
uint64_t getID() const
Gets the ID of the cell.
Definition S2CellID.h:104
bool isValid() const
Determines if this cell ID is valid.
S2CellID getParent() const
Gets the parent cell of this cell.
std::array< Cartographic, 4 > getVertices() const
Gets the vertices at the corners of the cell.
S2CellID(uint64_t id)
Constructs a new S2 cell ID.
uint8_t getFace() const
Gets the face id (0...5) for this S2 cell.
static S2CellID fromQuadtreeTileID(uint8_t face, const CesiumGeometry::QuadtreeTileID &quadtreeTileID)
Create an S2 id from a face and a quadtree tile id.
Basic geometry classes for Cesium.
Classes for geospatial computations in Cesium.
Uniquely identifies a node in a quadtree.