chromium/third_party/s2cellid/src/s2/s2cellid.h

// Copyright 2005 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

// Author: [email protected] (Eric Veach)

#ifndef S2_S2CELLID_H_
#define S2_S2CELLID_H_

#include <cstddef>
#include <functional>
#include <iostream>
#include <string>
#include <vector>

#include "base/check_op.h"
#include "s2/_fpcontractoff.h"
#include "s2/r2.h"
#include "s2/r2rect.h"
#include "s2/s1angle.h"
#include "s2/s2coords.h"
#include "s2/util/bits/bits.h"

#ifdef _MSC_VER
#pragma warning(disable : 4146) /* unary minus operator applied to unsigned \
                                   type, result still unsigned */
#endif

class S2LatLng;

// An S2CellId is a 64-bit unsigned integer that uniquely identifies a
// cell in the S2 cell decomposition.  It has the following format:
//
//   id = [face][face_pos]
//
//   face:     a 3-bit number (range 0..5) encoding the cube face.
//
//   face_pos: a 61-bit number encoding the position of the center of this
//             cell along the Hilbert curve over this face (see the Wiki
//             pages for details).
//
// Sequentially increasing cell ids follow a continuous space-filling curve
// over the entire sphere.  They have the following properties:
//
//  - The id of a cell at level k consists of a 3-bit face number followed
//    by k bit pairs that recursively select one of the four children of
//    each cell.  The next bit is always 1, and all other bits are 0.
//    Therefore, the level of a cell is determined by the position of its
//    lowest-numbered bit that is turned on (for a cell at level k, this
//    position is 2 * (kMaxLevel - k).)
//
//  - The id of a parent cell is at the midpoint of the range of ids spanned
//    by its children (or by its descendants at any level).
//
// Leaf cells are often used to represent points on the unit sphere, and
// this class provides methods for converting directly between these two
// representations.  For cells that represent 2D regions rather than
// discrete point, it is better to use the S2Cell class.
//
// This class is intended to be copied by value as desired.  It uses
// the default copy constructor and assignment operator.
class S2CellId {};

inline bool operator==(S2CellId x, S2CellId y) {}

inline bool operator!=(S2CellId x, S2CellId y) {}

inline bool operator<(S2CellId x, S2CellId y) {}

inline bool operator>(S2CellId x, S2CellId y) {}

inline bool operator<=(S2CellId x, S2CellId y) {}

inline bool operator>=(S2CellId x, S2CellId y) {}

inline S2CellId S2CellId::FromFace(int face) {}

inline S2CellId S2CellId::FromFacePosLevel(int face, uint64_t pos, int level) {}

inline int S2CellId::GetCenterSiTi(int* psi, int* pti) const {}

inline bool S2CellId::is_valid() const {}

inline int S2CellId::face() const {}

inline uint64_t S2CellId::pos() const {}

inline int S2CellId::level() const {}

inline int S2CellId::GetSizeIJ() const {}

inline double S2CellId::GetSizeST() const {}

inline int S2CellId::GetSizeIJ(int level) {}

inline double S2CellId::GetSizeST(int level) {}

inline bool S2CellId::is_leaf() const {}

inline bool S2CellId::is_face() const {}

inline int S2CellId::child_position() const {}

inline int S2CellId::child_position(int level) const {}

inline S2CellId S2CellId::range_min() const {}

inline S2CellId S2CellId::range_max() const {}

inline bool S2CellId::contains(S2CellId other) const {}

inline bool S2CellId::intersects(S2CellId other) const {}

inline S2CellId S2CellId::parent(int level) const {}

inline S2CellId S2CellId::parent() const {}

inline S2CellId S2CellId::child(int position) const {}

inline S2CellId S2CellId::child_begin() const {}

inline S2CellId S2CellId::child_begin(int level) const {}

inline S2CellId S2CellId::child_end() const {}

inline S2CellId S2CellId::child_end(int level) const {}

inline S2CellId S2CellId::next() const {}

inline S2CellId S2CellId::prev() const {}

inline S2CellId S2CellId::next_wrap() const {}

inline S2CellId S2CellId::prev_wrap() const {}

inline S2CellId S2CellId::Begin(int level) {}

inline S2CellId S2CellId::End(int level) {}

std::ostream& operator<<(std::ostream& os, S2CellId id);

// Hasher for S2CellId.
// Example use: std::unordered_map<S2CellId, int, S2CellIdHash>.
struct S2CellIdHash {};

#endif  // S2_S2CELLID_H_