osrm-backend/include/extractor/query_node.hpp

55 lines
1.4 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"
#include "util/coordinate.hpp"
2014-11-24 11:57:01 -05:00
#include <cstdint>
2016-07-26 09:00:58 -04: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
{
2016-07-26 09:00:58 -04:00
using key_type = OSMNodeID; // type of NodeID
using value_type = std::int32_t; // type of lat,lons
2014-05-07 12:39:16 -04:00
explicit QueryNode(const util::FixedLongitude lon_,
const util::FixedLatitude lat_,
const key_type node_id_)
: lon(lon_), lat(lat_), node_id(node_id_)
2016-01-05 06:04:04 -05:00
{
}
2014-08-29 06:37:07 -04:00
QueryNode()
: lon{std::numeric_limits<value_type>::max()}, lat{std::numeric_limits<value_type>::max()},
node_id(SPECIAL_OSM_NODEID)
2014-05-07 12:39:16 -04:00
{
}
util::FixedLongitude lon;
util::FixedLatitude lat;
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
{
return QueryNode(util::FixedLongitude{static_cast<value_type>(-180 * COORDINATE_PRECISION)},
util::FixedLatitude{static_cast<value_type>(-90 * COORDINATE_PRECISION)},
2016-05-27 15:05:04 -04:00
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
{
return QueryNode(util::FixedLongitude{static_cast<value_type>(180 * COORDINATE_PRECISION)},
util::FixedLatitude{static_cast<value_type>(90 * COORDINATE_PRECISION)},
2016-05-27 15:05:04 -04:00
MAX_OSM_NODEID);
2014-05-07 12:39:16 -04:00
}
2010-07-09 05:05:40 -04:00
};
} // namespace extractor
} // namespace osrm
2016-01-05 10:51:13 -05:00
#endif // QUERY_NODE_HPP