Overpass API regression suite coverage (Saxony) / overpass_api/statements/around.h
overpass_api/statements/around.h
34 of 34 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 modify6 * it under the terms of the GNU Affero General Public License as7 * published by the Free Software Foundation, either version 3 of the8 * 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 of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU Affero General Public License16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.17 */19#ifndef DE__OSM3S___OVERPASS_API__STATEMENTS__AROUND_H20#define DE__OSM3S___OVERPASS_API__STATEMENTS__AROUND_H22#include <map>23#include <set>24#include <string>25#include <vector>26#include "../data/collect_members.h"27#include "../data/utils.h"28#include "../data/way_geometry_store.h"29#include "statement.h"32struct Prepared_Segment33{34 double first_lat;35 double first_lon;36 double second_lat;37 double second_lon;38 std::vector< double > first_cartesian;39 std::vector< double > second_cartesian;40 std::vector< double > norm;42 Prepared_Segment(double first_lat, double first_lon, double second_lat, double second_lon);43};46struct Prepared_Point47{48 double lat;49 double lon;50 std::vector< double > cartesian;52 Prepared_Point(double lat, double lon);53};56class Around_Statement : public Output_Statement57{58 public:59 Around_Statement(int line_number_, const std::map< std::string, std::string >& attributes,60 Parsed_Query& global_settings);62 virtual void execute(Resource_Manager& rman);63 virtual ~Around_Statement();65 struct Statement_Maker : public Generic_Statement_Maker< Around_Statement >66 {68 };69 static Statement_Maker statement_maker;71 struct Criterion_Maker : public Statement::Criterion_Maker72 {74 virtual Statement* create_criterion(const Token_Node_Ptr& tree_it,75 const std::string& type, const std::string& into,76 Statement::Factory& stmt_factory, Parsed_Query& global_settings, Error_Output* error_output);78 };79 static Criterion_Maker criterion_maker;81 virtual Query_Constraint* get_query_constraint();85 Ranges< Uint32_Index > calc_ranges(const Set& input_nodes, Resource_Manager& rman) const;87 void calc_lat_lons(const Set& input_nodes, Statement& query, Resource_Manager& rman);89 bool is_inside(double lat, double lon) const;90 bool is_inside(double first_lat, double first_lon, double second_lat, double second_lon) const;91 bool is_inside(const std::vector< Quad_Coord >& way_geometry) const;95 template< typename Node_Skeleton >96 void add_nodes(const std::map< Uint32_Index, std::vector< Node_Skeleton > >& nodes);98 template< typename Way_Skeleton >99 void add_ways(const std::map< Uint31_Index, std::vector< Way_Skeleton > >& ways,100 const Way_Geometry_Store& way_geometries);102 virtual std::string dump_xml(const std::string& indent) const113102 q for (std::vector< Point_Double >::const_iterator it = points.begin(); it != points.end(); ++it)120 virtual std::string dump_compact_ql(const std::string&) const124 virtual std::string dump_ql_in_query(const std::string&) const129446117 q for (std::vector< Point_Double >::const_iterator it = points.begin(); it != points.end(); ++it)1331919 q virtual std::string dump_pretty_ql(const std::string& indent) const { return indent + dump_compact_ql(indent); }135 private:136 std::string input;137 double radius;138 std::vector< Point_Double > points;140 std::map< Uint32_Index, std::vector< Point_Double > > radius_lat_lons;141 std::vector< Prepared_Point > simple_lat_lons;142 std::vector< Prepared_Segment > simple_segments;143 std::vector< Query_Constraint* > constraints;144};146#endif