-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: removed unused functionality and minor changes preparing next PR #1358
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,20 +87,6 @@ g_backtrack_warning_count++; | |
struct buffer_overlay_visitor | ||
{ | ||
public : | ||
void print(char const* /*header*/) | ||
{ | ||
} | ||
|
||
template <typename Turns> | ||
void print(char const* /*header*/, Turns const& /*turns*/, int /*turn_index*/) | ||
{ | ||
} | ||
|
||
template <typename Turns> | ||
void print(char const* /*header*/, Turns const& /*turns*/, int /*turn_index*/, int /*op_index*/) | ||
{ | ||
} | ||
|
||
template <typename Turns> | ||
void visit_turns(int , Turns const& ) {} | ||
|
||
|
@@ -170,26 +156,6 @@ struct buffer_turn_info | |
{} | ||
}; | ||
|
||
struct buffer_less | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was unused |
||
{ | ||
template <typename Indexed> | ||
inline bool operator()(Indexed const& left, Indexed const& right) const | ||
{ | ||
if (! (left.subject->seg_id == right.subject->seg_id)) | ||
{ | ||
return left.subject->seg_id < right.subject->seg_id; | ||
} | ||
|
||
// Both left and right are located on the SAME segment. | ||
if (! (left.subject->fraction == right.subject->fraction)) | ||
{ | ||
return left.subject->fraction < right.subject->fraction; | ||
} | ||
|
||
return left.turn_index < right.turn_index; | ||
} | ||
}; | ||
|
||
template <typename Strategy> | ||
struct piece_get_box | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,8 +104,7 @@ inline void enrich_sort(Operations& operations, | |
|
||
// Assign travel-to-vertex/ip index for each turn. | ||
template <typename Operations, typename Turns> | ||
inline void enrich_assign(Operations& operations, Turns& turns, | ||
bool check_consecutive_turns) | ||
inline void enrich_assign(Operations& operations, Turns& turns) | ||
{ | ||
for (auto const& item : util::enumerate(operations)) | ||
{ | ||
|
@@ -131,34 +130,6 @@ inline void enrich_assign(Operations& operations, Turns& turns, | |
return next_turn.operations[operations[next_index].operation_index]; | ||
}; | ||
|
||
if (check_consecutive_turns | ||
&& indexed.turn_index == operations[next_index].turn_index | ||
&& op.seg_id == next_operation().seg_id) | ||
{ | ||
// If the two operations on the same turn are ordered consecutively, | ||
// and they are on the same segment, then the turn where to travel to should | ||
// be considered one further. Therefore next is increased. | ||
// | ||
// It often happens in buffer, in these configurations: | ||
// +---->--+ | ||
// | | | ||
// | +->-*----> | ||
// | | | | ||
// ^ +-<-+ | ||
// If the next index is not corrected, the small rectangle | ||
// will be kept in the output. | ||
|
||
// This is a normal situation and occurs, for example, in every concave bend. | ||
// In general it should always travel from turn to next turn. | ||
// Only in some circumstances traveling to the same turn is necessary, for example | ||
// if there is only one turn in the outer ring. | ||
// | ||
// (For dissolve this is not done, turn_index is often | ||
// the same for two consecutive operations - but the conditions are changed | ||
// and this should be verified again) | ||
next_index = advance(next_index); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This functionality was active - but it is long obsolete and now handled in another way (and will change in next PR) |
||
} | ||
|
||
// Cluster behaviour: next should point after cluster, unless | ||
// their seg_ids are not the same | ||
// (For dissolve, this is still to be examined - TODO) | ||
|
@@ -285,36 +256,50 @@ struct enriched_map_default_include_policy | |
// Add all (non discarded) operations on this ring | ||
// Blocked operations or uu on clusters (for intersection) | ||
// should be included, to block potential paths in clusters | ||
template <typename Turns, typename MappedVector, typename IncludePolicy> | ||
inline void create_map(Turns const& turns, MappedVector& mapped_vector, | ||
IncludePolicy const& include_policy) | ||
template <typename Turns, typename IncludePolicy> | ||
inline auto create_map(Turns const& turns, IncludePolicy const& include_policy) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a modernization. |
||
{ | ||
using turn_type = typename boost::range_value<Turns>::type; | ||
using indexed_turn_operation = detail::overlay::indexed_turn_operation | ||
< | ||
typename turn_type::turn_operation_type | ||
>; | ||
|
||
std::map | ||
< | ||
ring_identifier, | ||
std::vector<indexed_turn_operation> | ||
> mapped_vector; | ||
|
||
for (auto const& turn_item : util::enumerate(turns)) | ||
{ | ||
auto const& index = turn_item.index; | ||
auto const& turn = turn_item.value; | ||
if (! turn.discarded) | ||
if (turn.discarded) | ||
{ | ||
for (auto const& op_item : util::enumerate(turn.operations)) | ||
continue; | ||
} | ||
|
||
for (auto const& op_item : util::enumerate(turn.operations)) | ||
{ | ||
auto const& op_index = op_item.index; | ||
auto const& op = op_item.value; | ||
if (include_policy.include(op.operation)) | ||
{ | ||
auto const& op_index = op_item.index; | ||
auto const& op = op_item.value; | ||
if (include_policy.include(op.operation)) | ||
{ | ||
ring_identifier const ring_id | ||
( | ||
op.seg_id.source_index, | ||
op.seg_id.multi_index, | ||
op.seg_id.ring_index | ||
); | ||
mapped_vector[ring_id].emplace_back | ||
( | ||
index, op_index, op, turn.operations[1 - op_index].seg_id | ||
); | ||
} | ||
ring_identifier const ring_id | ||
( | ||
op.seg_id.source_index, | ||
op.seg_id.multi_index, | ||
op.seg_id.ring_index | ||
); | ||
mapped_vector[ring_id].emplace_back | ||
( | ||
index, op_index, op, turn.operations[1 - op_index].seg_id | ||
); | ||
} | ||
} | ||
} | ||
return mapped_vector; | ||
} | ||
|
||
template <typename Point1, typename Point2> | ||
|
@@ -356,7 +341,6 @@ inline void calculate_remaining_distance(Turns& turns) | |
} | ||
} | ||
|
||
|
||
}} // namespace detail::overlay | ||
#endif //DOXYGEN_NO_DETAIL | ||
|
||
|
@@ -398,51 +382,14 @@ inline void enrich_intersection_points(Turns& turns, | |
? detail::overlay::operation_intersection | ||
: detail::overlay::operation_union; | ||
constexpr bool is_dissolve = OverlayType == overlay_dissolve; | ||
constexpr bool is_buffer = OverlayType == overlay_buffer; | ||
|
||
using turn_type = typename boost::range_value<Turns>::type; | ||
using indexed_turn_operation = detail::overlay::indexed_turn_operation | ||
< | ||
typename turn_type::turn_operation_type | ||
> ; | ||
|
||
using mapped_vector_type = std::map | ||
< | ||
ring_identifier, | ||
std::vector<indexed_turn_operation> | ||
>; | ||
|
||
// Turns are often used by index (in clusters, next_index, etc) | ||
// and turns may therefore NOT be DELETED - they may only be flagged as discarded | ||
|
||
bool has_cc = false; | ||
bool has_colocations = false; | ||
|
||
if BOOST_GEOMETRY_CONSTEXPR (! is_buffer) | ||
{ | ||
// Handle colocations, gathering clusters and (below) their properties. | ||
has_colocations = detail::overlay::handle_colocations | ||
< | ||
Reverse1, Reverse2, OverlayType, Geometry1, Geometry2 | ||
>(turns, clusters); | ||
// Gather cluster properties (using even clusters with | ||
// discarded turns - for open turns) | ||
detail::overlay::gather_cluster_properties | ||
< | ||
Reverse1, | ||
Reverse2, | ||
OverlayType | ||
>(clusters, turns, target_operation, | ||
geometry1, geometry2, strategy); | ||
} | ||
else | ||
{ | ||
// For buffer, this was already done before calling enrich_intersection_points. | ||
has_colocations = ! clusters.empty(); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should now be called before, by the caller. |
||
discard_duplicate_turns(turns, geometry1, geometry2); | ||
|
||
bool has_cc = false; | ||
|
||
// Discard turns not part of target overlay | ||
for (auto& turn : turns) | ||
{ | ||
|
@@ -491,11 +438,15 @@ inline void enrich_intersection_points(Turns& turns, | |
strategy); | ||
} | ||
|
||
if (! clusters.empty()) | ||
{ | ||
detail::overlay::cleanup_clusters(turns, clusters); | ||
detail::overlay::colocate_clusters(clusters, turns); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now called before |
||
|
||
// Create a map of vectors of indexed operation-types to be able | ||
// to sort intersection points PER RING | ||
mapped_vector_type mapped_vector; | ||
|
||
detail::overlay::create_map(turns, mapped_vector, | ||
auto mapped_vector = detail::overlay::create_map(turns, | ||
detail::overlay::enriched_map_default_include_policy()); | ||
|
||
for (auto& pair : mapped_vector) | ||
|
@@ -506,14 +457,6 @@ inline void enrich_intersection_points(Turns& turns, | |
strategy); | ||
} | ||
|
||
if (has_colocations) | ||
{ | ||
detail::overlay::cleanup_clusters(turns, clusters); | ||
detail::overlay::colocate_clusters(clusters, turns); | ||
} | ||
|
||
// After cleaning up clusters assign the next turns | ||
|
||
for (auto& pair : mapped_vector) | ||
{ | ||
#ifdef BOOST_GEOMETRY_DEBUG_ENRICH | ||
|
@@ -524,7 +467,7 @@ inline void enrich_intersection_points(Turns& turns, | |
detail::overlay::enrich_adapt(pair.second, turns); | ||
} | ||
|
||
detail::overlay::enrich_assign(pair.second, turns, ! is_dissolve); | ||
detail::overlay::enrich_assign(pair.second, turns); | ||
} | ||
|
||
if (has_cc) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -364,23 +364,6 @@ inline bool handle_colocations(Turns& turns, Clusters& clusters) | |
return true; | ||
} | ||
|
||
|
||
struct is_turn_index | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was unused |
||
{ | ||
is_turn_index(signed_size_type index) | ||
: m_index(index) | ||
{} | ||
|
||
template <typename Indexed> | ||
inline bool operator()(Indexed const& indexed) const | ||
{ | ||
// Indexed is a indexed_turn_operation<Operation> | ||
return indexed.turn_index == m_index; | ||
} | ||
|
||
signed_size_type m_index; | ||
}; | ||
|
||
template | ||
< | ||
typename Sbs, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,6 @@ struct indexed_turn_operation | |
|
||
std::size_t turn_index; | ||
std::size_t operation_index; | ||
bool skip; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was unused |
||
// use pointers to avoid copies, const& is not possible because of usage in vector | ||
segment_identifier const* other_seg_id; // segment id of other segment of intersection of two segments | ||
TurnOperation const* subject; | ||
|
@@ -53,7 +52,6 @@ struct indexed_turn_operation | |
segment_identifier const& oid) | ||
: turn_index(ti) | ||
, operation_index(oi) | ||
, skip(false) | ||
, other_seg_id(&oid) | ||
, subject(boost::addressof(sub)) | ||
{} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 3 print functions were long gone and are not called anymore