osrm-backend/include/extractor/query_node.hpp

50 lines
1.0 KiB
C++
Raw Normal View History

#ifndef QUERY_NODE_HPP
#define QUERY_NODE_HPP
2010-07-09 05:05:40 -04:00
2016-01-02 11:13:44 -05:00
#include "util/typedefs.hpp"
2016-01-02 11:13:44 -05:00
#include "osrm/coordinate.hpp"
2014-11-24 11:57:01 -05:00
#include <limits>
2010-07-14 10:22:29 -04:00
2016-01-05 10:51:13 -05:00
namespace osrm
{
namespace extractor
{
2014-08-29 06:37:07 -04:00
struct QueryNode
2014-05-07 12:39:16 -04:00
{
using key_type = OSMNodeID; // type of NodeID
2016-01-05 06:04:04 -05:00
using value_type = int; // type of lat,lons
2014-05-07 12:39:16 -04:00
2016-01-29 06:42:08 -05:00
explicit QueryNode(int lat, int lon, key_type node_id)
2016-01-18 10:54:30 -05:00
: lat(lat), lon(lon), node_id(std::move(node_id))
2016-01-05 06:04:04 -05:00
{
}
2014-08-29 06:37:07 -04:00
QueryNode()
2014-05-07 12:39:16 -04:00
: lat(std::numeric_limits<int>::max()), lon(std::numeric_limits<int>::max()),
node_id(SPECIAL_OSM_NODEID)
2014-05-07 12:39:16 -04:00
{
}
int lat;
int lon;
2016-01-29 06:42:08 -05:00
key_type node_id;
2014-05-07 12:39:16 -04:00
2014-08-29 06:37:07 -04:00
static QueryNode min_value()
2014-05-07 12:39:16 -04:00
{
2014-08-29 06:37:07 -04:00
return QueryNode(static_cast<int>(-90 * COORDINATE_PRECISION),
2016-01-05 06:04:04 -05:00
static_cast<int>(-180 * COORDINATE_PRECISION), MIN_OSM_NODEID);
2014-05-07 12:39:16 -04:00
}
2014-08-29 06:37:07 -04:00
static QueryNode max_value()
2014-05-07 12:39:16 -04:00
{
2014-08-29 06:37:07 -04:00
return QueryNode(static_cast<int>(90 * COORDINATE_PRECISION),
2016-01-05 06:04:04 -05:00
static_cast<int>(180 * COORDINATE_PRECISION), MAX_OSM_NODEID);
2014-05-07 12:39:16 -04:00
}
2010-07-09 05:05:40 -04:00
};
2016-01-05 10:51:13 -05:00
}
}
#endif // QUERY_NODE_HPP