Use formating script.

Signed-off-by: FILLAU Jean-Maxime <jean-maxime.fillau@mapotempo.com>
This commit is contained in:
FILLAU Jean-Maxime
2017-05-29 14:46:11 +02:00
committed by Patrick Niklaus
parent 82a149eb87
commit c573cdb0ae
11 changed files with 150 additions and 115 deletions
+1 -1
View File
@@ -28,9 +28,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ENGINE_API_BASE_PARAMETERS_HPP
#define ENGINE_API_BASE_PARAMETERS_HPP
#include "engine/approach.hpp"
#include "engine/bearing.hpp"
#include "engine/hint.hpp"
#include "engine/approach.hpp"
#include "util/coordinate.hpp"
#include <boost/optional.hpp>
@@ -6,8 +6,8 @@
#include "engine/datafacade/datafacade_base.hpp"
#include "engine/algorithm.hpp"
#include "engine/geospatial_query.hpp"
#include "engine/approach.hpp"
#include "engine/geospatial_query.hpp"
#include "customizer/edge_based_graph.hpp"
@@ -656,7 +656,8 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
{
BOOST_ASSERT(m_geospatial_query.get());
return m_geospatial_query->NearestPhantomNodesInRange(input_coordinate, max_distance, approach);
return m_geospatial_query->NearestPhantomNodesInRange(
input_coordinate, max_distance, approach);
}
std::vector<PhantomNodeWithDistance>
@@ -690,7 +691,8 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
{
BOOST_ASSERT(m_geospatial_query.get());
return m_geospatial_query->NearestPhantomNodes(input_coordinate, max_results, max_distance, approach);
return m_geospatial_query->NearestPhantomNodes(
input_coordinate, max_results, max_distance, approach);
}
std::vector<PhantomNodeWithDistance>
@@ -720,9 +722,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
input_coordinate, max_results, max_distance, bearing, bearing_range, approach);
}
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const engine::Approach approach) const override final
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(
const util::Coordinate input_coordinate,
const engine::Approach approach) const override final
{
BOOST_ASSERT(m_geospatial_query.get());
@@ -731,7 +733,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
}
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(
const util::Coordinate input_coordinate, const double max_distance, const engine::Approach approach) const override final
const util::Coordinate input_coordinate,
const double max_distance,
const engine::Approach approach) const override final
{
BOOST_ASSERT(m_geospatial_query.get());
@@ -739,12 +743,12 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
input_coordinate, max_distance, approach);
}
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const double max_distance,
const int bearing,
const int bearing_range,
const engine::Approach approach) const override final
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(
const util::Coordinate input_coordinate,
const double max_distance,
const int bearing,
const int bearing_range,
const engine::Approach approach) const override final
{
BOOST_ASSERT(m_geospatial_query.get());
@@ -752,11 +756,11 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
input_coordinate, max_distance, bearing, bearing_range, approach);
}
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const int bearing,
const int bearing_range,
const engine::Approach approach) const override final
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(
const util::Coordinate input_coordinate,
const int bearing,
const int bearing_range,
const engine::Approach approach) const override final
{
BOOST_ASSERT(m_geospatial_query.get());
@@ -894,7 +898,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
bool IsLeftHandDriving() const override final
{
return m_profile_properties->left_hand_driving;
return m_profile_properties->left_hand_driving;
}
};
@@ -9,8 +9,8 @@
#include "extractor/guidance/turn_instruction.hpp"
#include "extractor/guidance/turn_lane_types.hpp"
#include "extractor/original_edge_data.hpp"
#include "engine/phantom_node.hpp"
#include "engine/approach.hpp"
#include "engine/phantom_node.hpp"
#include "util/exception.hpp"
#include "util/guidance/bearing_class.hpp"
#include "util/guidance/entry_class.hpp"
+81 -58
View File
@@ -1,8 +1,8 @@
#ifndef GEOSPATIAL_QUERY_HPP
#define GEOSPATIAL_QUERY_HPP
#include "engine/phantom_node.hpp"
#include "engine/approach.hpp"
#include "engine/phantom_node.hpp"
#include "util/bearing.hpp"
#include "util/coordinate_calculation.hpp"
#include "util/rectangle.hpp"
@@ -56,15 +56,16 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const double max_distance,
const engine::Approach approach) const
{
auto results =
rtree.Nearest(input_coordinate,
[this, approach, &input_coordinate](const CandidateSegment &segment) {
return boolPairAnd(HasValidEdge(segment), approach_usage(input_coordinate, segment, approach));
},
[this, max_distance, input_coordinate](const std::size_t,
const CandidateSegment &segment) {
return CheckSegmentDistance(input_coordinate, segment, max_distance);
});
auto results = rtree.Nearest(
input_coordinate,
[this, approach, &input_coordinate](const CandidateSegment &segment) {
return boolPairAnd(HasValidEdge(segment),
approach_usage(input_coordinate, segment, approach));
},
[this, max_distance, input_coordinate](const std::size_t,
const CandidateSegment &segment) {
return CheckSegmentDistance(input_coordinate, segment, max_distance);
});
return MakePhantomNodes(input_coordinate, results);
}
@@ -80,11 +81,12 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
{
auto results = rtree.Nearest(
input_coordinate,
[this, approach, &input_coordinate, bearing, bearing_range, max_distance](const CandidateSegment &segment) {
auto use_direction = boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
HasValidEdge(segment));
use_direction = boolPairAnd(use_direction,
approach_usage(input_coordinate, segment, approach));
[this, approach, &input_coordinate, bearing, bearing_range, max_distance](
const CandidateSegment &segment) {
auto use_direction = boolPairAnd(
CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment));
use_direction =
boolPairAnd(use_direction, approach_usage(input_coordinate, segment, approach));
return use_direction;
},
[this, max_distance, input_coordinate](const std::size_t,
@@ -106,10 +108,12 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
{
auto results = rtree.Nearest(
input_coordinate,
[this, approach, &input_coordinate, bearing, bearing_range](const CandidateSegment &segment) {
auto use_direction = boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
HasValidEdge(segment));
return boolPairAnd(use_direction, approach_usage(input_coordinate, segment, approach));
[this, approach, &input_coordinate, bearing, bearing_range](
const CandidateSegment &segment) {
auto use_direction = boolPairAnd(
CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment));
return boolPairAnd(use_direction,
approach_usage(input_coordinate, segment, approach));
},
[max_results](const std::size_t num_results, const CandidateSegment &) {
return num_results >= max_results;
@@ -131,10 +135,12 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
{
auto results = rtree.Nearest(
input_coordinate,
[this, approach, &input_coordinate, bearing, bearing_range](const CandidateSegment &segment) {
auto use_direction = boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
HasValidEdge(segment));
return boolPairAnd(use_direction, approach_usage(input_coordinate, segment, approach));
[this, approach, &input_coordinate, bearing, bearing_range](
const CandidateSegment &segment) {
auto use_direction = boolPairAnd(
CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment));
return boolPairAnd(use_direction,
approach_usage(input_coordinate, segment, approach));
},
[this, max_distance, max_results, input_coordinate](const std::size_t num_results,
const CandidateSegment &segment) {
@@ -152,14 +158,15 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const unsigned max_results,
const engine::Approach approach) const
{
auto results =
rtree.Nearest(input_coordinate,
[this, approach, &input_coordinate](const CandidateSegment &segment) {
return boolPairAnd(HasValidEdge(segment), approach_usage(input_coordinate, segment, approach));
},
[max_results](const std::size_t num_results, const CandidateSegment &) {
return num_results >= max_results;
});
auto results = rtree.Nearest(
input_coordinate,
[this, approach, &input_coordinate](const CandidateSegment &segment) {
return boolPairAnd(HasValidEdge(segment),
approach_usage(input_coordinate, segment, approach));
},
[max_results](const std::size_t num_results, const CandidateSegment &) {
return num_results >= max_results;
});
return MakePhantomNodes(input_coordinate, results);
}
@@ -172,16 +179,17 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
const double max_distance,
const engine::Approach approach) const
{
auto results =
rtree.Nearest(input_coordinate,
[this, approach, &input_coordinate](const CandidateSegment &segment) {
return boolPairAnd(HasValidEdge(segment), approach_usage(input_coordinate, segment, approach));
},
[this, max_distance, max_results, input_coordinate](
const std::size_t num_results, const CandidateSegment &segment) {
return num_results >= max_results ||
CheckSegmentDistance(input_coordinate, segment, max_distance);
});
auto results = rtree.Nearest(
input_coordinate,
[this, approach, &input_coordinate](const CandidateSegment &segment) {
return boolPairAnd(HasValidEdge(segment),
approach_usage(input_coordinate, segment, approach));
},
[this, max_distance, max_results, input_coordinate](const std::size_t num_results,
const CandidateSegment &segment) {
return num_results >= max_results ||
CheckSegmentDistance(input_coordinate, segment, max_distance);
});
return MakePhantomNodes(input_coordinate, results);
}
@@ -197,13 +205,15 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
bool has_big_component = false;
auto results = rtree.Nearest(
input_coordinate,
[this, approach, &input_coordinate, &has_big_component, &has_small_component](const CandidateSegment &segment) {
[this, approach, &input_coordinate, &has_big_component, &has_small_component](
const CandidateSegment &segment) {
auto use_segment =
(!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
auto use_directions = std::make_pair(use_segment, use_segment);
const auto valid_edges = HasValidEdge(segment);
use_directions = boolPairAnd(use_directions, valid_edges);
use_directions = boolPairAnd(use_directions, approach_usage(input_coordinate, segment, approach));
use_directions = boolPairAnd(use_directions,
approach_usage(input_coordinate, segment, approach));
if (use_directions.first || use_directions.second)
{
@@ -274,15 +284,23 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
// Returns the nearest phantom node. If this phantom node is not from a big component
// a second phantom node is return that is the nearest coordinate in a big component.
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(
const util::Coordinate input_coordinate, const int bearing, const int bearing_range, const engine::Approach approach) const
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
const int bearing,
const int bearing_range,
const engine::Approach approach) const
{
bool has_small_component = false;
bool has_big_component = false;
auto results = rtree.Nearest(
input_coordinate,
[this, approach, &input_coordinate, bearing, bearing_range, &has_big_component, &has_small_component](
const CandidateSegment &segment) {
[this,
approach,
&input_coordinate,
bearing,
bearing_range,
&has_big_component,
&has_small_component](const CandidateSegment &segment) {
auto use_segment =
(!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
auto use_directions = std::make_pair(use_segment, use_segment);
@@ -293,8 +311,8 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
use_directions =
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
HasValidEdge(segment));
use_directions = boolPairAnd(use_directions,
approach_usage(input_coordinate, segment, approach));
use_directions = boolPairAnd(
use_directions, approach_usage(input_coordinate, segment, approach));
if (use_directions.first || use_directions.second)
{
@@ -332,8 +350,13 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
bool has_big_component = false;
auto results = rtree.Nearest(
input_coordinate,
[this, approach, &input_coordinate, bearing, bearing_range, &has_big_component, &has_small_component](
const CandidateSegment &segment) {
[this,
approach,
&input_coordinate,
bearing,
bearing_range,
&has_big_component,
&has_small_component](const CandidateSegment &segment) {
auto use_segment =
(!has_small_component || (!has_big_component && !IsTinyComponent(segment)));
auto use_directions = std::make_pair(use_segment, use_segment);
@@ -344,8 +367,8 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
use_directions =
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
HasValidEdge(segment));
use_directions = boolPairAnd(use_directions,
approach_usage(input_coordinate, segment, approach));
use_directions = boolPairAnd(
use_directions, approach_usage(input_coordinate, segment, approach));
if (use_directions.first || use_directions.second)
{
@@ -579,11 +602,11 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
}
std::pair<bool, bool> approach_usage(const util::Coordinate &input_coordinate,
const CandidateSegment &segment,
const engine::Approach approach) const
const CandidateSegment &segment,
const engine::Approach approach) const
{
bool isOnewaySegment = !(segment.data.forward_segment_id.enabled &&
segment.data.reverse_segment_id.enabled);
bool isOnewaySegment =
!(segment.data.forward_segment_id.enabled && segment.data.reverse_segment_id.enabled);
if (!isOnewaySegment && approach == CURB)
{
// Check the counter clockwise
@@ -596,7 +619,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
bool input_coordinate_is_at_right = !util::coordinate_calculation::isCCW(
coordinates[segment.data.u], coordinates[segment.data.v], input_coordinate);
if(datafacade.IsLeftHandDriving())
if (datafacade.IsLeftHandDriving())
input_coordinate_is_at_right = !input_coordinate_is_at_right;
return std::make_pair(input_coordinate_is_at_right, (!input_coordinate_is_at_right));
+9 -8
View File
@@ -149,8 +149,8 @@ class BasePlugin
}
else
{
phantom_nodes[i] =
facade.NearestPhantomNodesInRange(parameters.coordinates[i], radiuses[i], approach);
phantom_nodes[i] = facade.NearestPhantomNodesInRange(
parameters.coordinates[i], radiuses[i], approach);
}
}
@@ -212,13 +212,15 @@ class BasePlugin
{
if (use_radiuses && parameters.radiuses[i])
{
phantom_nodes[i] = facade.NearestPhantomNodes(
parameters.coordinates[i], number_of_results, *parameters.radiuses[i], approach);
phantom_nodes[i] = facade.NearestPhantomNodes(parameters.coordinates[i],
number_of_results,
*parameters.radiuses[i],
approach);
}
else
{
phantom_nodes[i] =
facade.NearestPhantomNodes(parameters.coordinates[i], number_of_results, approach);
phantom_nodes[i] = facade.NearestPhantomNodes(
parameters.coordinates[i], number_of_results, approach);
}
}
@@ -275,8 +277,7 @@ class BasePlugin
parameters.coordinates[i],
parameters.bearings[i]->bearing,
parameters.bearings[i]->range,
approach
);
approach);
}
}
else