Fix naming in FixedPointCoordinate

This commit is contained in:
Patrick Niklaus
2016-01-04 19:55:35 +01:00
parent 4312013552
commit 4f7369ed02
7 changed files with 14 additions and 24 deletions
+2 -2
View File
@@ -65,12 +65,12 @@ bool PhantomNode::is_compressed() const { return (forward_offset != 0) || (rever
bool PhantomNode::is_valid(const unsigned number_of_nodes) const
{
return location.is_valid() &&
return location.IsValid() &&
((forward_node_id < number_of_nodes) || (reverse_node_id < number_of_nodes)) &&
((forward_weight != INVALID_EDGE_WEIGHT) || (reverse_weight != INVALID_EDGE_WEIGHT)) &&
(component.id != INVALID_COMPONENTID) && (name_id != INVALID_NAMEID);
}
bool PhantomNode::is_valid() const { return location.is_valid() && (name_id != INVALID_NAMEID); }
bool PhantomNode::is_valid() const { return location.IsValid() && (name_id != INVALID_NAMEID); }
bool PhantomNode::operator==(const PhantomNode &other) const { return location == other.location; }
+4 -8
View File
@@ -34,7 +34,7 @@ FixedPointCoordinate::FixedPointCoordinate(int lat, int lon) : lat(lat), lon(lon
#endif
}
bool FixedPointCoordinate::is_valid() const
bool FixedPointCoordinate::IsValid() const
{
return !(lat > 90 * COORDINATE_PRECISION || lat < -90 * COORDINATE_PRECISION ||
lon > 180 * COORDINATE_PRECISION || lon < -180 * COORDINATE_PRECISION);
@@ -45,12 +45,8 @@ bool FixedPointCoordinate::operator==(const FixedPointCoordinate &other) const
return lat == other.lat && lon == other.lon;
}
void FixedPointCoordinate::output(std::ostream &out) const
std::ostream &operator<<(std::ostream &out, const FixedPointCoordinate &coordinate)
{
out << "(" << lat / COORDINATE_PRECISION << "," << lon / COORDINATE_PRECISION << ")";
}
double FixedPointCoordinate::bearing(const FixedPointCoordinate &other) const
{
return coordinate_calculation::bearing(other, *this);
out << "(" << static_cast<double>(coordinate.lat / COORDINATE_PRECISION) << "," << static_cast<double>(coordinate.lon / COORDINATE_PRECISION) << ")";
return out;
}
+2 -2
View File
@@ -124,7 +124,7 @@ perpendicularDistanceFromProjectedCoordinate(const FixedPointCoordinate &segment
FixedPointCoordinate &nearest_location,
double &ratio)
{
BOOST_ASSERT(query_location.is_valid());
BOOST_ASSERT(query_location.IsValid());
// initialize values
const double x = projected_coordinate.first;
@@ -188,7 +188,7 @@ perpendicularDistanceFromProjectedCoordinate(const FixedPointCoordinate &segment
nearest_location.lat = static_cast<int>(mercator::y2lat(p) * COORDINATE_PRECISION);
nearest_location.lon = static_cast<int>(q * COORDINATE_PRECISION);
}
BOOST_ASSERT(nearest_location.is_valid());
BOOST_ASSERT(nearest_location.IsValid());
const double approximate_distance = greatCircleDistance(query_location, nearest_location);
BOOST_ASSERT(0.0 <= approximate_distance);