mirror of https://github.com/CGAL/cgal
Reinstated back conversions
This commit is contained in:
parent
1683b8d39c
commit
8fa117bcc6
|
|
@ -136,16 +136,12 @@ struct Polygon_converter {
|
|||
|
||||
private:
|
||||
void convert_polygon(const Input_polygon& input, Output_polygon& out) const {
|
||||
for (typename Input_polygon::Curve_const_iterator it = input.curves_begin();
|
||||
it != input.curves_end(); ++ it)
|
||||
{
|
||||
// Skip last point which is the repetition of the first point
|
||||
typename Input_polygon::X_monotone_curve_2::Point_const_iterator
|
||||
end = it->points_end();
|
||||
for (auto cit = input.curves_begin(); cit != input.curves_end(); ++cit) {
|
||||
auto end = cit->points_end();
|
||||
// Skip last point, which is a duplication of the first point
|
||||
--end;
|
||||
for (typename Input_polygon::X_monotone_curve_2::Point_const_iterator
|
||||
it2 = it->points_begin(); it2 != end; ++ it2)
|
||||
out.push_back (*it2);
|
||||
for (auto pit = cit->points_begin(); pit != end; ++pit)
|
||||
out.push_back(*pit);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -161,31 +157,38 @@ struct Polygon_converter_output_iterator :
|
|||
|
||||
OutputIterator& output;
|
||||
Polygon_converter_output_iterator(OutputIterator& output) :
|
||||
Base(output), output(output)
|
||||
Base(output),
|
||||
output(output)
|
||||
{}
|
||||
|
||||
operator OutputIterator() const { return output; }
|
||||
};
|
||||
|
||||
// THIS IS A TEMPORARY PLACE HOLDER AND SHOULD BE REMOVED
|
||||
// Convert General_polygon_2<Polyline_traits> to Polygon_2
|
||||
template <typename Kernel, typename Container, typename ArrTraits>
|
||||
Polygon_2<Kernel, Container>
|
||||
convert_polygon_back(const General_polygon_2<ArrTraits>& pgn)
|
||||
{
|
||||
Polygon_2<Kernel, Container> tmp;
|
||||
return tmp;
|
||||
convert_polygon_back(const General_polygon_2<ArrTraits>& gpgn) {
|
||||
Polygon_2<Kernel, Container> pgn;
|
||||
for (auto cit = gpgn.curves_begin(); cit != gpgn.curves_end(); ++cit) {
|
||||
auto end = cit->points_end();
|
||||
--end; // skip last point, which is a duplication of the first point
|
||||
for (auto pit = cit->points_begin(); pit != end; ++pit) pgn.push_back(*pit);
|
||||
}
|
||||
return pgn;
|
||||
}
|
||||
|
||||
// THIS IS A TEMPORARY PLACE HOLDER AND SHOULD BE REMOVED
|
||||
// Convert General_polygon_with_holes_2<Polyline_traits> to Polygon_with_holes_2
|
||||
template <typename Kernel, typename Container, typename ArrTraits>
|
||||
Polygon_with_holes_2<Kernel, Container>
|
||||
convert_polygon_back(const General_polygon_with_holes_2
|
||||
<General_polygon_2<ArrTraits> >& pwh)
|
||||
<General_polygon_2<ArrTraits> >& gpwh)
|
||||
{
|
||||
Polygon_with_holes_2<Kernel, Container> tmp;
|
||||
return tmp;
|
||||
std::vector<Polygon_2<Kernel, Container>> holes;
|
||||
for (const auto& gh : gpwh.holes())
|
||||
holes.emplace_back(convert_polygon_back<Kernel, Container>(gh));
|
||||
return Polygon_with_holes_2<Kernel, Container>
|
||||
(convert_polygon_back<Kernel, Container>(gpwh.outer_boundary()),
|
||||
holes.begin(), holes.end());
|
||||
}
|
||||
|
||||
// Converts General_polygon_with_holes_2<Polyline_traits> to
|
||||
|
|
|
|||
Loading…
Reference in New Issue