diff --git a/Stream_support/include/CGAL/IO/Generic_writer.h b/Stream_support/include/CGAL/IO/Generic_writer.h index d707587e2fd..3412143f842 100644 --- a/Stream_support/include/CGAL/IO/Generic_writer.h +++ b/Stream_support/include/CGAL/IO/Generic_writer.h @@ -34,10 +34,12 @@ public: Generic_writer(Stream& out) : m_out(out) { } Generic_writer(Stream& out, FileWriter writer) : m_out(out), m_writer(writer) { } - template - bool operator()(const std::vector& points, - const std::vector& polygons) + template + bool operator()(const PointRange_3& points, + const PolygonRange_3& polygons) { + typedef typename PointRange_3::value_type Point_3; + typedef typename PolygonRange_3::value_type Polygon_3; if(m_out.fail()) return false; diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index 385364a732b..963e2efba62 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -110,7 +110,7 @@ bool read_OFF(std::istream& is, if(!is.good()) return false; - IO::internal::resize(polygons[i], no); + CGAL::internal::resize(polygons[i], no); for(std::size_t j=0; j +//HEdgesRange" = range of std::pair +//HUVRange = range of std::pair +template bool read_PLY(std::istream& is, - std::vector& points, - std::vector& polygons, - std::vector >& hedges, - std::vector& fcolors, - std::vector& vcolors, - std::vector >& huvs, + PointRange& points, + PolygonRange& polygons, + HEdgesRange& hedges, + ColorRange& fcolors, + ColorRange& vcolors, + HUVRange& huvs, bool /* verbose */ = false) { + typedef typename PointRange::value_type Point_3; + typedef typename ColorRange::value_type Color_rgb; if(!is.good()) { std::cerr << "Error: cannot open file" << std::endl; @@ -181,18 +184,19 @@ bool read_PLY(std::istream& is, return !is.fail(); } -template +template bool read_PLY(std::istream& is, - std::vector& points, - std::vector& polygons, - std::vector& fcolors, - std::vector& vcolors, + PointRange& points, + PolygonRange& polygons, + ColorRange& fcolors, + ColorRange& vcolors, bool /* verbose */ = false) { + std::vector > dummy_pui; std::vector > dummy_pf; - return read_PLY(is, points, polygons, dummy_pui, fcolors, vcolors, dummy_pf); + return read_PLY(is, points, polygons, dummy_pui, fcolors, vcolors, dummy_pf); } /*! @@ -200,15 +204,22 @@ bool read_PLY(std::istream& is, * * reads the content of `is` into `points` and `polygons`, in the PLY format. * + * `PointRange` is a model of the concepts `RandomAccessContainer` + * and `BackInsertionSequence` whose `value type` is a `CGAL::Point_3`. + * + * `PolygonRange` is a model of the concepts `RandomAccessContainer` + * and `BackInsertionSequence` whose `value type` is `std::size_t`. + * * \see \ref IOStreamPLY */ -template +template bool read_PLY(std::istream& is, - std::vector& points, - std::vector& polygons, + PointRange& points, + PolygonRange& polygons, bool /* verbose */ = false) { + typedef typename PointRange::value_type Point_3; if(!is.good()) { std::cerr << "Error: cannot open file" << std::endl; @@ -294,13 +305,21 @@ read_PLY(std::istream& is, * * writes the content of `points` and `polygons` in `out`, in the OFF format. * + * `PointRange` is a model of the concepts `RandomAccessContainer` + * and `BackInsertionSequence` whose `value type` is a `CGAL::Point_3`. + * + * `PolygonRange` is a model of the concepts `RandomAccessContainer` + * and `BackInsertionSequence` whose `value type` is `std::size_t`. * \see \ref IOStreamOFF */ -template +template bool write_PLY(std::ostream& out, - const std::vector& points, - const std::vector& polygons) + const PointRange& points, + const PolygonRange& polygons) { + + typedef typename PointRange::value_type Point_3; + typedef typename PolygonRange::value_type Polygon_3; if(!out.good()) { std::cerr << "Error: cannot open file" << std::endl; diff --git a/Stream_support/include/CGAL/IO/PLY/PLY_reader.h b/Stream_support/include/CGAL/IO/PLY/PLY_reader.h index 50ae7b13411..4d8b44e8f26 100644 --- a/Stream_support/include/CGAL/IO/PLY/PLY_reader.h +++ b/Stream_support/include/CGAL/IO/PLY/PLY_reader.h @@ -673,13 +673,15 @@ void process_properties(PLY_element& element, OutputValueType& new_element, std::forward(properties)...); } -template +template bool read_PLY_faces(std::istream& in, IO::internal::PLY_element& element, - std::vector< Polygon_3 >& polygons, - std::vector< Color_rgb >& fcolors, + PolygonRange& polygons, + ColorRange& fcolors, const char* vertex_indices_tag) { + typedef typename PolygonRange::value_type Polygon_3; + typedef typename ColorRange::value_type Color_rgb; bool has_colors = false; std::string rtag = "r", gtag = "g", btag = "b"; diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index bc93a3b0d1b..be3bed95b28 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -170,7 +170,7 @@ std::ostream& write_STL(std::ostream& out, const PointRange& points, const TriangleRange& facets) { - typedef typename boost::range_value::type Triangle; + typedef typename boost::range_value::type Triangle; typedef typename boost::range_value::type Point; typedef typename CGAL::Kernel_traits::Kernel K; typedef typename K::Vector_3 Vector_3; diff --git a/Stream_support/include/CGAL/IO/STL/STL_reader.h b/Stream_support/include/CGAL/IO/STL/STL_reader.h index 5112cd1e8a0..b8072e83ae9 100644 --- a/Stream_support/include/CGAL/IO/STL/STL_reader.h +++ b/Stream_support/include/CGAL/IO/STL/STL_reader.h @@ -49,7 +49,7 @@ bool read_ASCII_facet(std::istream& is, double x,y,z; Point p; Triangle ijk; - IO::internal::resize(ijk, 3); + CGAL::internal::resize(ijk, 3); while(is >> s) { @@ -236,7 +236,7 @@ bool parse_binary_STL(std::istream& is, } Triangle ijk; - IO::internal::resize(ijk, 3); + CGAL::internal::resize(ijk, 3); for(int j=0; j<3; ++j) { diff --git a/Stream_support/test/Stream_support/test_3mf_to_sm.cpp b/Stream_support/test/Stream_support/test_3mf_to_sm.cpp index e2602eacf0c..f76f522718f 100644 --- a/Stream_support/test/Stream_support/test_3mf_to_sm.cpp +++ b/Stream_support/test/Stream_support/test_3mf_to_sm.cpp @@ -30,6 +30,7 @@ typedef std::vector ColorRange; int main(int argc, char** argv) { + #ifdef CGAL_LINKED_WITH_3MF const char* file_name=(argc == 2) ? argv[1] : "data/test.3mf"; std::vector all_points; @@ -130,6 +131,7 @@ int main(int argc, char** argv) CGAL::write_triangle_meshes_to_3mf("meshes.3mf", meshes, names); std::cout<<"OK."< -#include +#include #include typedef CGAL::Simple_cartesian Kernel;