GEOS  3.9.1dev
MortonCode.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************/
14 
15 
16 #pragma once
17 
18 #include <geos/export.h>
19 #include <string>
20 
21 // Forward declarations
22 namespace geos {
23 namespace geom {
24 class Coordinate;
25 }
26 }
27 
28 namespace geos {
29 namespace shape { // geos.shape
30 namespace fractal { // geos.shape.fractal
31 
32 
67 
68 public:
69 
73  static constexpr int MAX_LEVEL = 16;
74 
83  static uint32_t encode(int x, int y);
84 
92  static geom::Coordinate decode(uint32_t index);
93 
101  static uint32_t levelSize(uint32_t level);
102 
111  static uint32_t maxOrdinate(uint32_t level);
112 
120  static uint32_t level(uint32_t numPoints);
121 
122 
123 private:
124 
125  static void checkLevel(uint32_t level) ;
126 
127  static uint32_t interleave(uint32_t x);
128 
129  static uint32_t deinterleave(uint32_t x);
130 
131 };
132 
133 
134 } // namespace geos.shape.fractal
135 } // namespace geos.shape
136 } // namespace geos
137 
138 
139 
#define GEOS_DLL
Definition: export.h:28
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Basic namespace for all GEOS functionalities.