Overpass API regression suite coverage (Nova Scotia) / overpass_api/core/four_field_index.h

overpass_api/core/four_field_index.h

1 of 1 instrumented lines run by the suite (100.0%) at 8edf11b0419c (this file on GitHub).

runnever runcolumns: line, executions, queries (click for the queries that run the line)

1/** Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Roland Olbricht et al.
2 *
3 * This file is part of Overpass_API.
4 *
5 * Overpass_API is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * Overpass_API is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.
17 */
19#ifndef DE__OSM3S___OVERPASS_API__CORE__FOUR_FIELD_INDEX_H
20#define DE__OSM3S___OVERPASS_API__CORE__FOUR_FIELD_INDEX_H
23#include "basic_types.h"
25#include <string>
26#include <vector>
29struct Four_Field_Entry
313919311 q Four_Field_Entry() : sw(0), se(0), nw(0), ne(0) {}
33 int32 sw;
34 int32 se;
35 int32 nw;
36 int32 ne;
37};
40class Area_Oracle
42public:
43 typedef char point_status;
45 virtual void build_area(bool sw_corner_inside, int32 value, bool* se_corner_inside, bool* nw_corner_inside) = 0;
46 virtual point_status get_point_status(int32 value, double lat, double lon) = 0;
47};
50struct Four_Field_Index
52 Four_Field_Index(Area_Oracle* area_oracle_);
54 int32 add_point(double lat, double lon, int32 val = 1);
55 Four_Field_Entry add_segment(double lhs_lat, double lhs_lon, double rhs_lat, double rhs_lon, int32 val = 1);
57 void compute_inside_parts();
58 Area_Oracle::point_status get_point_status(double lat, double lon);
60 // Only for testing the structure
61 std::string to_string() const;
63private:
64 Four_Field_Entry& make_available(uint32 base_lat, int32 base_lon, int significant_bits);
65 void compute_inside_parts(uint32 lat, int32 lon, int base_significant_bits, unsigned int pos,
66 bool sw, bool* se, bool* nw);
68 std::vector< Four_Field_Entry > tree;
69 uint32 base_lat;
70 int32 base_lon;
71 int base_significant_bits;
72 Area_Oracle* area_oracle;
74 uint32 min_lat;
75 uint32 max_lat;
76 int32 min_lon;
77 int32 max_lon;
78};
81#endif