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
Add DynamicGeometry and GeometryCollection. #850
Conversation
…t in several algorithms. Also add basic support for GeometryCollection.
Replace variant support in wkt write. Add util::sequence_find_if.
include/boost/geometry/algorithms/detail/disjoint/interface.hpp
Outdated
Show resolved
Hide resolved
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.
I've skimmed the code trying to understand the core parts and nothing looks suspicious.
Nice feature!
@mloskot Thanks for the review! The thing that I don't like about it is the fact that Do you think that rvalue references should be handled in visit too? Do you think visit should be able to return a value? |
My C++ is getting rusty, but it generally should be feasible (https://stackoverflow.com/q/24687026/151641 or https://bitbashing.io/std-visit.html), but I'm sure you've looked at the variadics.
I think it is generally a good idea to keep interfaces aligned with the standard stuff, i.e. similar to I wish I could be more helpful, but can't afford any experiments on my own right now. |
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.
Thanks a lot!
I think at least some of the TODO
's should be done, or rephrased, and some commented code can go or be uncommented, so I set this to Request changes
for now, but apart from that, I'm fine.
include/boost/geometry/algorithms/detail/disjoint/interface.hpp
Outdated
Show resolved
Hide resolved
Add support for rvalue references in visit traits and algorithms. Move visit algorithms to detail namespace. Rename visit_iterator trait to iter_visit. Add tests for visit traits and algorithms. Remove unneeded comments.
Remove unneeded comments. Replace typedef with using. Change names and formatting.
@mloskot I added support for rvalue references because it is possible we'll want to move something inside visit. I didn't implement returning values though because:
So I don't think it's worth it only to be able to save 2 lines of code now and then. |
Add concepts::concept_type<> utility for generic concept definitions. Replace tag dispatching in concepts::check() with concepts::concept_type<>.
@barendgehrels I made the PR more complete. I added the list of changes in the description. |
…the compiler. Variadic templates can be disabled in Boost.Variant by defining BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES. Also support DG and GC in: - comparable_distance_result - default_length_result - distance_result
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.
Thanks!
Add missing curly braces. Remove unneeded comments.
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.
Thanks and sorry for late reviewing, I am OK for merging.
Thanks for the reviews! |
After: #843
This PR adds DynamicGeometry and GeometryCollection and usage in several algorithms.
List of changes:
traits::tag<>
definingtype
asdynamic_geometry_tag
traits::visit<>
traits::geometry_types<>
traits::visit<>
traits::geometry_types<>
traits::tag<>
definingtype
asgeometry_collection_tag
traits::geometry_types<>
(by default usingtraits::geometry_types<>
forrange_value<>::type
)traits::iter_visit<>
(by default callingtraits::visit<>
forrange_value<>::type
)traits::emplace_back<>
allowing to add objects of types specified intraits::geometry_types<>
traits::clear<>
(by default callingcollection.clear()
)boost::variant<>
boost::variant2::variant<>
boost::any<>
(requires additional user specialization oftraits::geometry_types<>
)std::variant<>
std::any<>
(requires additional user specialization oftraits::geometry_types<>
)model::geometry_collection<>
concepts::concept_type<>
defining concept of Geometry in a generic wayconcepts::check()
, dispatches replaced withconcepts::concept_type<>
detail::visit()
detail::visit_breadth_first()
append()
(only DynamicGeometry)area()
clear()
disjoint()
(the algorithm for 2 GeometryCollections has quadratic complexity so should probably be refactored)length()
read_wkt()
wkt()
comparable_distance_result<>
distance_result<>
value_type
intraits::push_back
andrange::push_back
to support move semantics (the support for rvalue reference for the Range itself should still be added in a different PR)boost::variant
workarounds previously implemented for VS2015 now works with all compilers#ifdef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
(in various algorithms)I'm open to suggestions.