2010-07-09 05:05:40 -04:00
|
|
|
/*
|
|
|
|
open source routing machine
|
|
|
|
Copyright (C) Dennis Luxen, others 2010
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU AFFERO General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
or see http://www.gnu.org/licenses/agpl.txt.
|
2010-07-14 08:55:53 -04:00
|
|
|
*/
|
2010-07-09 05:05:40 -04:00
|
|
|
|
|
|
|
#ifndef _NODE_COORDS_H
|
|
|
|
#define _NODE_COORDS_H
|
|
|
|
|
2013-08-05 12:37:42 -04:00
|
|
|
#include "Coordinate.h"
|
2013-06-26 19:48:22 -04:00
|
|
|
#include "../typedefs.h"
|
|
|
|
|
2013-08-05 13:35:47 -04:00
|
|
|
#include <boost/assert.hpp>
|
|
|
|
|
2010-08-31 10:00:40 -04:00
|
|
|
#include <cstddef>
|
2011-11-14 13:36:31 -05:00
|
|
|
#include <climits>
|
2010-07-09 05:05:40 -04:00
|
|
|
|
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
|
|
|
|
2013-08-05 13:35:47 -04:00
|
|
|
NodeInfo(int _lat, int _lon, NodeID _id) : lat(_lat), lon(_lon), id(_id) {}
|
|
|
|
NodeInfo() : lat(INT_MAX), lon(INT_MAX), id(UINT_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;
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
return lon;
|
|
|
|
break;
|
|
|
|
default:
|
2013-08-05 13:35:47 -04:00
|
|
|
BOOST_ASSERT_MSG(false, "should not happen");
|
2011-12-17 16:01:40 -05:00
|
|
|
return UINT_MAX;
|
|
|
|
break;
|
|
|
|
}
|
2013-08-05 13:35:47 -04:00
|
|
|
BOOST_ASSERT_MSG(false, "should not happen");
|
2011-12-17 16:01:40 -05:00
|
|
|
return UINT_MAX;
|
|
|
|
}
|
2010-07-09 05:05:40 -04:00
|
|
|
};
|
2010-08-31 10:00:40 -04:00
|
|
|
|
2010-07-09 05:05:40 -04:00
|
|
|
#endif //_NODE_COORDS_H
|