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:
|
private:
|
||||||
void convert_polygon(const Input_polygon& input, Output_polygon& out) const {
|
void convert_polygon(const Input_polygon& input, Output_polygon& out) const {
|
||||||
for (typename Input_polygon::Curve_const_iterator it = input.curves_begin();
|
for (auto cit = input.curves_begin(); cit != input.curves_end(); ++cit) {
|
||||||
it != input.curves_end(); ++ it)
|
auto end = cit->points_end();
|
||||||
{
|
// Skip last point, which is a duplication of the first point
|
||||||
// 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();
|
|
||||||
--end;
|
--end;
|
||||||
for (typename Input_polygon::X_monotone_curve_2::Point_const_iterator
|
for (auto pit = cit->points_begin(); pit != end; ++pit)
|
||||||
it2 = it->points_begin(); it2 != end; ++ it2)
|
out.push_back(*pit);
|
||||||
out.push_back (*it2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -161,31 +157,38 @@ struct Polygon_converter_output_iterator :
|
||||||
|
|
||||||
OutputIterator& output;
|
OutputIterator& output;
|
||||||
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; }
|
operator OutputIterator() const { return output; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// THIS IS A TEMPORARY PLACE HOLDER AND SHOULD BE REMOVED
|
|
||||||
// Convert General_polygon_2<Polyline_traits> to Polygon_2
|
// Convert General_polygon_2<Polyline_traits> to Polygon_2
|
||||||
template <typename Kernel, typename Container, typename ArrTraits>
|
template <typename Kernel, typename Container, typename ArrTraits>
|
||||||
Polygon_2<Kernel, Container>
|
Polygon_2<Kernel, Container>
|
||||||
convert_polygon_back(const General_polygon_2<ArrTraits>& pgn)
|
convert_polygon_back(const General_polygon_2<ArrTraits>& gpgn) {
|
||||||
{
|
Polygon_2<Kernel, Container> pgn;
|
||||||
Polygon_2<Kernel, Container> tmp;
|
for (auto cit = gpgn.curves_begin(); cit != gpgn.curves_end(); ++cit) {
|
||||||
return tmp;
|
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
|
// Convert General_polygon_with_holes_2<Polyline_traits> to Polygon_with_holes_2
|
||||||
template <typename Kernel, typename Container, typename ArrTraits>
|
template <typename Kernel, typename Container, typename ArrTraits>
|
||||||
Polygon_with_holes_2<Kernel, Container>
|
Polygon_with_holes_2<Kernel, Container>
|
||||||
convert_polygon_back(const General_polygon_with_holes_2
|
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;
|
std::vector<Polygon_2<Kernel, Container>> holes;
|
||||||
return tmp;
|
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
|
// Converts General_polygon_with_holes_2<Polyline_traits> to
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue