code cleanup

This commit is contained in:
DennisOSRM 2011-12-17 22:01:40 +01:00
parent 83e160d14d
commit 5ef4909bdd

View File

@ -29,40 +29,38 @@ or see http://www.gnu.org/licenses/agpl.txt.
template<typename NodeT> template<typename NodeT>
struct NodeCoords { struct NodeCoords {
typedef unsigned key_type; //type of NodeID typedef unsigned key_type; //type of NodeID
typedef int value_type; //type of lat,lons typedef int value_type; //type of lat,lons
NodeCoords(int _lat, int _lon, NodeT _id) : lat(_lat), lon(_lon), id(_id) {} NodeCoords(int _lat, int _lon, NodeT _id) : lat(_lat), lon(_lon), id(_id) {}
NodeCoords() : lat(INT_MAX), lon(INT_MAX), id(UINT_MAX) {} NodeCoords() : lat(INT_MAX), lon(INT_MAX), id(UINT_MAX) {}
int lat; int lat;
int lon; int lon;
NodeT id; NodeT id;
static NodeCoords<NodeT> min_value() static NodeCoords<NodeT> min_value() {
{ return NodeCoords<NodeT>(-90*100000,-180*100000,numeric_limits<NodeT>::min());
return NodeCoords<NodeT>(-90*100000,-180*100000,numeric_limits<NodeT>::min()); }
} static NodeCoords<NodeT> max_value() {
static NodeCoords<NodeT> max_value() return NodeCoords<NodeT>(90*100000, 180*100000, numeric_limits<NodeT>::max());
{ }
return NodeCoords<NodeT>(90*100000, 180*100000, numeric_limits<NodeT>::max());
}
value_type operator[](size_t n) const { value_type operator[](size_t n) const {
switch(n) { switch(n) {
case 1: case 1:
return lat; return lat;
break; break;
case 0: case 0:
return lon; return lon;
break; break;
default: default:
assert(false); assert(false);
return UINT_MAX; return UINT_MAX;
break; break;
} }
assert(false); assert(false);
return UINT_MAX; return UINT_MAX;
} }
}; };
#endif //_NODE_COORDS_H #endif //_NODE_COORDS_H