2010-07-09 05:05:40 -04:00
|
|
|
/*
|
|
|
|
|
2013-10-14 07:42:28 -04:00
|
|
|
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
|
|
|
|
All rights reserved.
|
2010-07-09 05:05:40 -04:00
|
|
|
|
2013-10-14 07:42:28 -04:00
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
are permitted provided that the following conditions are met:
|
2010-07-09 05:05:40 -04:00
|
|
|
|
2013-10-14 07:42:28 -04:00
|
|
|
Redistributions of source code must retain the above copyright notice, this list
|
|
|
|
of conditions and the following disclaimer.
|
|
|
|
Redistributions in binary form must reproduce the above copyright notice, this
|
|
|
|
list of conditions and the following disclaimer in the documentation and/or
|
|
|
|
other materials provided with the distribution.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
|
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
*/
|
2010-07-09 05:05:40 -04:00
|
|
|
|
2014-04-16 10:59:40 -04:00
|
|
|
#ifndef QUERY_NODE_H
|
|
|
|
#define QUERY_NODE_H
|
2010-07-09 05:05:40 -04:00
|
|
|
|
2013-06-26 19:48:22 -04:00
|
|
|
#include "../typedefs.h"
|
|
|
|
|
2013-12-20 07:12:56 -05:00
|
|
|
#include <osrm/Coordinate.h>
|
2013-12-17 11:59:44 -05:00
|
|
|
|
2013-08-05 13:35:47 -04:00
|
|
|
#include <boost/assert.hpp>
|
|
|
|
|
2013-06-26 19:48:22 -04:00
|
|
|
#include <limits>
|
2010-07-14 10:22:29 -04:00
|
|
|
|
2013-08-05 13:35:47 -04:00
|
|
|
struct NodeInfo {
|
|
|
|
typedef NodeID key_type; //type of NodeID
|
2011-12-17 16:01:40 -05:00
|
|
|
typedef int value_type; //type of lat,lons
|
2010-07-14 08:55:53 -04:00
|
|
|
|
2014-02-11 05:42:24 -05:00
|
|
|
NodeInfo(int lat, int lon, NodeID id) : lat(lat), lon(lon), id(id) { }
|
|
|
|
NodeInfo()
|
|
|
|
:
|
|
|
|
lat(std::numeric_limits<int>::max()),
|
|
|
|
lon(std::numeric_limits<int>::max()),
|
|
|
|
id(std::numeric_limits<unsigned>::max())
|
|
|
|
{ }
|
|
|
|
|
2011-12-17 16:01:40 -05:00
|
|
|
int lat;
|
|
|
|
int lon;
|
2013-08-05 13:35:47 -04:00
|
|
|
NodeID id;
|
2010-07-14 08:55:53 -04:00
|
|
|
|
2013-08-05 13:35:47 -04:00
|
|
|
static NodeInfo min_value() {
|
|
|
|
return NodeInfo(
|
|
|
|
-90*COORDINATE_PRECISION,
|
|
|
|
-180*COORDINATE_PRECISION,
|
|
|
|
std::numeric_limits<NodeID>::min()
|
|
|
|
);
|
2011-12-17 16:01:40 -05:00
|
|
|
}
|
2013-08-05 13:35:47 -04:00
|
|
|
|
|
|
|
static NodeInfo max_value() {
|
|
|
|
return NodeInfo(
|
|
|
|
90*COORDINATE_PRECISION,
|
|
|
|
180*COORDINATE_PRECISION,
|
|
|
|
std::numeric_limits<NodeID>::max()
|
|
|
|
);
|
2011-12-17 16:01:40 -05:00
|
|
|
}
|
2010-07-14 08:55:53 -04:00
|
|
|
|
2013-08-05 13:35:47 -04:00
|
|
|
value_type operator[](const std::size_t n) const {
|
2011-12-17 16:01:40 -05:00
|
|
|
switch(n) {
|
|
|
|
case 1:
|
|
|
|
return lat;
|
2014-02-26 09:55:04 -05:00
|
|
|
// break;
|
2011-12-17 16:01:40 -05:00
|
|
|
case 0:
|
|
|
|
return lon;
|
2014-02-26 09:55:04 -05:00
|
|
|
// break;
|
2011-12-17 16:01:40 -05:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2013-08-05 13:35:47 -04:00
|
|
|
BOOST_ASSERT_MSG(false, "should not happen");
|
2014-02-11 05:42:24 -05:00
|
|
|
return std::numeric_limits<unsigned>::max();
|
2011-12-17 16:01:40 -05:00
|
|
|
}
|
2010-07-09 05:05:40 -04:00
|
|
|
};
|
2010-08-31 10:00:40 -04:00
|
|
|
|
2014-04-16 10:59:40 -04:00
|
|
|
#endif //QUERY_NODE_H
|