Overpass API regression suite coverage (Saxony) / overpass_api/statements/geometry_endomorphisms.h
overpass_api/statements/geometry_endomorphisms.h
40 of 45 instrumented lines run by the suite (88.9%) 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__GEOMETRY_ENDOMORPHISMS_H20#define DE__OSM3S___OVERPASS_API__STATEMENTS__GEOMETRY_ENDOMORPHISMS_H23#include "../data/tag_store.h"24#include "../data/utils.h"25#include "evaluator.h"26#include "statement.h"27#include "unary_functions.h"29#include <map>30#include <string>33/* === Geometry Endomorphisms ===35Geometry endomorphisms are functions with one argument.36Many of them help to normalize or check the value of its argument.37They always first let their argument be evaluated.38Their syntax is always40 <Function Name>(<Evaluator>)41*/43template< typename Evaluator_ >44struct Geometry_Endom_Statement_Maker : public Generic_Statement_Maker< Evaluator_ >45{468304692 q Geometry_Endom_Statement_Maker() : Generic_Statement_Maker< Evaluator_ >(Evaluator_::stmt_name()) {}47};50template< typename Evaluator_ >51struct Geometry_Endom_Evaluator_Maker : public Statement::Evaluator_Maker52{53 virtual Statement* create_evaluator(const Token_Node_Ptr& tree_it, Statement::QL_Context tree_context,54 Statement::Factory& stmt_factory, Parsed_Query& global_settings, Error_Output* error_output)5620433 q if (!tree_it.assert_is_function(error_output) || !tree_it.assert_has_input_set(error_output, false)75 Geometry_Endom_Evaluator_Maker()79};82template< typename Evaluator_ >83struct Evaluator_Geometry_Endom_Syntax : public Evaluator_Geometry_Unary_Function84{85 Evaluator_Geometry_Endom_Syntax(int line_number_, const std::map< std::string, std::string >& input_attributes)92 virtual std::string dump_xml(const std::string& indent) const99 virtual std::string dump_compact_ql(const std::string&) const105};108/* ==== Center ====110The function <em>center</em> returns the center of its argument.111It expects a function that evaluates to a geometry.112It then delivers the point that is at the center of the bounding box of the geometry.114Its syntax is116 center(<Evaluator>)118*/120class Evaluator_Center : public Evaluator_Geometry_Endom_Syntax< Evaluator_Center >121{122public:123 static Geometry_Endom_Statement_Maker< Evaluator_Center > statement_maker;124 static Geometry_Endom_Evaluator_Maker< Evaluator_Center > evaluator_maker;128 Evaluator_Center(int line_number_, const std::map< std::string, std::string >& input_attributes, Parsed_Query& global_settings)131 virtual Opaque_Geometry* process(Opaque_Geometry* geom) const;132};135/* ==== Trace ====137The function <em>trace</em> returns the trace of its argument.138It expects a function that evaluates to a geometry.139It then delivers a collection of all segments and nodes that appear in its input.140Ways are split at points that are explicitly in the set141and at points that belong to more than one way in the set.142Every node and segment is contained at most once.144Its syntax is146 trace(<Evaluator>)148*/150class Evaluator_Trace : public Evaluator_Geometry_Endom_Syntax< Evaluator_Trace >151{152public:153 static Geometry_Endom_Statement_Maker< Evaluator_Trace > statement_maker;154 static Geometry_Endom_Evaluator_Maker< Evaluator_Trace > evaluator_maker;158 Evaluator_Trace(int line_number_, const std::map< std::string, std::string >& input_attributes, Parsed_Query& global_settings)161 virtual Opaque_Geometry* process(Opaque_Geometry* geom) const;162};165/* ==== Hull ====167The function <em>hull</em> returns the convex hull of its argument.168It expects a function that evaluates to a geometry169It then delivers a polygon without holes that contains all of its arguments.171Its syntax is173 hull(<Evaluator>)175*/177class Evaluator_Hull : public Evaluator_Geometry_Endom_Syntax< Evaluator_Hull >178{179public:180 static Geometry_Endom_Statement_Maker< Evaluator_Hull > statement_maker;181 static Geometry_Endom_Evaluator_Maker< Evaluator_Hull > evaluator_maker;185 Evaluator_Hull(int line_number_, const std::map< std::string, std::string >& input_attributes, Parsed_Query& global_settings)188 virtual Opaque_Geometry* process(Opaque_Geometry* geom) const;189};192#endif