Merge remote-tracking branch 'cgal/master' into CGAL-Clang_tidy_new_pass-maxGimeno

This commit is contained in:
Maxime Gimeno 2021-05-21 14:04:07 +02:00
commit ab182dd46a
870 changed files with 5172 additions and 4105 deletions

View File

@ -65,6 +65,7 @@ jobs:
mkdir -p build_doc && cd build_doc && cmake ../Documentation/doc mkdir -p build_doc && cd build_doc && cmake ../Documentation/doc
- name: Build and Upload Doc - name: Build and Upload Doc
id: build_and_run
if: steps.get_round.outputs.result != 'stop' if: steps.get_round.outputs.result != 'stop'
run: | run: |
set -ex set -ex
@ -77,7 +78,13 @@ jobs:
if [ "$LIST_OF_PKGS" = "" ]; then if [ "$LIST_OF_PKGS" = "" ]; then
exit 1 exit 1
fi fi
cd build_doc && make -j2 doc && make -j2 doc_with_postprocessing cd build_doc && make -j2 doc
make -j2 doc_with_postprocessing 2>tmp.log
if [ -s tmp.log ]; then
content=`cat ./build_doc/tmp.log`
echo ::set-output name=DoxygenError::$(cat tmp.log)
exit 1
fi
cd .. cd ..
git clone https://CGAL:${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}@github.com/CGAL/cgal.github.io.git git clone https://CGAL:${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}@github.com/CGAL/cgal.github.io.git
mkdir -p cgal.github.io/${PR_NUMBER}/$ROUND mkdir -p cgal.github.io/${PR_NUMBER}/$ROUND
@ -99,7 +106,7 @@ jobs:
- name: Post address - name: Post address
uses: actions/github-script@v3 uses: actions/github-script@v3
if: steps.get_round.outputs.result != 'stop' if: ${{ success() && steps.get_round.outputs.result != 'stop' }}
with: with:
script: | script: |
const address = "The documentation is built. It will be available, after a few minutes, here : https://cgal.github.io/${{ steps.get_pr_number.outputs.result }}/${{ steps.get_round.outputs.result }}/Manual/index.html" const address = "The documentation is built. It will be available, after a few minutes, here : https://cgal.github.io/${{ steps.get_pr_number.outputs.result }}/${{ steps.get_round.outputs.result }}/Manual/index.html"
@ -109,3 +116,17 @@ jobs:
issue_number: ${{ github.event.issue.number }}, issue_number: ${{ github.event.issue.number }},
body: address body: address
}); });
- name: Post error
uses: actions/github-script@v3
if: ${{ failure() && steps.get_round.outputs.result != 'stop' }}
with:
script: |
const error = "${{steps.build_and_run.outputs.DoxygenError}}"
const msg = "There was an error while building the doc: \n"+error
github.issues.createComment({
owner: "CGAL",
repo: "cgal",
issue_number: ${{ github.event.issue.number }},
body: msg
});

View File

@ -27,7 +27,7 @@ void triangle_mesh(const char* fname)
typedef CGAL::AABB_tree<Traits> Tree; typedef CGAL::AABB_tree<Traits> Tree;
TriangleMesh tmesh; TriangleMesh tmesh;
if(!CGAL::read_polygon_mesh(fname, tmesh) || CGAL::is_triangle_mesh(tmesh)) if(!CGAL::IO::read_polygon_mesh(fname, tmesh) || CGAL::is_triangle_mesh(tmesh))
{ {
std::cerr << "Invalid input." << std::endl; std::cerr << "Invalid input." << std::endl;
return; return;

View File

@ -47,7 +47,7 @@ int main(int argc, char* argv[])
const char* filename = (argc > 1) ? argv[1] : "data/tetrahedron.off"; const char* filename = (argc > 1) ? argv[1] : "data/tetrahedron.off";
Mesh mesh; Mesh mesh;
if(!CGAL::read_polygon_mesh(filename, mesh)) if(!CGAL::IO::read_polygon_mesh(filename, mesh))
{ {
std::cerr << "Invalid input." << std::endl; std::cerr << "Invalid input." << std::endl;
return 1; return 1;

View File

@ -114,9 +114,9 @@ int main (int argc, char* argv[])
const char* fname = (argc>1) ? argv[1] : "data/cube.pwn"; const char* fname = (argc>1) ? argv[1] : "data/cube.pwn";
// Loading point set from a file. // Loading point set from a file.
if (!CGAL::read_points(fname, std::back_inserter(points), if (!CGAL::IO::read_points(fname, std::back_inserter(points),
CGAL::parameters::point_map(Point_map()). CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map()))) normal_map(Normal_map())))
{ {
std::cerr << "Error: cannot read file" << std::endl; std::cerr << "Error: cannot read file" << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -17,7 +17,7 @@ int main(){
CGAL::Gmpq fraction(4,5); CGAL::Gmpq fraction(4,5);
FT::Decompose()(fraction,numerator,denominator); FT::Decompose()(fraction,numerator,denominator);
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
std::cout << "decompose fraction: "<< std::endl; std::cout << "decompose fraction: "<< std::endl;
std::cout << "fraction : " << fraction << std::endl; std::cout << "fraction : " << fraction << std::endl;
std::cout << "numerator : " << numerator<< std::endl; std::cout << "numerator : " << numerator<< std::endl;

View File

@ -31,7 +31,7 @@ binary_func(const A& a , const B& b){
} }
int main(){ int main(){
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
// Function call for ImplicitInteroperable types // Function call for ImplicitInteroperable types
std::cout<< binary_func(double(3), int(5)) << std::endl; std::cout<< binary_func(double(3), int(5)) << std::endl;

View File

@ -56,9 +56,9 @@ public:
Output_rep(const T& tt) : t(tt) {} Output_rep(const T& tt) : t(tt) {}
std::ostream& operator () (std::ostream& out) const { std::ostream& operator () (std::ostream& out) const {
if ( needs_parens_as_product(t)) { if ( needs_parens_as_product(t)) {
return out << "(" << oformat(t) << ")"; return out << "(" << IO::oformat(t) << ")";
} else { } else {
return out << oformat(t); return out << IO::oformat(t);
} }
} }
}; };

View File

@ -303,19 +303,21 @@ to_interval( const Real_embeddable& x) {
} }
template <typename NT> template <typename NT>
NT approximate_sqrt(const NT& nt, CGAL::Null_functor) typename Coercion_traits<double, NT>::Type
approximate_sqrt(const NT& x, CGAL::Null_functor)
{ {
return NT(sqrt(CGAL::to_double(nt))); return sqrt(CGAL::to_double(x));
} }
template <typename NT, typename Sqrt> template <typename NT, typename Sqrt>
NT approximate_sqrt(const NT& nt, Sqrt sqrt) typename Sqrt::result_type
approximate_sqrt(const NT& nt, Sqrt sqrt)
{ {
return sqrt(nt); return sqrt(nt);
} }
template <typename NT> template <typename NT>
NT approximate_sqrt(const NT& nt) decltype(auto) approximate_sqrt(const NT& nt)
{ {
// the initial version of this function was using Algebraic_category // the initial version of this function was using Algebraic_category
// for the dispatch but some ring type (like Gmpz) provides a Sqrt // for the dispatch but some ring type (like Gmpz) provides a Sqrt

View File

@ -49,7 +49,7 @@
#include <CGAL/tss.h> #include <CGAL/tss.h>
#include <boost/shared_ptr.hpp> #include <memory>
namespace CGAL { namespace CGAL {
@ -393,8 +393,8 @@ public:
Algebraic_curve_kernel_2() Algebraic_curve_kernel_2()
: _m_gcd_cache_2(new Gcd_cache_2()) : _m_gcd_cache_2(new Gcd_cache_2())
{ {
_m_curve_cache_2 = boost::shared_ptr<Curve_cache_2>(new Curve_cache_2(this)); _m_curve_cache_2 = std::shared_ptr<Curve_cache_2>(new Curve_cache_2(this));
_m_curve_pair_cache_2 = boost::shared_ptr<Curve_pair_cache_2> (new Curve_pair_cache_2(this)); _m_curve_pair_cache_2 = std::shared_ptr<Curve_pair_cache_2> (new Curve_pair_cache_2(this));
// std::cout << "CONSTRUCTION Algebraic_curve_kernel_2 " << std::endl; // std::cout << "CONSTRUCTION Algebraic_curve_kernel_2 " << std::endl;
} }
@ -2766,9 +2766,9 @@ public:
protected: protected:
mutable boost::shared_ptr<Curve_cache_2> _m_curve_cache_2; mutable std::shared_ptr<Curve_cache_2> _m_curve_cache_2;
mutable boost::shared_ptr<Curve_pair_cache_2> _m_curve_pair_cache_2; mutable std::shared_ptr<Curve_pair_cache_2> _m_curve_pair_cache_2;
mutable boost::shared_ptr<Gcd_cache_2> _m_gcd_cache_2; mutable std::shared_ptr<Gcd_cache_2> _m_gcd_cache_2;
}; // class Algebraic_curve_kernel_2 }; // class Algebraic_curve_kernel_2

View File

@ -436,8 +436,8 @@ std::ostream&
operator << (std::ostream& os, operator << (std::ostream& os,
const CGAL::internal::Algebraic_real_d_1<Coefficient, Rational, HandlePolicy, RepClass >& x){ const CGAL::internal::Algebraic_real_d_1<Coefficient, Rational, HandlePolicy, RepClass >& x){
os << "[" << x.polynomial() os << "[" << x.polynomial()
<< ",[" << oformat(x.low()) << ",[" << IO::oformat(x.low())
<< " , " << oformat(x.high()) << " ]]"; << " , " << IO::oformat(x.high()) << " ]]";
return os; return os;
} }
@ -458,9 +458,9 @@ operator >> (std::istream& is,
is >> poly; is >> poly;
swallow(is, ',');// read the "," swallow(is, ',');// read the ","
swallow(is, '[');// read the "," swallow(is, '[');// read the ","
is >> iformat(low); is >> IO::iformat(low);
swallow(is, ',');// read the "," swallow(is, ',');// read the ","
is >> iformat(high); is >> IO::iformat(high);
swallow(is, ']');// read the "]" swallow(is, ']');// read the "]"
swallow(is, ']');// read the "]" swallow(is, ']');// read the "]"
x = ALGNUM(poly, low, high); x = ALGNUM(poly, low, high);

View File

@ -2417,7 +2417,7 @@ std::ostream& operator<< (
typedef typename Curve::Asymptote_y Asymptote_y; typedef typename Curve::Asymptote_y Asymptote_y;
switch (::CGAL::get_mode(out)) { switch (::CGAL::IO::get_mode(out)) {
case ::CGAL::IO::PRETTY: { case ::CGAL::IO::PRETTY: {
out << "--------------- Analysis results ---------------" << std::endl; out << "--------------- Analysis results ---------------" << std::endl;
@ -2514,7 +2514,7 @@ std::istream& operator>> (
std::istream& is, std::istream& is,
Curve_analysis_2< AlgebraicKernelWithAnalysis_2, Rep_ >& curve) { Curve_analysis_2< AlgebraicKernelWithAnalysis_2, Rep_ >& curve) {
CGAL_precondition(CGAL::is_ascii(is)); CGAL_precondition(CGAL::IO::is_ascii(is));
typedef AlgebraicKernelWithAnalysis_2 Algebraic_kernel_with_analysis_2; typedef AlgebraicKernelWithAnalysis_2 Algebraic_kernel_with_analysis_2;

View File

@ -441,7 +441,7 @@ protected:
} }
/* /*
#if CGAL_ACK_DEBUG_FLAG #if CGAL_ACK_DEBUG_FLAG
::CGAL::set_ascii_mode(CGAL_ACK_DEBUG_PRINT); ::CGAL::IO::set_ascii_mode(CGAL_ACK_DEBUG_PRINT);
CGAL_ACK_DEBUG_PRINT << "Stha: " << (*seq_it) << std::endl; CGAL_ACK_DEBUG_PRINT << "Stha: " << (*seq_it) << std::endl;
#endif #endif
*/ */

View File

@ -675,7 +675,7 @@ template < class AlgebraicCurveKernel_2, class Rep>
std::ostream& operator<< (std::ostream& os, std::ostream& operator<< (std::ostream& os,
const Xy_coordinate_2<AlgebraicCurveKernel_2, Rep>& pt) const Xy_coordinate_2<AlgebraicCurveKernel_2, Rep>& pt)
{ {
switch (::CGAL::get_mode(os)) { switch (::CGAL::IO::get_mode(os)) {
case ::CGAL::IO::PRETTY: { case ::CGAL::IO::PRETTY: {
os << "[x-coord: " << CGAL::to_double(pt.x()) << "; curve: " << os << "[x-coord: " << CGAL::to_double(pt.x()) << "; curve: " <<
pt.curve().polynomial_2() << pt.curve().polynomial_2() <<
@ -703,7 +703,7 @@ std::istream& operator >> (
std::istream& is, std::istream& is,
Xy_coordinate_2< AlgebraicCurveKernel_2, Rep_>& pt) { Xy_coordinate_2< AlgebraicCurveKernel_2, Rep_>& pt) {
CGAL_precondition(CGAL::is_ascii(is)); CGAL_precondition(CGAL::IO::is_ascii(is));
// this instance's first template argument // this instance's first template argument
typedef AlgebraicCurveKernel_2 Algebraic_curve_kernel_2; typedef AlgebraicCurveKernel_2 Algebraic_curve_kernel_2;

View File

@ -162,7 +162,7 @@ template<typename Arithmetic_kernel> void test_routine() {
CGAL_ACK_DEBUG_PRINT << "P[3(0,P[2(0,-2)(2,2)])(1,P[1(1,-1)])(3,P[1(1,-6)])]" << std::endl; CGAL_ACK_DEBUG_PRINT << "P[3(0,P[2(0,-2)(2,2)])(1,P[1(1,-1)])(3,P[1(1,-6)])]" << std::endl;
#endif #endif
f=from_string<Poly_int2>("P[3(0,P[2(0,-2)(2,2)])(1,P[1(1,-1)])(3,P[1(1,-6)])]"); f=from_string<Poly_int2>("P[3(0,P[2(0,-2)(2,2)])(1,P[1(1,-1)])(3,P[1(1,-6)])]");
::CGAL::set_pretty_mode(std::cout); ::CGAL::IO::set_pretty_mode(std::cout);
curve=construct_curve_2(f); curve=construct_curve_2(f);
assert(curve.number_of_status_lines_with_event()==1); assert(curve.number_of_status_lines_with_event()==1);
assert(number_of_objects<Algebraic_kernel_d_2>(curve)==2); assert(number_of_objects<Algebraic_kernel_d_2>(curve)==2);

View File

@ -92,7 +92,7 @@ void test_algebraic_curve_kernel_2() {
Poly_2 polys[ACK_2_n_polys]; Poly_2 polys[ACK_2_n_polys];
::CGAL::set_mode(std::cerr, ::CGAL::IO::PRETTY); ::CGAL::IO::set_mode(std::cerr, ::CGAL::IO::PRETTY);
//std::cerr << "constructing curves..\n"; //std::cerr << "constructing curves..\n";
for(int i = 0; i < ACK_2_n_polys; i++) { for(int i = 0; i < ACK_2_n_polys; i++) {

View File

@ -291,7 +291,7 @@ void test_algebraic_kernel_1(const AlgebraicKernel_d_1& ak_1){
assert(compare_1(bound,Algebraic_real_1(2)) == SMALLER ); assert(compare_1(bound,Algebraic_real_1(2)) == SMALLER );
} }
CGAL::set_pretty_mode(std::cerr); CGAL::IO::set_pretty_mode(std::cerr);
// Approximations // Approximations
bool all_right = true; bool all_right = true;
@ -408,13 +408,13 @@ void test_algebraic_kernel_1(const AlgebraicKernel_d_1& ak_1){
#define CGAL_TEST_ALGEBRAIC_REAL_IO(_f) \ #define CGAL_TEST_ALGEBRAIC_REAL_IO(_f) \
alg1=_f; \ alg1=_f; \
ss<<CGAL::oformat(alg1); \ ss<<CGAL::IO::oformat(alg1); \
CGAL_assertion(ss.good()); \ CGAL_assertion(ss.good()); \
ss>>CGAL::iformat(alg2); \ ss>>CGAL::IO::iformat(alg2); \
CGAL_assertion(!ss.fail()); \ CGAL_assertion(!ss.fail()); \
ss.clear(); \ ss.clear(); \
assert(alg1==alg2) assert(alg1==alg2)
// Note: after the reading ss>>CGAL::iformat(alg2) the state of ss can // Note: after the reading ss>>CGAL::IO::iformat(alg2) the state of ss can
// have the eofbit. The C++ norm says if one tries to write to a stream // have the eofbit. The C++ norm says if one tries to write to a stream
// with eofbit, then the failbit will be set. That is why one must // with eofbit, then the failbit will be set. That is why one must
// clear the iostate with ss.clear(). // clear the iostate with ss.clear().
@ -422,7 +422,7 @@ void test_algebraic_kernel_1(const AlgebraicKernel_d_1& ak_1){
Algebraic_real_1 alg1,alg2; Algebraic_real_1 alg1,alg2;
std::stringstream ss; std::stringstream ss;
CGAL::set_ascii_mode(ss); CGAL::IO::set_ascii_mode(ss);
// test construction from int, Coefficient and Bound // test construction from int, Coefficient and Bound
CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algebraic_real_1(int(2))); CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algebraic_real_1(int(2)));

View File

@ -20,7 +20,7 @@
#include <CGAL/internal/Exact_type_selector.h> #include <CGAL/internal/Exact_type_selector.h>
#include <CGAL/Has_conversion.h> #include <CGAL/Has_conversion.h>
#include <boost/shared_ptr.hpp> #include <memory>
#include <boost/type_traits.hpp> #include <boost/type_traits.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>

View File

@ -23,7 +23,7 @@ template <class Point>
bool bool
file_input(std::ifstream& is, std::list<Point>& L, int nb=0) file_input(std::ifstream& is, std::list<Point>& L, int nb=0)
{ {
CGAL::set_ascii_mode(is); CGAL::IO::set_ascii_mode(is);
int n; int n;
is >> n; is >> n;
if (nb != 0 && nb <= n) n=nb; if (nb != 0 && nb <= n) n=nb;

View File

@ -22,7 +22,7 @@ template <class Weighted_point>
bool bool
file_input(std::ifstream& is, std::list<Weighted_point>& L) file_input(std::ifstream& is, std::list<Weighted_point>& L)
{ {
CGAL::set_ascii_mode(is); CGAL::IO::set_ascii_mode(is);
int n; int n;
is >> n; is >> n;
std::cout << "Reading " << n << " points" << std::endl; std::cout << "Reading " << n << " points" << std::endl;

View File

@ -1966,7 +1966,7 @@ Apollonius_graph_2<Gt,Agds,LTag>::file_output(std::ostream& os) const
CGAL_assertion( n >= 1 ); CGAL_assertion( n >= 1 );
if( is_ascii(os) ) { if( IO::is_ascii(os) ) {
os << n << ' ' << m << ' ' << dimension() << std::endl; os << n << ' ' << m << ' ' << dimension() << std::endl;
} else { } else {
os << n << m << dimension(); os << n << m << dimension();
@ -1980,24 +1980,24 @@ Apollonius_graph_2<Gt,Agds,LTag>::file_output(std::ostream& os) const
V[infinite_vertex()] = inum++; V[infinite_vertex()] = inum++;
// finite vertices // finite vertices
if (is_ascii(os)) os << std::endl; if (IO::is_ascii(os)) os << std::endl;
for (Finite_vertices_iterator vit = finite_vertices_begin(); for (Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end(); ++vit) { vit != finite_vertices_end(); ++vit) {
V[vit] = inum++; V[vit] = inum++;
os << vit->site(); os << vit->site();
if ( is_ascii(os) ) { os << ' '; } if ( IO::is_ascii(os) ) { os << ' '; }
os << vit->number_of_hidden_sites(); os << vit->number_of_hidden_sites();
typename Vertex::Hidden_sites_iterator hit; typename Vertex::Hidden_sites_iterator hit;
for (hit = vit->hidden_sites_begin(); hit != vit->hidden_sites_end(); for (hit = vit->hidden_sites_begin(); hit != vit->hidden_sites_end();
++hit) { ++hit) {
if ( is_ascii(os) ) { os << ' '; } if ( IO::is_ascii(os) ) { os << ' '; }
os << *hit; os << *hit;
} }
// write non-combinatorial info of the vertex // write non-combinatorial info of the vertex
// os << *vit ; // os << *vit ;
if ( is_ascii(os) ) { os << std::endl; } if ( IO::is_ascii(os) ) { os << std::endl; }
} }
if ( is_ascii(os) ) { os << std::endl; } if ( IO::is_ascii(os) ) { os << std::endl; }
// vertices of the faces // vertices of the faces
inum = 0; inum = 0;
@ -2007,25 +2007,25 @@ Apollonius_graph_2<Gt,Agds,LTag>::file_output(std::ostream& os) const
F[fit] = inum++; F[fit] = inum++;
for(int j = 0; j < dim ; ++j) { for(int j = 0; j < dim ; ++j) {
os << V[ fit->vertex(j) ]; os << V[ fit->vertex(j) ];
if( is_ascii(os) ) { os << ' '; } if( IO::is_ascii(os) ) { os << ' '; }
} }
// write non-combinatorial info of the face // write non-combinatorial info of the face
// os << *fit ; // os << *fit ;
if( is_ascii(os) ) { os << std::endl; } if( IO::is_ascii(os) ) { os << std::endl; }
} }
if( is_ascii(os) ) { os << std::endl; } if( IO::is_ascii(os) ) { os << std::endl; }
// neighbor pointers of the faces // neighbor pointers of the faces
for( All_faces_iterator it = all_faces_begin(); for( All_faces_iterator it = all_faces_begin();
it != all_faces_end(); ++it) { it != all_faces_end(); ++it) {
for(int j = 0; j < dimension()+1; ++j){ for(int j = 0; j < dimension()+1; ++j){
os << F[ it->neighbor(j) ]; os << F[ it->neighbor(j) ];
if( is_ascii(os) ) { os << ' '; } if( IO::is_ascii(os) ) { os << ' '; }
} }
if( is_ascii(os) ) { os << std::endl; } if( IO::is_ascii(os) ) { os << std::endl; }
} }
if ( is_ascii(os) ) { os << std::endl; } if ( IO::is_ascii(os) ) { os << std::endl; }
} }

View File

@ -484,7 +484,7 @@ file_output(std::ostream& os) const
// write each level of the hierarchy // write each level of the hierarchy
for (unsigned int i = 0; i < ag_hierarchy_2__maxlevel; ++i) { for (unsigned int i = 0; i < ag_hierarchy_2__maxlevel; ++i) {
hierarchy[i]->file_output(os); hierarchy[i]->file_output(os);
if ( is_ascii(os) ) { os << std::endl << std::endl; } if ( IO::is_ascii(os) ) { os << std::endl << std::endl; }
} }
Vertex_map* V = new Vertex_map[ag_hierarchy_2__maxlevel]; Vertex_map* V = new Vertex_map[ag_hierarchy_2__maxlevel];
@ -520,22 +520,22 @@ file_output(std::ostream& os) const
} }
// write up and down pointer info // write up and down pointer info
if ( is_ascii(os) ) { os << std::endl << std::endl; } if ( IO::is_ascii(os) ) { os << std::endl << std::endl; }
for (unsigned int i = 0; i < ag_hierarchy_2__maxlevel; ++i) { for (unsigned int i = 0; i < ag_hierarchy_2__maxlevel; ++i) {
os << i; os << i;
if ( is_ascii(os) ) { os << " "; } if ( IO::is_ascii(os) ) { os << " "; }
os << hierarchy[i]->number_of_vertices(); os << hierarchy[i]->number_of_vertices();
if ( is_ascii(os) ) { os << std::endl; } if ( IO::is_ascii(os) ) { os << std::endl; }
for (Finite_vertices_iterator vit = hierarchy[i]->finite_vertices_begin(); for (Finite_vertices_iterator vit = hierarchy[i]->finite_vertices_begin();
vit != hierarchy[i]->finite_vertices_end(); ++vit) { vit != hierarchy[i]->finite_vertices_end(); ++vit) {
os << V[i][vit]; os << V[i][vit];
if ( is_ascii(os) ) { os << " "; } if ( IO::is_ascii(os) ) { os << " "; }
os << V_down[i][vit]; os << V_down[i][vit];
if ( is_ascii(os) ) { os << " "; } if ( IO::is_ascii(os) ) { os << " "; }
os << V_up[i][vit]; os << V_up[i][vit];
if ( is_ascii(os) ) { os << std::endl; } if ( IO::is_ascii(os) ) { os << std::endl; }
} }
if ( is_ascii(os) ) { os << std::endl << std::endl; } if ( IO::is_ascii(os) ) { os << std::endl << std::endl; }
} }
delete[] V; delete[] V;

View File

@ -19,7 +19,7 @@
#include <CGAL/Apollonius_graph_2/basic.h> #include <CGAL/Apollonius_graph_2/basic.h>
#include <CGAL/atomic.h> #include <atomic>
namespace CGAL { namespace CGAL {
@ -33,8 +33,8 @@ public:
typedef bool bool_; typedef bool bool_;
typedef unsigned long long_; typedef unsigned long long_;
#else #else
typedef CGAL::cpp11::atomic<bool> bool_; typedef std::atomic<bool> bool_;
typedef CGAL::cpp11::atomic<unsigned long> long_; typedef std::atomic<unsigned long> long_;
#endif #endif
static bool_ count_cases; static bool_ count_cases;

View File

@ -19,7 +19,7 @@
#include <CGAL/Apollonius_graph_2/basic.h> #include <CGAL/Apollonius_graph_2/basic.h>
#include <CGAL/atomic.h> #include <atomic>
#define AG2_PROFILE_PREDICATES #define AG2_PROFILE_PREDICATES
@ -33,7 +33,7 @@ public:
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
typedef unsigned long long_; typedef unsigned long long_;
#else #else
typedef CGAL::cpp11::atomic<unsigned long> long_; typedef std::atomic<unsigned long> long_;
#endif #endif
// high level predicates // high level predicates

View File

@ -56,7 +56,7 @@ public:
int i = 0; int i = 0;
for(InputIterator it = begin;it != end; it++, i++) { for(InputIterator it = begin;it != end; it++, i++) {
std::stringstream curr_item; std::stringstream curr_item;
::CGAL::set_pretty_mode(curr_item); ::CGAL::IO::set_pretty_mode(curr_item);
curr_item << i << "th: "; curr_item << i << "th: ";
curr_item << (*it); curr_item << (*it);
curve_list->insertItem(curr_item.str()); curve_list->insertItem(curr_item.str());

View File

@ -237,7 +237,7 @@ void xAlci_main_window::oc_rasterize_click()
oc_activate_layers(); oc_activate_layers();
} else { } else {
// CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); // CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
::CGAL::set_pretty_mode(std::cout); ::CGAL::IO::set_pretty_mode(std::cout);
Poly_int2 f; Poly_int2 f;
if(!input_poly(f, oc_input->text().ascii())) if(!input_poly(f, oc_input->text().ascii()))

View File

@ -194,16 +194,16 @@ void xAlci_main_window::oc_analyse_click()
Poly_int2 ress = fxx*fy*fy - ((fx*fy*fxy)*Poly_int1(2,0)) + fyy*fx*fx, Poly_int2 ress = fxx*fy*fy - ((fx*fy*fxy)*Poly_int1(2,0)) + fyy*fx*fx,
res1 = f*fx, res2 = f*fy; res1 = f*fx, res2 = f*fy;
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
std::cout << "curv:\n " << ress << "\n\n"; std::cout << "curv:\n " << ress << "\n\n";
std::cout << "fx:\n " << fx << "\n\n"; std::cout << "fx:\n " << fx << "\n\n";
std::cout << "fy:\n " << fy << "\n\n"; std::cout << "fy:\n " << fy << "\n\n";
std::cout << "f*fx:\n " << res1 << "\n\n"; std::cout << "f*fx:\n " << res1 << "\n\n";
std::cout << "f*fy:\n " << res2 << "\n\n"; std::cout << "f*fy:\n " << res2 << "\n\n";
CGAL::set_ascii_mode(std::cout); CGAL::IO::set_ascii_mode(std::cout);
std::cout << "f:\n " << f << "\n\n"; std::cout << "f:\n " << f << "\n\n";
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
std::cout << "f:\n " << f << "\n\n"; std::cout << "f:\n " << f << "\n\n";
timer.reset(); timer.reset();

View File

@ -277,11 +277,11 @@ inline std::ostream & operator<<(std::ostream & os, const Arr::Vertex & vertex)
inline Window_stream & operator<<(Window_stream & ws, Arr & arr) inline Window_stream & operator<<(Window_stream & ws, Arr & arr)
{ {
Arr::Edge_iterator ei; Arr::Edge_iterator ei;
ws << CGAL::blue(); ws << CGAL::IO::blue();
for (ei = arr.edges_begin(); ei != arr.edges_end(); ++ei) for (ei = arr.edges_begin(); ei != arr.edges_end(); ++ei)
ws << (*ei).curve(); ws << (*ei).curve();
Arr::Vertex_iterator vi; Arr::Vertex_iterator vi;
ws << CGAL::red(); ws << CGAL::IO::red();
for (vi = arr.vertices_begin(); vi != arr.vertices_end(); ++vi) for (vi = arr.vertices_begin(); vi != arr.vertices_end(); ++vi)
ws << (*vi).point(); ws << (*vi).point();
return ws; return ws;

View File

@ -31,7 +31,7 @@ struct ArrReader
ArrFormatter arrFormatter; ArrFormatter arrFormatter;
auto arr = new Arrangement(); auto arr = new Arrangement();
CGAL::read(*arr, ifs, arrFormatter); CGAL::IO::read(*arr, ifs, arrFormatter);
return arr; return arr;
} }
}; };
@ -106,7 +106,7 @@ struct ArrWriter
using ArrFormatter = CGAL::Arr_with_history_text_formatter<TextFormatter>; using ArrFormatter = CGAL::Arr_with_history_text_formatter<TextFormatter>;
ArrFormatter arrFormatter; ArrFormatter arrFormatter;
CGAL::write(*arr, ofs, arrFormatter); CGAL::IO::write(*arr, ofs, arrFormatter);
} }
}; };

View File

@ -1,6 +1,9 @@
namespace CGAL { namespace CGAL {
namespace IO {
/*! /*!
\defgroup PkgArrangementOnSurface2Read CGAL::read() \defgroup PkgArrangementOnSurface2Read CGAL::IO::read()
\ingroup PkgArrangementOnSurface2IO \ingroup PkgArrangementOnSurface2IO
Reads a given arrangement from a given input stream Reads a given arrangement from a given input stream
@ -37,7 +40,7 @@ std::istream& read (Arrangement_2<Traits,Dcel>& arr,
/// @} /// @}
/*! /*!
\defgroup PkgArrangementOnSurface2Write CGAL::write() \defgroup PkgArrangementOnSurface2Write CGAL::IO::write()
\ingroup PkgArrangementOnSurface2IO \ingroup PkgArrangementOnSurface2IO
Writes a given arrangement into a given output stream Writes a given arrangement into a given output stream
@ -69,6 +72,8 @@ std::ostream& write (const Arrangement_2<Traits,Dcel>& arr,
/// @} /// @}
} // namespace IO
/*! /*!
\ingroup PkgArrangementOnSurface2op_left_shift \ingroup PkgArrangementOnSurface2op_left_shift
Inserts the arrangement object `arr` into the output stream Inserts the arrangement object `arr` into the output stream
@ -93,4 +98,4 @@ template<class Traits, class Dcel>
std::istream& operator>>(std::istream& is, Arrangement_2<Traits,Dcel>& arr); std::istream& operator>>(std::istream& is, Arrangement_2<Traits,Dcel>& arr);
} /* end namespace CGAL*/ } /* end namespace CGAL::IO*/

View File

@ -1,5 +1,7 @@
namespace CGAL { namespace CGAL {
namespace IO {
/*! /*!
\ingroup PkgArrangementOnSurface2Read \ingroup PkgArrangementOnSurface2Read
@ -26,6 +28,8 @@ std::ostream& write (const Arrangement_with_history_2<Traits,Dcel>& arr,
std::ostream& os, std::ostream& os,
WithHistoryFormatter& formatter); WithHistoryFormatter& formatter);
} // namespace IO
/*! /*!
\ingroup PkgArrangementOnSurface2op_left_shift \ingroup PkgArrangementOnSurface2op_left_shift
Inserts the arrangement-with-history object `arr` into the output Inserts the arrangement-with-history object `arr` into the output

View File

@ -203,8 +203,8 @@ implemented as peripheral classes or as free (global) functions.
- `CGAL::locate()` - `CGAL::locate()`
- `CGAL::decompose()` - `CGAL::decompose()`
- `CGAL::overlay()` - `CGAL::overlay()`
- `CGAL::read()` - `CGAL::IO::read()`
- `CGAL::write()` - `CGAL::IO::write()`
- `CGAL::remove_curve()` - `CGAL::remove_curve()`
- \link PkgArrangementOnSurface2op_left_shift `CGAL::operator<<` \endlink - \link PkgArrangementOnSurface2op_left_shift `CGAL::operator<<` \endlink
- \link PkgArrangementOnSurface2op_right_shift `CGAL::operator<<` \endlink - \link PkgArrangementOnSurface2op_right_shift `CGAL::operator<<` \endlink

View File

@ -32,7 +32,7 @@ typedef Arr_traits_2::Polynomial_2 Polynomial_2;
int main() { int main() {
// For nice printouts // For nice printouts
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
Arr_traits_2 arr_traits; Arr_traits_2 arr_traits;

View File

@ -119,14 +119,14 @@ int main ()
std::ofstream out_file ("arr_ex_dcel_io.dat"); std::ofstream out_file ("arr_ex_dcel_io.dat");
Formatter formatter; Formatter formatter;
write (arr, out_file, formatter); CGAL::IO::write (arr, out_file, formatter);
out_file.close(); out_file.close();
// Read the arrangement from the file. // Read the arrangement from the file.
Arrangement_2 arr2; Arrangement_2 arr2;
std::ifstream in_file ("arr_ex_dcel_io.dat"); std::ifstream in_file ("arr_ex_dcel_io.dat");
read (arr2, in_file, formatter); CGAL::IO::read (arr2, in_file, formatter);
in_file.close(); in_file.close();
std::cout << "The arrangement vertices: " << std::endl; std::cout << "The arrangement vertices: " << std::endl;

View File

@ -29,7 +29,7 @@ typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main () int main ()
{ {
CGAL::set_pretty_mode(std::cout); // for nice printouts. CGAL::IO::set_pretty_mode(std::cout); // for nice printouts.
// create a polynomial representing x .-) // create a polynomial representing x .-)
Polynomial_1 x = CGAL::shift(Polynomial_1(1),1); Polynomial_1 x = CGAL::shift(Polynomial_1(1),1);

View File

@ -31,7 +31,7 @@ typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main () int main ()
{ {
CGAL::set_pretty_mode(std::cout); // for nice printouts. CGAL::IO::set_pretty_mode(std::cout); // for nice printouts.
// Traits class object // Traits class object
Traits_2 traits; Traits_2 traits;

View File

@ -29,7 +29,7 @@ typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main () int main ()
{ {
CGAL::set_pretty_mode(std::cout); // for nice printouts. CGAL::IO::set_pretty_mode(std::cout); // for nice printouts.
// Traits class object // Traits class object
AK1 ak1; AK1 ak1;

View File

@ -23,12 +23,12 @@
* The header file for the Arr_circle_segment_traits_2<Kenrel> class. * The header file for the Arr_circle_segment_traits_2<Kenrel> class.
*/ */
#include <CGAL/atomic.h>
#include <CGAL/tags.h> #include <CGAL/tags.h>
#include <CGAL/Arr_tags.h> #include <CGAL/Arr_tags.h>
#include <CGAL/Arr_geometry_traits/Circle_segment_2.h> #include <CGAL/Arr_geometry_traits/Circle_segment_2.h>
#include <fstream> #include <fstream>
#include <atomic>
namespace CGAL { namespace CGAL {
@ -80,7 +80,7 @@ public:
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
static unsigned int index; static unsigned int index;
#else #else
static CGAL::cpp11::atomic<unsigned int> index; static std::atomic<unsigned int> index;
#endif #endif
return (++index); return (++index);
} }

View File

@ -23,8 +23,8 @@
*/ */
#include <fstream> #include <fstream>
#include <atomic>
#include <CGAL/atomic.h>
#include <CGAL/tags.h> #include <CGAL/tags.h>
#include <CGAL/Arr_tags.h> #include <CGAL/Arr_tags.h>
#include <CGAL/Arr_geometry_traits/Conic_arc_2.h> #include <CGAL/Arr_geometry_traits/Conic_arc_2.h>
@ -108,7 +108,7 @@ public:
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
static unsigned int index; static unsigned int index;
#else #else
static CGAL::cpp11::atomic<unsigned int> index; static std::atomic<unsigned int> index;
#endif #endif
return (++index); return (++index);
} }

View File

@ -26,9 +26,9 @@
#include <iostream> #include <iostream>
#include <string.h> #include <string.h>
#include <atomic>
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/atomic.h>
#include <CGAL/Arr_enums.h> #include <CGAL/Arr_enums.h>
#include <CGAL/Arr_tags.h> #include <CGAL/Arr_tags.h>
@ -958,7 +958,7 @@ public:
#ifdef CGAL_NO_ATOMIC #ifdef CGAL_NO_ATOMIC
static size_t counter; static size_t counter;
#else #else
static CGAL::cpp11::atomic<size_t> counter; static std::atomic<size_t> counter;
#endif #endif
if (doit) ++counter; if (doit) ++counter;
return counter; return counter;

View File

@ -155,7 +155,7 @@ OutputStream& operator<<(
OutputStream& os, OutputStream& os,
const Arr_parameter_space& ps) { const Arr_parameter_space& ps) {
switch (::CGAL::get_mode(os)) { switch (::CGAL::IO::get_mode(os)) {
case ::CGAL::IO::PRETTY: case ::CGAL::IO::PRETTY:
switch(ps) { switch(ps) {
case CGAL::ARR_LEFT_BOUNDARY: case CGAL::ARR_LEFT_BOUNDARY:
@ -195,7 +195,7 @@ InputStream& operator>>(
InputStream& is, InputStream& is,
Arr_parameter_space& ps) { Arr_parameter_space& ps) {
CGAL_precondition(CGAL::is_ascii(is)); CGAL_precondition(CGAL::IO::is_ascii(is));
int i; int i;
is >> i; is >> i;

View File

@ -23,7 +23,7 @@
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h> #include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/shared_ptr.hpp> #include <memory>
#ifdef CGAL_TD_DEBUG #ifdef CGAL_TD_DEBUG
@ -95,7 +95,7 @@ public:
typedef Td_ninetuple<boost::variant<Vertex_const_handle,Point>, typedef Td_ninetuple<boost::variant<Vertex_const_handle,Point>,
boost::variant<Vertex_const_handle,unsigned char>, boost::variant<Vertex_const_handle,unsigned char>,
boost::variant<Halfedge_const_handle, boost::variant<Halfedge_const_handle,
boost::shared_ptr<X_monotone_curve_2> >, std::shared_ptr<X_monotone_curve_2> >,
Halfedge_const_handle, Halfedge_const_handle,
unsigned char, unsigned char,
Self*, Self*, Self*, Self*,
@ -230,7 +230,7 @@ public:
if (type() == TD_EDGE) if (type() == TD_EDGE)
{ {
//ptr()->e2 = (boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(top()->curve())); //ptr()->e2 = (std::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(top()->curve()));
set_curve_for_rem_he(top()->curve()); set_curve_for_rem_he(top()->curve());
return; return;
} }
@ -238,8 +238,8 @@ public:
//else if (type() == TD_VERTEX) //else if (type() == TD_VERTEX)
Curve_end v_ce(left()->curve_end()); Curve_end v_ce(left()->curve_end());
ptr()->e2 = (boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(v_ce.cv())); ptr()->e2 = (std::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(v_ce.cv()));
//CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2>>( &(ptr()->e2)) != nullptr); //CGAL_assertion(boost::get<std::shared_ptr<X_monotone_curve_2>>( &(ptr()->e2)) != nullptr);
ptr()->e1 = (v_ce.ce() == ARR_MIN_END ) ? CGAL_TD_CV_MIN_END : CGAL_TD_CV_MAX_END; ptr()->e1 = (v_ce.ce() == ARR_MIN_END ) ? CGAL_TD_CV_MIN_END : CGAL_TD_CV_MAX_END;
@ -255,7 +255,7 @@ public:
{ {
CGAL_precondition (type() == TD_EDGE); CGAL_precondition (type() == TD_EDGE);
ptr()->e2 = (boost::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(cv)); ptr()->e2 = (std::shared_ptr<X_monotone_curve_2>)(new X_monotone_curve_2(cv));
} }
/*! Set the trapezoid's type flag (Trapezoid/Edge/Vertex). */ /*! Set the trapezoid's type flag (Trapezoid/Edge/Vertex). */
@ -537,8 +537,8 @@ public:
CGAL_precondition(is_on_boundaries()); CGAL_precondition(is_on_boundaries());
CGAL_assertion(boost::get<unsigned char>( &(ptr()->e1)) != nullptr); CGAL_assertion(boost::get<unsigned char>( &(ptr()->e1)) != nullptr);
CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr); CGAL_assertion(boost::get<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (boost::get<boost::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get(); X_monotone_curve_2* cv_ptr = (boost::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(cv_ptr != nullptr); CGAL_assertion(cv_ptr != nullptr);
Arr_curve_end ce = Arr_curve_end ce =
@ -555,8 +555,8 @@ public:
CGAL_precondition(is_on_boundaries()); CGAL_precondition(is_on_boundaries());
CGAL_assertion(boost::get<unsigned char>( &(ptr()->e1)) != nullptr); CGAL_assertion(boost::get<unsigned char>( &(ptr()->e1)) != nullptr);
CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr); CGAL_assertion(boost::get<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (boost::get<boost::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get(); X_monotone_curve_2* cv_ptr = (boost::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(cv_ptr != nullptr); CGAL_assertion(cv_ptr != nullptr);
Arr_curve_end ce = Arr_curve_end ce =
@ -572,8 +572,8 @@ public:
CGAL_precondition(type() == TD_VERTEX); CGAL_precondition(type() == TD_VERTEX);
CGAL_assertion(boost::get<unsigned char>( &(ptr()->e1)) != nullptr); CGAL_assertion(boost::get<unsigned char>( &(ptr()->e1)) != nullptr);
CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr); CGAL_assertion(boost::get<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (boost::get<boost::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get(); X_monotone_curve_2* cv_ptr = (boost::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(cv_ptr != nullptr); CGAL_assertion(cv_ptr != nullptr);
Arr_curve_end ce = Arr_curve_end ce =
@ -587,8 +587,8 @@ public:
{ {
CGAL_precondition(!is_active() && type() == TD_EDGE); CGAL_precondition(!is_active() && type() == TD_EDGE);
CGAL_assertion(boost::get<boost::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr); CGAL_assertion(boost::get<std::shared_ptr<X_monotone_curve_2> >(&(ptr()->e2)) != nullptr);
X_monotone_curve_2* cv_ptr = (boost::get<boost::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get(); X_monotone_curve_2* cv_ptr = (boost::get<std::shared_ptr<X_monotone_curve_2> >(ptr()->e2)).get();
CGAL_assertion(cv_ptr != nullptr); CGAL_assertion(cv_ptr != nullptr);
return *cv_ptr; return *cv_ptr;
} }

View File

@ -22,7 +22,7 @@
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h> #include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/shared_ptr.hpp> #include <memory>
#ifdef CGAL_TD_DEBUG #ifdef CGAL_TD_DEBUG

View File

@ -22,7 +22,7 @@
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h> #include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/shared_ptr.hpp> #include <memory>
#ifdef CGAL_TD_DEBUG #ifdef CGAL_TD_DEBUG
#define CGAL_TD_INLINE #define CGAL_TD_INLINE

View File

@ -22,7 +22,7 @@
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h> #include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/shared_ptr.hpp> #include <memory>
#ifdef CGAL_TD_DEBUG #ifdef CGAL_TD_DEBUG

View File

@ -22,7 +22,7 @@
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h> #include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/shared_ptr.hpp> #include <memory>
#ifdef CGAL_TD_DEBUG #ifdef CGAL_TD_DEBUG
@ -115,14 +115,14 @@ public:
public: public:
//c'tors //c'tors
Data (boost::shared_ptr<X_monotone_curve_2>& _cv, Dag_node* _p_node) Data (std::shared_ptr<X_monotone_curve_2>& _cv, Dag_node* _p_node)
: cv(_cv), p_node(_p_node) //, lb(_lb),lt(_lt),rb(_rb),rt(_rt) : cv(_cv), p_node(_p_node) //, lb(_lb),lt(_lt),rb(_rb),rt(_rt)
{ } { }
~Data() { } ~Data() { }
protected: protected:
boost::shared_ptr<X_monotone_curve_2> cv; std::shared_ptr<X_monotone_curve_2> cv;
Dag_node* p_node; Dag_node* p_node;
}; };
@ -148,7 +148,7 @@ public:
} }
/*! Set the x_monotone_curve_2 for removed edge degenerate trapezoid. */ /*! Set the x_monotone_curve_2 for removed edge degenerate trapezoid. */
CGAL_TD_INLINE void set_curve(boost::shared_ptr<X_monotone_curve_2>& cv) CGAL_TD_INLINE void set_curve(std::shared_ptr<X_monotone_curve_2>& cv)
{ {
ptr()->cv = cv; ptr()->cv = cv;
} }
@ -159,7 +159,7 @@ public:
//@{ //@{
/*! Constructor given Vertex & Halfedge handles. */ /*! Constructor given Vertex & Halfedge handles. */
Td_inactive_edge (boost::shared_ptr<X_monotone_curve_2>& cv, Dag_node* node = nullptr) Td_inactive_edge (std::shared_ptr<X_monotone_curve_2>& cv, Dag_node* node = nullptr)
{ {
PTR = new Data(cv,node); PTR = new Data(cv,node);
} }

View File

@ -27,7 +27,7 @@
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/shared_ptr.hpp> #include <memory>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
@ -1206,7 +1206,7 @@ protected:
void deactivate_vertex (Dag_node& vtx_node) const; void deactivate_vertex (Dag_node& vtx_node) const;
void deactivate_edge (boost::shared_ptr<X_monotone_curve_2>& cv, Dag_node& edge_node) const; void deactivate_edge (std::shared_ptr<X_monotone_curve_2>& cv, Dag_node& edge_node) const;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Description: // Description:

View File

@ -244,7 +244,7 @@ deactivate_vertex(Dag_node& vtx_node) const
template <typename Td_traits> template <typename Td_traits>
void Trapezoidal_decomposition_2<Td_traits>:: void Trapezoidal_decomposition_2<Td_traits>::
deactivate_edge(boost::shared_ptr<X_monotone_curve_2>& cv, deactivate_edge(std::shared_ptr<X_monotone_curve_2>& cv,
Dag_node& edge_node) const Dag_node& edge_node) const
{ {
CGAL_precondition(traits->is_active(edge_node.get_data())); CGAL_precondition(traits->is_active(edge_node.get_data()));
@ -1870,7 +1870,7 @@ void Trapezoidal_decomposition_2<Td_traits>::remove(Halfedge_const_handle he)
//----------------------------------- //-----------------------------------
//3. remove the trapezoids that represent the removed halfedge //3. remove the trapezoids that represent the removed halfedge
boost::shared_ptr<X_monotone_curve_2> std::shared_ptr<X_monotone_curve_2>
removed_cv_ptr(new X_monotone_curve_2(he->curve())); removed_cv_ptr(new X_monotone_curve_2(he->curve()));
Base_map_item_iterator last_edge_fragment_it = mid_it; Base_map_item_iterator last_edge_fragment_it = mid_it;
//Base_trapezoid_iterator last_mid = mid_it; //Base_trapezoid_iterator last_mid = mid_it;

View File

@ -237,7 +237,7 @@ public:
std::ostream& print (std::ostream& os) const std::ostream& print (std::ostream& os) const
{ {
std::pair<double,double> double_p; std::pair<double,double> double_p;
switch(::CGAL::get_mode(os)) switch(::CGAL::IO::get_mode(os))
{ {
case ::CGAL::IO::PRETTY: case ::CGAL::IO::PRETTY:
double_p = this->to_double(); double_p = this->to_double();

View File

@ -80,7 +80,7 @@ public:
typedef Triangulation_vertex_base_with_info_2<Vertex_const_handle, Kernel> typedef Triangulation_vertex_base_with_info_2<Vertex_const_handle, Kernel>
Vbb; Vbb;
typedef Triangulation_hierarchy_vertex_base_2<Vbb> Vb; typedef Triangulation_hierarchy_vertex_base_2<Vbb> Vb;
//typedef Triangulation_face_base_with_info_2<CGAL::Color,Kernel> Fbt; //typedef Triangulation_face_base_with_info_2<CGAL::IO::Color,Kernel> Fbt;
typedef Constrained_triangulation_face_base_2<Kernel> Fb; typedef Constrained_triangulation_face_base_2<Kernel> Fb;
typedef Triangulation_data_structure_2<Vb,Fb> TDS; typedef Triangulation_data_structure_2<Vb,Fb> TDS;
typedef Exact_predicates_tag Itag; typedef Exact_predicates_tag Itag;

View File

@ -3164,7 +3164,7 @@ public:
*/ */
void write(std::ostream& os) const { void write(std::ostream& os) const {
switch (::CGAL::get_mode(os)) { switch (::CGAL::IO::get_mode(os)) {
case ::CGAL::IO::PRETTY: case ::CGAL::IO::PRETTY:
os << "arc@" << this->id() << "[(sup@" << this->curve().id(); os << "arc@" << this->id() << "[(sup@" << this->curve().id();
if (this->is_vertical()) { if (this->is_vertical()) {
@ -3214,7 +3214,7 @@ public:
*/ */
void read(std::istream& is) { void read(std::istream& is) {
CGAL_precondition(CGAL::is_ascii(is)); CGAL_precondition(CGAL::IO::is_ascii(is));
Rep rep; Rep rep;
@ -3371,7 +3371,7 @@ std::istream& operator>> (
std::istream& is, std::istream& is,
Arc_2< CurvedKernelViaAnalysis_2, Rep_ >& arc) { Arc_2< CurvedKernelViaAnalysis_2, Rep_ >& arc) {
CGAL_precondition(CGAL::is_ascii(is)); CGAL_precondition(CGAL::IO::is_ascii(is));
//typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//typedef Rep_ Rep; //typedef Rep_ Rep;

View File

@ -231,7 +231,7 @@ public:
// avoid compiler warning // avoid compiler warning
(void)arc; (void)arc;
//CGAL::set_pretty_mode(std::cerr); //CGAL::IO::set_pretty_mode(std::cerr);
CERR("Construct_pt_on_arc: " << CGAL::to_double(x) << ", " << arcno << CERR("Construct_pt_on_arc: " << CGAL::to_double(x) << ", " << arcno <<
", " << c.id() << "\narc = " << arc << "\n"); ", " << c.id() << "\narc = " << arc << "\n");

View File

@ -615,7 +615,7 @@ public:
*/ */
void write(std::ostream& os) const { void write(std::ostream& os) const {
switch(::CGAL::get_mode(os)) { switch(::CGAL::IO::get_mode(os)) {
case ::CGAL::IO::PRETTY: case ::CGAL::IO::PRETTY:
os << "point@" << this->id() << "("; os << "point@" << this->id() << "(";
os << "sup@" << this->curve().id() << "; "; os << "sup@" << this->curve().id() << "; ";
@ -722,7 +722,7 @@ public:
*/ */
void read(std::istream& is) { void read(std::istream& is) {
CGAL_precondition(CGAL::is_ascii(is)); CGAL_precondition(CGAL::IO::is_ascii(is));
Rep rep; Rep rep;
@ -823,7 +823,7 @@ std::istream& operator>> (
std::istream& is, std::istream& is,
Point_2< CurvedKernelViaAnalysis_2, Rep_ >& pt) { Point_2< CurvedKernelViaAnalysis_2, Rep_ >& pt) {
CGAL_precondition(CGAL::is_ascii(is)); CGAL_precondition(CGAL::IO::is_ascii(is));
//typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; //typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//typedef Rep_ Rep; //typedef Rep_ Rep;

View File

@ -2586,8 +2586,8 @@ inline bool is_isolated_pixel(const Pixel_2& /* pix */) {
// DEBUG ONLY // DEBUG ONLY
#ifdef Gfx_USE_OUT #ifdef Gfx_USE_OUT
void dump_neighbourhood(const Pixel_2& pix) { void dump_neighbourhood(const Pixel_2& pix) {
CGAL::set_mode(std::cerr, CGAL::IO::PRETTY); CGAL::IO::set_mode(std::cerr, CGAL::IO::PRETTY);
CGAL::set_mode(std::cout, CGAL::IO::PRETTY); CGAL::IO::set_mode(std::cout, CGAL::IO::PRETTY);
Stripe box[2]; // 0 - left-right stripe, 1 - bottom-top stripe Stripe box[2]; // 0 - left-right stripe, 1 - bottom-top stripe
//NT inv = NT(1) / NT(one << pix.level); //NT inv = NT(1) / NT(one << pix.level);

View File

@ -29,6 +29,8 @@
namespace CGAL { namespace CGAL {
namespace IO {
/*! /*!
* Write an arrangement to an output stream using a given formatter. * Write an arrangement to an output stream using a given formatter.
* \param arr The arrangement. * \param arr The arrangement.
@ -51,6 +53,8 @@ std::ostream&
return (os); return (os);
} }
} // namespace IO
/*! /*!
* Output operator (importer). * Output operator (importer).
* \param os The output stream. * \param os The output stream.
@ -72,6 +76,8 @@ std::ostream&
return (os); return (os);
} }
namespace IO {
/*! /*!
* Read an arrangement from an input stream using a given formatter. * Read an arrangement from an input stream using a given formatter.
* \param arr The arrangement. * \param arr The arrangement.
@ -94,6 +100,8 @@ std::istream&
return (is); return (is);
} }
} // namespace IO
/*! /*!
* Output operator (exporter). * Output operator (exporter).
* \param is The input stream. * \param is The input stream.
@ -115,6 +123,11 @@ std::istream&
return (is); return (is);
} }
#ifndef CGAL_NO_DEPRECATED_CODE
using IO::read;
using IO::write;
#endif
} //namespace CGAL } //namespace CGAL
#endif #endif

View File

@ -120,8 +120,8 @@ public:
void write_arrangement_begin() void write_arrangement_begin()
{ {
CGAL_assertion(m_out != nullptr); CGAL_assertion(m_out != nullptr);
m_old_out_mode = get_mode(*m_out); m_old_out_mode = IO::get_mode(*m_out);
set_ascii_mode(*m_out); IO::set_ascii_mode(*m_out);
_write_comment("BEGIN ARRANGEMENT"); _write_comment("BEGIN ARRANGEMENT");
} }
@ -277,8 +277,8 @@ public:
void read_arrangement_begin() void read_arrangement_begin()
{ {
CGAL_assertion(m_in != nullptr); CGAL_assertion(m_in != nullptr);
m_old_in_mode = get_mode(*m_in); m_old_in_mode = IO::get_mode(*m_in);
set_ascii_mode(*m_in); IO::set_ascii_mode(*m_in);
_skip_comments(); _skip_comments();
} }

View File

@ -30,6 +30,8 @@
namespace CGAL { namespace CGAL {
namespace IO {
/*! /*!
* Write an arrangement with history to an output stream using a given * Write an arrangement with history to an output stream using a given
* formatter. * formatter.
@ -54,6 +56,8 @@ std::ostream& write
return (os); return (os);
} }
} // namespace IO
/*! /*!
* Output operator (importer). * Output operator (importer).
* \param os The output stream. * \param os The output stream.
@ -77,6 +81,8 @@ std::ostream& operator<<
return (os); return (os);
} }
namespace IO {
/*! /*!
* Read an arrangement with history from an input stream using a given * Read an arrangement with history from an input stream using a given
* formatter. * formatter.
@ -101,6 +107,8 @@ std::istream& read
return (is); return (is);
} }
} // namespace IO
/*! /*!
* Output operator (exporter). * Output operator (exporter).
* \param is The input stream. * \param is The input stream.
@ -124,6 +132,11 @@ std::istream& operator>>
return (is); return (is);
} }
#ifndef CGAL_NO_DEPRECATED_CODE
using IO::read;
using IO::write;
#endif
} //namespace CGAL } //namespace CGAL
#endif #endif

View File

@ -18,6 +18,9 @@
#include <CGAL/IO/Fig_stream.h> #include <CGAL/IO/Fig_stream.h>
#include <list> #include <list>
namespace CGAL {
namespace IO {
/*! /*!
* Write an x-monotone conic arc to a FIG stream. * Write an x-monotone conic arc to a FIG stream.
*/ */
@ -97,4 +100,6 @@ void write_conic_arc
return; return;
} }
}} // namespace CGAL:IO
#endif #endif

View File

@ -745,7 +745,7 @@ bool Overlay_test<T_Geom_traits, T_Topol_traits>::init()
// Expected arrangement. // Expected arrangement.
Formatter formatter; Formatter formatter;
CGAL::read(m_arr, p_stream, formatter); CGAL::IO::read(m_arr, p_stream, formatter);
p_stream.close(); p_stream.close();
@ -981,13 +981,13 @@ bool Overlay_test<T_Geom_traits, T_Topol_traits>::perform()
Arrangement arr; Arrangement arr;
Overlay_traits overlay_traits(m_verbose_level); Overlay_traits overlay_traits(m_verbose_level);
// Formatter formatter; // Formatter formatter;
// CGAL::write(m_arr2, std::cout, formatter); // CGAL::IO::write(m_arr2, std::cout, formatter);
CGAL::overlay(m_arr1, m_arr2, arr, overlay_traits); CGAL::overlay(m_arr1, m_arr2, arr, overlay_traits);
// Generate the output for debugging purposes // Generate the output for debugging purposes
// Formatter formatter; // Formatter formatter;
// CGAL::write(arr, std::cout, formatter); // CGAL::IO::write(arr, std::cout, formatter);
// Verify the resulting arrangement: // Verify the resulting arrangement:
if (!equivalent_arr(arr, m_arr)) { if (!equivalent_arr(arr, m_arr)) {

View File

@ -87,8 +87,8 @@ bool test(const char* points_filename, const char* xcurves_filename,
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS #if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
CGAL::set_pretty_mode(std::cerr); CGAL::IO::set_pretty_mode(std::cerr);
#endif #endif
size_t verbose_level = 0; size_t verbose_level = 0;

View File

@ -96,8 +96,8 @@ bool test(const char* filename, int verbose_level)
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS #if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
CGAL::set_pretty_mode(std::cerr); CGAL::IO::set_pretty_mode(std::cerr);
#endif #endif
if (argc < 2) { if (argc < 2) {

View File

@ -129,8 +129,8 @@ bool test(const char* filename, int verbose_level)
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS #if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
CGAL::set_pretty_mode(std::cerr); CGAL::IO::set_pretty_mode(std::cerr);
#endif #endif
if (argc < 2) { if (argc < 2) {

View File

@ -128,8 +128,8 @@ bool test3(const char* points_filename, const char* xcurves_filename,
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS #if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
CGAL::set_pretty_mode(std::cerr); CGAL::IO::set_pretty_mode(std::cerr);
#endif #endif
if (argc < 4) { if (argc < 4) {

View File

@ -91,8 +91,8 @@ bool test1(const char* points_filename, const char* xcurves_filename,
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS #if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
CGAL::set_pretty_mode(std::cerr); CGAL::IO::set_pretty_mode(std::cerr);
#endif #endif
if (argc < 5) { if (argc < 5) {

View File

@ -73,8 +73,8 @@ int main(int argc, char* argv[])
{ {
#if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS #if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
CGAL::set_pretty_mode(std::cerr); CGAL::IO::set_pretty_mode(std::cerr);
#endif #endif
Geom_traits traits; Geom_traits traits;

View File

@ -84,8 +84,8 @@ bool test(const char* points_filename, const char* xcurves_filename,
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS #if TEST_GEOM_TRAITS == ALGEBRAIC_GEOM_TRAITS
CGAL::set_pretty_mode(std::cout); CGAL::IO::set_pretty_mode(std::cout);
CGAL::set_pretty_mode(std::cerr); CGAL::IO::set_pretty_mode(std::cerr);
#endif #endif
size_t verbose_level = 0; size_t verbose_level = 0;

View File

@ -756,8 +756,8 @@ user might encounter.
- `CGAL::alpha_expansion_graphcut()` - `CGAL::alpha_expansion_graphcut()`
\cgalCRPSection{I/O Functions} \cgalCRPSection{I/O Functions}
- `CGAL::read_polygon_mesh()` - `CGAL::IO::read_polygon_mesh()`
- `CGAL::write_polygon_mesh()` - `CGAL::IO::write_polygon_mesh()`
- \link PkgBGLIoFuncsSTL I/O for STL files \endlink - \link PkgBGLIoFuncsSTL I/O for STL files \endlink
- \link PkgBGLIoFuncsPLY I/O for PLY files \endlink - \link PkgBGLIoFuncsPLY I/O for PLY files \endlink
- \link PkgBGLIoFuncsOBJ I/O for OBJ files \endlink - \link PkgBGLIoFuncsOBJ I/O for OBJ files \endlink

View File

@ -39,7 +39,7 @@ int main(int argc, char* argv[])
Target1 T1; Target1 T1;
{ {
CGAL::copy_face_graph(S, T1); CGAL::copy_face_graph(S, T1);
CGAL::write_OFF("lcc.off", T1); CGAL::IO::write_OFF("lcc.off", T1);
} }
S.clear(); S.clear();

View File

@ -20,7 +20,7 @@ typedef boost::graph_traits<LCC>::vertex_iterator vertex_iterator;
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
LCC lcc; LCC lcc;
CGAL::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc); CGAL::IO::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc);
// This is the vector where the distance gets written to // This is the vector where the distance gets written to
std::vector<int> distance(lcc.vertex_attributes().size()); std::vector<int> distance(lcc.vertex_attributes().size());

View File

@ -51,7 +51,7 @@ OutputIterator adjacent_vertices_V2(const LCC& g,
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
LCC lcc; LCC lcc;
CGAL::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc); CGAL::IO::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc);
GraphTraits::vertex_iterator vi = vertices(lcc).first; GraphTraits::vertex_iterator vi = vertices(lcc).first;
std::list<vertex_descriptor> V; std::list<vertex_descriptor> V;

View File

@ -70,7 +70,7 @@ int main(int argc, char** argv)
Face_index_map; Face_index_map;
LCC lcc; LCC lcc;
CGAL::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc); CGAL::IO::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc);
// Ad hoc property_map to store normals. Face_index_map is used to // Ad hoc property_map to store normals. Face_index_map is used to
// map face_descriptors to a contiguous range of indices. See // map face_descriptors to a contiguous range of indices. See

View File

@ -52,7 +52,7 @@ void fct(const LCC& lcc)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
LCC lcc; LCC lcc;
CGAL::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc); CGAL::IO::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc);
fct(lcc); fct(lcc);
return 0; return 0;

View File

@ -43,7 +43,7 @@ struct Source {
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
LCC lcc; LCC lcc;
CGAL::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc); CGAL::IO::read_polygon_mesh((argc>1)?argv[1]:"cube.off", lcc);
GraphTraits::vertex_descriptor vd = *(vertices(lcc).first); GraphTraits::vertex_descriptor vd = *(vertices(lcc).first);
typedef boost::transform_iterator<Source<LCC>,halfedge_around_target_iterator> adjacent_vertex_iterator; typedef boost::transform_iterator<Source<LCC>,halfedge_around_target_iterator> adjacent_vertex_iterator;

View File

@ -28,13 +28,13 @@ int main(int argc, char** argv )
std::vector<vertex_descriptor> V; std::vector<vertex_descriptor> V;
const char* filename = (argc>1)?argv[1]:"in.off"; const char* filename = (argc>1)?argv[1]:"in.off";
const char* outname= (argc>2)?argv[2]:"out.off"; const char* outname= (argc>2)?argv[2]:"out.off";
CGAL::read_polygon_mesh(filename, mesh); CGAL::IO::read_polygon_mesh(filename, mesh);
for(vertex_descriptor vd : vertices(mesh)){ for(vertex_descriptor vd : vertices(mesh)){
for(halfedge_descriptor hd : CGAL::halfedges_around_target(vd,mesh)){ for(halfedge_descriptor hd : CGAL::halfedges_around_target(vd,mesh)){
if(! CGAL::is_border(edge(hd,mesh),mesh)){ if(! CGAL::is_border(edge(hd,mesh),mesh)){
CGAL::Euler::flip_edge(hd,mesh); CGAL::Euler::flip_edge(hd,mesh);
CGAL::write_polygon_mesh(outname, mesh); CGAL::IO::write_polygon_mesh(outname, mesh);
return 0; return 0;
} }
} }

View File

@ -21,7 +21,7 @@ int main(int argc, char** argv)
} }
Mesh mesh; Mesh mesh;
CGAL::read_OFF (in, mesh); CGAL::IO::read_OFF (in, mesh);
boost::unordered_map<Face_index, bool> is_selected_map; boost::unordered_map<Face_index, bool> is_selected_map;

View File

@ -17,7 +17,7 @@ int main(int argc, char* argv[])
const char* filename = (argc > 1) ? argv[1] : "data/prim.off"; const char* filename = (argc > 1) ? argv[1] : "data/prim.off";
Mesh sm; Mesh sm;
if(!CGAL::read_polygon_mesh(filename, sm)) if(!CGAL::IO::read_polygon_mesh(filename, sm))
{ {
std::cerr << "Invalid input." << std::endl; std::cerr << "Invalid input." << std::endl;
return 1; return 1;

View File

@ -17,7 +17,7 @@ int main(int argc, char* argv[])
const char* filename = (argc>1) ? argv[1] : "data/prim.off"; const char* filename = (argc>1) ? argv[1] : "data/prim.off";
Mesh P; Mesh P;
if(!CGAL::read_polygon_mesh(filename, P)) if(!CGAL::IO::read_polygon_mesh(filename, P))
{ {
std::cerr << "Invalid input." << std::endl; std::cerr << "Invalid input." << std::endl;
return 1; return 1;

View File

@ -36,7 +36,7 @@ int main(int argc, char* argv[])
const char* filename = (argc>1) ? argv[1] : "data/cube.off"; const char* filename = (argc>1) ? argv[1] : "data/cube.off";
Mesh sm; Mesh sm;
if(!CGAL::read_polygon_mesh(filename, sm)) if(!CGAL::IO::read_polygon_mesh(filename, sm))
{ {
std::cerr << "Invalid input." << std::endl; std::cerr << "Invalid input." << std::endl;
return 1; return 1;

View File

@ -40,7 +40,7 @@ int main(int argc, char* argv[])
const char* filename = (argc > 1) ? argv[1] : "data/prim.off"; const char* filename = (argc > 1) ? argv[1] : "data/prim.off";
Mesh primal; Mesh primal;
if(!CGAL::read_polygon_mesh(filename, primal)) if(!CGAL::IO::read_polygon_mesh(filename, primal))
{ {
std::cerr << "Invalid input." << std::endl; std::cerr << "Invalid input." << std::endl;
return 1; return 1;

View File

@ -17,7 +17,7 @@ int main(int argc, char** argv)
int number_of_parts = (argc>2) ? atoi(argv[2]) : 8; int number_of_parts = (argc>2) ? atoi(argv[2]) : 8;
SM sm; SM sm;
if(!CGAL::read_polygon_mesh(filename, sm)) if(!CGAL::IO::read_polygon_mesh(filename, sm))
{ {
std::cerr << "Invalid input." << std::endl; std::cerr << "Invalid input." << std::endl;
return 1; return 1;
@ -44,7 +44,7 @@ int main(int argc, char** argv)
CGAL::copy_face_graph(filtered_sm, part_sm); CGAL::copy_face_graph(filtered_sm, part_sm);
// Output the mesh extracted from subpart n°0 // Output the mesh extracted from subpart n°0
CGAL::write_polygon_mesh("sm_part_0.off", part_sm, CGAL::parameters::stream_precision(17)); CGAL::IO::write_polygon_mesh("sm_part_0.off", part_sm, CGAL::parameters::stream_precision(17));
// Output all the vertices that are in the part n°0 // Output all the vertices that are in the part n°0
std::ofstream outxyz("out.xyz"); std::ofstream outxyz("out.xyz");

View File

@ -22,7 +22,7 @@ int main()
std::ofstream out("out.inp"); std::ofstream out("out.inp");
out.precision(17); out.precision(17);
CGAL::write_INP(out, "out.inp", "S4R", sm); CGAL::IO::write_INP(out, "out.inp", "S4R", sm);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -28,6 +28,8 @@
namespace CGAL { namespace CGAL {
namespace IO {
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Write // Write
@ -58,7 +60,7 @@ bool write_3MF(const std::string& filename,
const std::vector<std::string>& names const std::vector<std::string>& names
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if< , typename boost::disable_if<
IO::internal::is_Point_set_or_Range_or_Iterator< internal::is_Point_set_or_Range_or_Iterator<
typename boost::range_value<GraphRange>::type> >::type* = nullptr typename boost::range_value<GraphRange>::type> >::type* = nullptr
#endif #endif
) )
@ -114,7 +116,7 @@ bool write_3MF(const std::string& filename,
return write_3MF(filename, all_points, all_triangles, names); return write_3MF(filename, all_points, all_triangles, names);
} }
} // namespace CGAL } } // namespace CGAL::IO
#endif // defined(CGAL_LINKED_WITH_3MF) || defined(DOXYGEN_RUNNING) #endif // defined(CGAL_LINKED_WITH_3MF) || defined(DOXYGEN_RUNNING)

View File

@ -76,7 +76,6 @@ public:
}; };
} // namespace internal } // namespace internal
} // namespace IO
/// \ingroup PkgBGLIoFuncsGOCAD /// \ingroup PkgBGLIoFuncsGOCAD
/// ///
@ -120,14 +119,14 @@ bool read_GOCAD(std::istream& is,
Graph& g, Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
typedef typename CGAL::GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::type VPM; typedef typename CGAL::GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::type VPM;
typedef typename boost::property_traits<VPM>::value_type Point; typedef typename boost::property_traits<VPM>::value_type Point;
IO::internal::GOCAD_builder<Graph, Point> builder(is); internal::GOCAD_builder<Graph, Point> builder(is);
if(!builder(g, np)) if(!builder(g, np))
return false; return false;
@ -141,14 +140,14 @@ bool read_GOCAD(std::istream& is,
template <typename Graph> template <typename Graph>
bool read_GOCAD(std::istream& is, std::pair<std::string, std::string>& name_and_color, Graph& g, bool read_GOCAD(std::istream& is, std::pair<std::string, std::string>& name_and_color, Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return read_GOCAD(is, name_and_color, g, parameters::all_default()); return read_GOCAD(is, name_and_color, g, parameters::all_default());
} }
template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool read_GOCAD(std::istream& is, Graph& g, const CGAL_BGL_NP_CLASS& np, bool read_GOCAD(std::istream& is, Graph& g, const CGAL_BGL_NP_CLASS& np,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
std::pair<std::string, std::string> dummy; std::pair<std::string, std::string> dummy;
return read_GOCAD(is, dummy, g, np); return read_GOCAD(is, dummy, g, np);
@ -156,7 +155,7 @@ bool read_GOCAD(std::istream& is, Graph& g, const CGAL_BGL_NP_CLASS& np,
template <typename Graph> template <typename Graph>
bool read_GOCAD(std::istream& is, Graph& g, bool read_GOCAD(std::istream& is, Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return read_GOCAD(is, g, parameters::all_default()); return read_GOCAD(is, g, parameters::all_default());
} }
@ -207,12 +206,12 @@ bool read_GOCAD(const std::string& fname,
Graph& g, Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
std::ifstream is(fname); std::ifstream is(fname);
CGAL::set_mode(is, CGAL::IO::ASCII); CGAL::IO::set_mode(is, CGAL::IO::ASCII);
return read_GOCAD(is, name_and_color, g, np); return read_GOCAD(is, name_and_color, g, np);
} }
@ -220,14 +219,14 @@ bool read_GOCAD(const std::string& fname,
template <typename Graph> template <typename Graph>
bool read_GOCAD(const std::string& fname, std::pair<std::string, std::string>& name_and_color, Graph& g, bool read_GOCAD(const std::string& fname, std::pair<std::string, std::string>& name_and_color, Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return read_GOCAD(fname, name_and_color, g, parameters::all_default()); return read_GOCAD(fname, name_and_color, g, parameters::all_default());
} }
template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool read_GOCAD(const std::string& fname, Graph& g, const CGAL_BGL_NP_CLASS& np, bool read_GOCAD(const std::string& fname, Graph& g, const CGAL_BGL_NP_CLASS& np,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
std::pair<std::string, std::string> dummy; std::pair<std::string, std::string> dummy;
return read_GOCAD(fname, dummy, g, np); return read_GOCAD(fname, dummy, g, np);
@ -235,7 +234,7 @@ bool read_GOCAD(const std::string& fname, Graph& g, const CGAL_BGL_NP_CLASS& np,
template <typename Graph> template <typename Graph>
bool read_GOCAD(const std::string& fname, Graph& g, bool read_GOCAD(const std::string& fname, Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return read_GOCAD(fname, g, parameters::all_default()); return read_GOCAD(fname, g, parameters::all_default());
} }
@ -284,7 +283,7 @@ bool write_GOCAD(std::ostream& os,
const Graph& g, const Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
@ -346,7 +345,7 @@ bool write_GOCAD(std::ostream& os,
template <typename Graph> template <typename Graph>
bool write_GOCAD(std::ostream& os, const char* name, const Graph& g, bool write_GOCAD(std::ostream& os, const char* name, const Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_GOCAD(os, name, g, parameters::all_default()); return write_GOCAD(os, name, g, parameters::all_default());
} }
@ -391,7 +390,7 @@ bool write_GOCAD(std::ostream& os,
const Graph& g, const Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
@ -402,7 +401,7 @@ bool write_GOCAD(std::ostream& os,
template <typename Graph> template <typename Graph>
bool write_GOCAD(std::ostream& os, const Graph& g, bool write_GOCAD(std::ostream& os, const Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_GOCAD(os, g, parameters::all_default()); return write_GOCAD(os, g, parameters::all_default());
} }
@ -447,12 +446,12 @@ bool write_GOCAD(const std::string& fname,
const Graph& g, const Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
std::ofstream os(fname); std::ofstream os(fname);
CGAL::set_mode(os, CGAL::IO::ASCII); CGAL::IO::set_mode(os, CGAL::IO::ASCII);
return write_GOCAD(os, fname.c_str(), g, np); return write_GOCAD(os, fname.c_str(), g, np);
} }
@ -461,13 +460,13 @@ bool write_GOCAD(const std::string& fname,
template <typename Graph> template <typename Graph>
bool write_GOCAD(const std::string& fname, const Graph& g, bool write_GOCAD(const std::string& fname, const Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_GOCAD(fname, g, parameters::all_default()); return write_GOCAD(fname, g, parameters::all_default());
} }
/// \endcond /// \endcond
} // namespace CGAL }} // namespace CGAL::IO
#endif // CGAL_BGL_IO_GOCAD_H #endif // CGAL_BGL_IO_GOCAD_H

View File

@ -44,7 +44,7 @@ public:
typedef typename GetK<Graph, NamedParameters>::Kernel Kernel; typedef typename GetK<Graph, NamedParameters>::Kernel Kernel;
typedef typename Kernel::Vector_3 Vector; typedef typename Kernel::Vector_3 Vector;
typedef typename Kernel::Point_2 Texture; typedef typename Kernel::Point_2 Texture;
typedef CGAL::Color Color; typedef CGAL::IO::Color Color;
typedef typename CGAL::GetVertexPointMap<Graph, NamedParameters>::type VPM; typedef typename CGAL::GetVertexPointMap<Graph, NamedParameters>::type VPM;

View File

@ -95,7 +95,7 @@ public:
typedef typename GetVertexPointMap<Graph, NamedParameters>::const_type VPM; typedef typename GetVertexPointMap<Graph, NamedParameters>::const_type VPM;
typedef typename boost::property_traits<VPM>::reference Point_ref; typedef typename boost::property_traits<VPM>::reference Point_ref;
typedef CGAL::Color Color; typedef CGAL::IO::Color Color;
typedef typename internal_np::Lookup_named_param_def< typedef typename internal_np::Lookup_named_param_def<
internal_np::vertex_color_map_t, NamedParameters, internal_np::vertex_color_map_t, NamedParameters,
@ -153,7 +153,7 @@ public:
if(has_vertex_colors) if(has_vertex_colors)
{ {
const CGAL::Color& vc = get(vcm, v); const CGAL::IO::Color& vc = get(vcm, v);
m_writer.write_vertex_color(vc.red(), vc.green(), vc.blue()); // @fixme correct? m_writer.write_vertex_color(vc.red(), vc.green(), vc.blue()); // @fixme correct?
} }
@ -182,7 +182,7 @@ public:
if(has_face_colors) if(has_face_colors)
{ {
const CGAL::Color& fc = get(fcm, f); const CGAL::IO::Color& fc = get(fcm, f);
m_writer.write_face_color(fc.red(), fc.green(), fc.blue()); m_writer.write_face_color(fc.red(), fc.green(), fc.blue());
} }

View File

@ -23,6 +23,8 @@
namespace CGAL { namespace CGAL {
namespace IO {
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
@ -96,8 +98,27 @@ bool write_INP(const std::string& fname, const std::string& type, const Graph& g
return write_INP(fname, type, g, parameters::all_default()); return write_INP(fname, type, g, parameters::all_default());
} }
#ifndef CGAL_NO_DEPRECATED_CODE
template <typename FaceGraph, typename NamedParameters>
CGAL_DEPRECATED bool write_inp(std::ostream& os,
const FaceGraph& g,
std::string name,
std::string type,
const NamedParameters& np)
{
return write_INP(os, name, type, g, np);
}
template <typename FaceGraph>
CGAL_DEPRECATED bool write_inp(std::ostream& os,
const FaceGraph& g,
std::string name,
std::string type)
{
return write_INP(os, name, type, g, parameters::all_default());
}
#endif
/// \endcond /// \endcond
} // namespace CGAL }} // namespace CGAL::IO
#endif // CGAL_BGL_IO_INP_H #endif // CGAL_BGL_IO_INP_H

View File

@ -68,7 +68,6 @@ public:
}; };
} // namespace internal } // namespace internal
} // namespace IO
/*! /*!
\ingroup PkgBGLIoFuncsOBJ \ingroup PkgBGLIoFuncsOBJ
@ -115,14 +114,14 @@ bool read_OBJ(std::istream& is,
Graph& g, Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
typedef typename CGAL::GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::type VPM; typedef typename CGAL::GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::type VPM;
typedef typename boost::property_traits<VPM>::value_type Point; typedef typename boost::property_traits<VPM>::value_type Point;
IO::internal::OBJ_builder<Graph, Point> builder(is); internal::OBJ_builder<Graph, Point> builder(is);
return builder(g, np); return builder(g, np);
} }
@ -130,7 +129,7 @@ bool read_OBJ(std::istream& is,
template <typename Graph> template <typename Graph>
bool read_OBJ(std::istream& is, Graph& g, bool read_OBJ(std::istream& is, Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return read_OBJ(is, g, parameters::all_default()); return read_OBJ(is, g, parameters::all_default());
} }
@ -182,12 +181,12 @@ bool read_OBJ(const std::string& fname,
Graph& g, Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
std::ifstream is(fname); std::ifstream is(fname);
CGAL::set_mode(is, CGAL::IO::ASCII); CGAL::IO::set_mode(is, CGAL::IO::ASCII);
return read_OBJ(is, g, np); return read_OBJ(is, g, np);
} }
@ -195,7 +194,7 @@ bool read_OBJ(const std::string& fname,
template <typename Graph> template <typename Graph>
bool read_OBJ(const std::string& fname, Graph& g, bool read_OBJ(const std::string& fname, Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return read_OBJ(fname, g, parameters::all_default()); return read_OBJ(fname, g, parameters::all_default());
} }
@ -245,11 +244,11 @@ bool write_OBJ(std::ostream& os,
const Graph& g, const Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
IO::internal::Generic_facegraph_printer<std::ostream, Graph, CGAL::File_writer_wavefront> printer(os); internal::Generic_facegraph_printer<std::ostream, Graph, CGAL::File_writer_wavefront> printer(os);
return printer(g, np); return printer(g, np);
} }
@ -257,7 +256,7 @@ bool write_OBJ(std::ostream& os,
template <typename Graph> template <typename Graph>
bool write_OBJ(std::ostream& os, const Graph& g, bool write_OBJ(std::ostream& os, const Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_OBJ(os, g, parameters::all_default()); return write_OBJ(os, g, parameters::all_default());
} }
@ -302,12 +301,12 @@ bool write_OBJ(const std::string& fname,
const Graph& g, const Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
std::ofstream os(fname); std::ofstream os(fname);
CGAL::set_mode(os, CGAL::IO::ASCII); CGAL::IO::set_mode(os, CGAL::IO::ASCII);
return write_OBJ(os, g, np); return write_OBJ(os, g, np);
} }
@ -315,13 +314,13 @@ bool write_OBJ(const std::string& fname,
template <typename Graph> template <typename Graph>
bool write_OBJ(const std::string& fname, const Graph& g, bool write_OBJ(const std::string& fname, const Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_OBJ(fname, g, parameters::all_default()); return write_OBJ(fname, g, parameters::all_default());
} }
/// \endcond /// \endcond
} // namespace CGAL }} // namespace CGAL::IO
#endif // CGAL_BGL_IO_OBJ_H #endif // CGAL_BGL_IO_OBJ_H

View File

@ -78,12 +78,11 @@ bool read_OFF_BGL(std::istream& is,
typedef typename CGAL::GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::type VPM; typedef typename CGAL::GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::type VPM;
typedef typename boost::property_traits<VPM>::value_type Point; typedef typename boost::property_traits<VPM>::value_type Point;
IO::internal::OFF_builder<Graph, Point> builder(is); internal::OFF_builder<Graph, Point> builder(is);
return builder(g, np); return builder(g, np);
} }
} // namespace internal } // namespace internal
} // namespace IO
/*! /*!
\ingroup PkgBGLIoFuncsOFF \ingroup PkgBGLIoFuncsOFF
@ -127,7 +126,7 @@ bool read_OFF_BGL(std::istream& is,
\cgalParamNBegin{vertex_color_map} \cgalParamNBegin{vertex_color_map}
\cgalParamDescription{a property map associating colors to the vertices of `g`} \cgalParamDescription{a property map associating colors to the vertices of `g`}
\cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor` \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{vertex colors that may exist in the input will be ignored} \cgalParamDefault{vertex colors that may exist in the input will be ignored}
\cgalParamNEnd \cgalParamNEnd
@ -141,7 +140,7 @@ bool read_OFF_BGL(std::istream& is,
\cgalParamNBegin{face_color_map} \cgalParamNBegin{face_color_map}
\cgalParamDescription{a property map associating colors to the faces of `g`} \cgalParamDescription{a property map associating colors to the faces of `g`}
\cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor` \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{face colors that may exist in the input will be ignored} \cgalParamDefault{face colors that may exist in the input will be ignored}
\cgalParamNEnd \cgalParamNEnd
@ -162,18 +161,18 @@ bool read_OFF(std::istream& is,
Graph& g, Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
return IO::internal::read_OFF_BGL(is, g, np); return internal::read_OFF_BGL(is, g, np);
} }
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
template <typename Graph> template <typename Graph>
bool read_OFF(std::istream& is, Graph& g, bool read_OFF(std::istream& is, Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return read_OFF(is, g, parameters::all_default()); return read_OFF(is, g, parameters::all_default());
} }
@ -222,7 +221,7 @@ bool read_OFF(std::istream& is, Graph& g,
\cgalParamNBegin{vertex_color_map} \cgalParamNBegin{vertex_color_map}
\cgalParamDescription{a property map associating colors to the vertices of `g`} \cgalParamDescription{a property map associating colors to the vertices of `g`}
\cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor` \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{vertex colors that may exist in the input will be ignored} \cgalParamDefault{vertex colors that may exist in the input will be ignored}
\cgalParamNEnd \cgalParamNEnd
@ -236,7 +235,7 @@ bool read_OFF(std::istream& is, Graph& g,
\cgalParamNBegin{face_color_map} \cgalParamNBegin{face_color_map}
\cgalParamDescription{a property map associating colors to the faces of `g`} \cgalParamDescription{a property map associating colors to the faces of `g`}
\cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor` \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{face colors that may exist in the input will be ignored} \cgalParamDefault{face colors that may exist in the input will be ignored}
\cgalParamNEnd \cgalParamNEnd
@ -257,7 +256,7 @@ bool read_OFF(const std::string& fname,
Graph& g, Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
@ -269,35 +268,37 @@ bool read_OFF(const std::string& fname,
template <typename Graph> template <typename Graph>
bool read_OFF(const std::string& fname, Graph& g, bool read_OFF(const std::string& fname, Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return read_OFF(fname, g, parameters::all_default()); return read_OFF(fname, g, parameters::all_default());
} }
/// \endcond /// \endcond
} // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE #ifndef CGAL_NO_DEPRECATED_CODE
/*! /*!
\ingroup PkgBGLIOFctDeprecated \ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.2, `CGAL::read_OFF()` should be used instead. \deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::read_OFF()` should be used instead.
*/ */
template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_off(std::istream& is, Graph& g, const CGAL_BGL_NP_CLASS& np) CGAL_DEPRECATED bool read_off(std::istream& is, Graph& g, const CGAL_BGL_NP_CLASS& np)
{ {
return read_OFF(is, g, np); return IO::read_OFF(is, g, np);
} }
/*! /*!
\ingroup PkgBGLIOFctDeprecated \ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.2, `CGAL::read_OFF()` should be used instead. \deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::read_OFF()` should be used instead.
*/ */
template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_off(const char* fname, Graph& g, const CGAL_BGL_NP_CLASS& np) CGAL_DEPRECATED bool read_off(const char* fname, Graph& g, const CGAL_BGL_NP_CLASS& np)
{ {
return read_OFF(fname, g, np); return IO::read_OFF(fname, g, np);
} }
template <typename Graph> template <typename Graph>
@ -312,6 +313,12 @@ CGAL_DEPRECATED bool read_off(const char* fname, Graph& g)
return read_off(fname, g, parameters::all_default()); return read_off(fname, g, parameters::all_default());
} }
template <typename Graph>
CGAL_DEPRECATED bool read_off(const std::string& fname, Graph& g)
{
return read_off(fname.c_str(), g, parameters::all_default());
}
#endif // CGAL_NO_DEPRECATED_CODE #endif // CGAL_NO_DEPRECATED_CODE
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
@ -326,12 +333,11 @@ bool write_OFF_BGL(std::ostream& os,
const Graph& g, const Graph& g,
const CGAL_BGL_NP_CLASS& np) const CGAL_BGL_NP_CLASS& np)
{ {
IO::internal::Generic_facegraph_printer<std::ostream, Graph, CGAL::File_writer_OFF> printer(os); internal::Generic_facegraph_printer<std::ostream, Graph, CGAL::File_writer_OFF> printer(os);
return printer(g, np); return printer(g, np);
} }
} // namespace internal } // namespace internal
} // namespace IO
/*! /*!
\ingroup PkgBGLIoFuncsOFF \ingroup PkgBGLIoFuncsOFF
@ -365,7 +371,7 @@ bool write_OFF_BGL(std::ostream& os,
\cgalParamNBegin{vertex_color_map} \cgalParamNBegin{vertex_color_map}
\cgalParamDescription{a property map associating colors to the vertices of `g`} \cgalParamDescription{a property map associating colors to the vertices of `g`}
\cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor` \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{no vertex colors in the output} \cgalParamDefault{no vertex colors in the output}
\cgalParamNEnd \cgalParamNEnd
@ -379,7 +385,7 @@ bool write_OFF_BGL(std::ostream& os,
\cgalParamNBegin{face_color_map} \cgalParamNBegin{face_color_map}
\cgalParamDescription{a property map associating colors to the faces of `g`} \cgalParamDescription{a property map associating colors to the faces of `g`}
\cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor` \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{no face colors in the output} \cgalParamDefault{no face colors in the output}
\cgalParamNEnd \cgalParamNEnd
@ -400,18 +406,18 @@ bool write_OFF(std::ostream& os,
const Graph& g, const Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
return IO::internal::write_OFF_BGL(os, g, np); return internal::write_OFF_BGL(os, g, np);
} }
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
template <typename Graph> template <typename Graph>
bool write_OFF(std::ostream& os, const Graph& g, bool write_OFF(std::ostream& os, const Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_OFF(os, g, parameters::all_default()); return write_OFF(os, g, parameters::all_default());
} }
@ -450,7 +456,7 @@ bool write_OFF(std::ostream& os, const Graph& g,
\cgalParamNBegin{vertex_color_map} \cgalParamNBegin{vertex_color_map}
\cgalParamDescription{a property map associating colors to the vertices of `g`} \cgalParamDescription{a property map associating colors to the vertices of `g`}
\cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor` \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{no vertex colors in the output} \cgalParamDefault{no vertex colors in the output}
\cgalParamNEnd \cgalParamNEnd
@ -464,7 +470,7 @@ bool write_OFF(std::ostream& os, const Graph& g,
\cgalParamNBegin{face_color_map} \cgalParamNBegin{face_color_map}
\cgalParamDescription{a property map associating colors to the faces of `g`} \cgalParamDescription{a property map associating colors to the faces of `g`}
\cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor` \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{no face colors in the output} \cgalParamDefault{no face colors in the output}
\cgalParamNEnd \cgalParamNEnd
@ -485,7 +491,7 @@ bool write_OFF(const std::string& fname,
const Graph& g, const Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
@ -503,24 +509,26 @@ bool write_OFF(const std::string& fname,
template <typename Graph> template <typename Graph>
bool write_OFF(const std::string& fname, const Graph& g, bool write_OFF(const std::string& fname, const Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_OFF(fname, g, parameters::all_default()); return write_OFF(fname, g, parameters::all_default());
} }
/// \endcond /// \endcond
} // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE #ifndef CGAL_NO_DEPRECATED_CODE
/*! /*!
\ingroup PkgBGLIOFctDeprecated \ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.2, `CGAL::write_OFF()` should be used instead. \deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_OFF()` should be used instead.
*/ */
template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_off(std::ostream& os, const Graph& g, const CGAL_BGL_NP_CLASS& np) CGAL_DEPRECATED bool write_off(std::ostream& os, const Graph& g, const CGAL_BGL_NP_CLASS& np)
{ {
return write_OFF(os, g, np); return IO::write_OFF(os, g, np);
} }
template <typename Graph> template <typename Graph>
@ -531,12 +539,12 @@ CGAL_DEPRECATED bool write_off(std::ostream& os, const Graph& g)
/*! /*!
\ingroup PkgBGLIOFctDeprecated \ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.2, `CGAL::write_OFF()` should be used instead. \deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_OFF()` should be used instead.
*/ */
template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_off(const char* fname, const Graph& g, const CGAL_BGL_NP_CLASS& np) CGAL_DEPRECATED bool write_off(const char* fname, const Graph& g, const CGAL_BGL_NP_CLASS& np)
{ {
return write_OFF(fname, g, np); return IO::write_OFF(fname, g, np);
} }
template <typename Graph> template <typename Graph>

View File

@ -71,12 +71,11 @@ bool read_PLY_BGL(std::istream& is,
typedef typename CGAL::GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::type VPM; typedef typename CGAL::GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::type VPM;
typedef typename boost::property_traits<VPM>::value_type Point; typedef typename boost::property_traits<VPM>::value_type Point;
IO::internal::PLY_builder<Graph, Point> builder(is); internal::PLY_builder<Graph, Point> builder(is);
return builder(g, np); return builder(g, np);
} }
} // namespace internal } // namespace internal
} // namespace IO
/*! /*!
\ingroup PkgBGLIoFuncsPLY \ingroup PkgBGLIoFuncsPLY
@ -114,14 +113,14 @@ bool read_PLY_BGL(std::istream& is,
\cgalParamNBegin{vertex_color_map} \cgalParamNBegin{vertex_color_map}
\cgalParamDescription{a property map associating colors to the vertices of `g`} \cgalParamDescription{a property map associating colors to the vertices of `g`}
\cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor` \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{vertex colors that may exist in the input will be ignored} \cgalParamDefault{vertex colors that may exist in the input will be ignored}
\cgalParamNEnd \cgalParamNEnd
\cgalParamNBegin{face_color_map} \cgalParamNBegin{face_color_map}
\cgalParamDescription{a property map associating colors to the faces of `g`} \cgalParamDescription{a property map associating colors to the faces of `g`}
\cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor` \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{face colors that may exist in the input will be ignored} \cgalParamDefault{face colors that may exist in the input will be ignored}
\cgalParamNEnd \cgalParamNEnd
@ -142,20 +141,20 @@ bool read_PLY(std::istream& is,
Graph& g, Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
return IO::internal::read_PLY_BGL(is, g, np); return internal::read_PLY_BGL(is, g, np);
} }
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
template <typename Graph> template <typename Graph>
bool read_PLY(std::istream& is, Graph& g, bool read_PLY(std::istream& is, Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return IO::internal::read_PLY_BGL(is, g, parameters::all_default()); return internal::read_PLY_BGL(is, g, parameters::all_default());
} }
/// \endcond /// \endcond
@ -200,14 +199,14 @@ bool read_PLY(std::istream& is, Graph& g,
\cgalParamNBegin{vertex_color_map} \cgalParamNBegin{vertex_color_map}
\cgalParamDescription{a property map associating colors to the vertices of `g`} \cgalParamDescription{a property map associating colors to the vertices of `g`}
\cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor` \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{vertex colors that may exist in the input will be ignored} \cgalParamDefault{vertex colors that may exist in the input will be ignored}
\cgalParamNEnd \cgalParamNEnd
\cgalParamNBegin{face_color_map} \cgalParamNBegin{face_color_map}
\cgalParamDescription{a property map associating colors to the faces of `g`} \cgalParamDescription{a property map associating colors to the faces of `g`}
\cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor` \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{face colors that may exist in the input will be ignored} \cgalParamDefault{face colors that may exist in the input will be ignored}
\cgalParamNEnd \cgalParamNEnd
@ -228,7 +227,7 @@ bool read_PLY(const std::string& fname,
Graph& g, Graph& g,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
@ -236,14 +235,14 @@ bool read_PLY(const std::string& fname,
if(binary) if(binary)
{ {
std::ifstream is(fname, std::ios::binary); std::ifstream is(fname, std::ios::binary);
CGAL::set_mode(is, CGAL::IO::BINARY); CGAL::IO::set_mode(is, CGAL::IO::BINARY);
return IO::internal::read_PLY_BGL(is, g, np); return internal::read_PLY_BGL(is, g, np);
} }
else else
{ {
std::ifstream is(fname); std::ifstream is(fname);
CGAL::set_mode(is, CGAL::IO::ASCII); CGAL::IO::set_mode(is, CGAL::IO::ASCII);
return IO::internal::read_PLY_BGL(is, g, np); return internal::read_PLY_BGL(is, g, np);
} }
} }
@ -251,7 +250,7 @@ bool read_PLY(const std::string& fname,
template <typename Graph> template <typename Graph>
bool read_PLY(const std::string& fname, Graph& g, bool read_PLY(const std::string& fname, Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return read_PLY(fname, g, parameters::all_default()); return read_PLY(fname, g, parameters::all_default());
} }
@ -297,14 +296,14 @@ bool read_PLY(const std::string& fname, Graph& g,
\cgalParamNBegin{vertex_color_map} \cgalParamNBegin{vertex_color_map}
\cgalParamDescription{a property map associating colors to the vertices of `g`} \cgalParamDescription{a property map associating colors to the vertices of `g`}
\cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor` \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{vertex colors that may exist in the input will be ignored} \cgalParamDefault{vertex colors that may exist in the input will be ignored}
\cgalParamNEnd \cgalParamNEnd
\cgalParamNBegin{face_color_map} \cgalParamNBegin{face_color_map}
\cgalParamDescription{a property map associating colors to the faces of `g`} \cgalParamDescription{a property map associating colors to the faces of `g`}
\cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor` \cgalParamType{a class model of `WritablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{face colors that may exist in the input will be ignored} \cgalParamDefault{face colors that may exist in the input will be ignored}
\cgalParamNEnd \cgalParamNEnd
@ -324,7 +323,7 @@ bool write_PLY(std::ostream& os,
const std::string& comments, const std::string& comments,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
@ -335,7 +334,7 @@ bool write_PLY(std::ostream& os,
typedef typename CGAL::GetInitializedVertexIndexMap<Graph, CGAL_BGL_NP_CLASS>::const_type VIMap; typedef typename CGAL::GetInitializedVertexIndexMap<Graph, CGAL_BGL_NP_CLASS>::const_type VIMap;
typedef typename GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::const_type Vpm; typedef typename GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::const_type Vpm;
typedef typename boost::property_traits<Vpm>::reference Point_3; typedef typename boost::property_traits<Vpm>::reference Point_3;
typedef CGAL::Color Color; typedef CGAL::IO::Color Color;
typedef typename internal_np::Lookup_named_param_def< typedef typename internal_np::Lookup_named_param_def<
internal_np::vertex_color_map_t, internal_np::vertex_color_map_t,
CGAL_BGL_NP_CLASS, CGAL_BGL_NP_CLASS,
@ -365,7 +364,7 @@ bool write_PLY(std::ostream& os,
// Write header // Write header
os << "ply" << std::endl os << "ply" << std::endl
<< ((get_mode(os) == IO::BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl << ((get_mode(os) == BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl
<< "comment Generated by the CGAL library" << std::endl; << "comment Generated by the CGAL library" << std::endl;
if(comments != std::string()) if(comments != std::string())
@ -380,7 +379,7 @@ bool write_PLY(std::ostream& os,
} }
os << "element vertex " << vertices(g).size() << std::endl; os << "element vertex " << vertices(g).size() << std::endl;
IO::internal::output_property_header(os, make_ply_point_writer (CGAL::Identity_property_map<Point_3>())); internal::output_property_header(os, make_ply_point_writer (CGAL::Identity_property_map<Point_3>()));
//if vcm is not default add v:color property //if vcm is not default add v:color property
if(has_vcolor) if(has_vcolor)
{ {
@ -391,7 +390,7 @@ bool write_PLY(std::ostream& os,
} }
os << "element face " << faces(g).size() << std::endl; os << "element face " << faces(g).size() << std::endl;
IO::internal::output_property_header( internal::output_property_header(
os, std::make_pair(CGAL::Identity_property_map<std::vector<std::size_t> >(), os, std::make_pair(CGAL::Identity_property_map<std::vector<std::size_t> >(),
PLY_property<std::vector<int> >("vertex_indices"))); PLY_property<std::vector<int> >("vertex_indices")));
//if fcm is not default add f:color property //if fcm is not default add f:color property
@ -407,10 +406,10 @@ bool write_PLY(std::ostream& os,
for(vertex_descriptor vd : vertices(g)) for(vertex_descriptor vd : vertices(g))
{ {
Point_3 p = get(vpm, vd); Point_3 p = get(vpm, vd);
IO::internal::output_properties(os, &p, make_ply_point_writer (CGAL::Identity_property_map<Point_3>())); internal::output_properties(os, &p, make_ply_point_writer (CGAL::Identity_property_map<Point_3>()));
if(has_vcolor) if(has_vcolor)
{ {
const CGAL::Color& c = get(vcm, vd); const CGAL::IO::Color& c = get(vcm, vd);
if(get_mode(os) == CGAL::IO::ASCII) if(get_mode(os) == CGAL::IO::ASCII)
os << c << std::endl; os << c << std::endl;
else else
@ -425,12 +424,12 @@ bool write_PLY(std::ostream& os,
for(halfedge_descriptor hd : halfedges_around_face(halfedge(fd, g), g)) for(halfedge_descriptor hd : halfedges_around_face(halfedge(fd, g), g))
polygon.push_back(get(vim, target(hd,g))); polygon.push_back(get(vim, target(hd,g)));
IO::internal::output_properties(os, &polygon, internal::output_properties(os, &polygon,
std::make_pair(CGAL::Identity_property_map<std::vector<std::size_t> >(), std::make_pair(CGAL::Identity_property_map<std::vector<std::size_t> >(),
PLY_property<std::vector<int> >("vertex_indices"))); PLY_property<std::vector<int> >("vertex_indices")));
if(has_fcolor) if(has_fcolor)
{ {
const CGAL::Color& c = get(fcm, fd); const CGAL::IO::Color& c = get(fcm, fd);
if(get_mode(os) == CGAL::IO::ASCII) if(get_mode(os) == CGAL::IO::ASCII)
os << c << std::endl; os << c << std::endl;
else else
@ -447,21 +446,21 @@ bool write_PLY(std::ostream& os,
template <typename Graph> template <typename Graph>
bool write_PLY(std::ostream& os, const Graph& g, const std::string& comments, bool write_PLY(std::ostream& os, const Graph& g, const std::string& comments,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_PLY(os, g, comments, parameters::all_default()); return write_PLY(os, g, comments, parameters::all_default());
} }
template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool write_PLY(std::ostream& os, const Graph& g, const CGAL_BGL_NP_CLASS& np, bool write_PLY(std::ostream& os, const Graph& g, const CGAL_BGL_NP_CLASS& np,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_PLY(os, g, std::string(), np); return write_PLY(os, g, std::string(), np);
} }
template <typename Graph> template <typename Graph>
bool write_PLY(std::ostream& os, const Graph& g, bool write_PLY(std::ostream& os, const Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_PLY(os, g, std::string(), parameters::all_default()); return write_PLY(os, g, std::string(), parameters::all_default());
} }
@ -507,14 +506,14 @@ bool write_PLY(std::ostream& os, const Graph& g,
\cgalParamNBegin{vertex_color_map} \cgalParamNBegin{vertex_color_map}
\cgalParamDescription{a property map associating colors to the vertices of `g`} \cgalParamDescription{a property map associating colors to the vertices of `g`}
\cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor` \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%vertex_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{no vertex color in the output} \cgalParamDefault{no vertex color in the output}
\cgalParamNEnd \cgalParamNEnd
\cgalParamNBegin{face_color_map} \cgalParamNBegin{face_color_map}
\cgalParamDescription{a property map associating colors to the faces of `g`} \cgalParamDescription{a property map associating colors to the faces of `g`}
\cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor` \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<Graph>::%face_descriptor`
as key type and `CGAL::Color` as value type} as key type and `CGAL::IO::Color` as value type}
\cgalParamDefault{no face color in the output} \cgalParamDefault{no face color in the output}
\cgalParamNEnd \cgalParamNEnd
@ -534,7 +533,7 @@ bool write_PLY(const std::string& fname,
const std::string& comments, const std::string& comments,
const CGAL_BGL_NP_CLASS& np const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING
, typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr , typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr
#endif #endif
) )
{ {
@ -542,13 +541,13 @@ bool write_PLY(const std::string& fname,
if(binary) if(binary)
{ {
std::ofstream os(fname, std::ios::binary); std::ofstream os(fname, std::ios::binary);
CGAL::set_mode(os, CGAL::IO::BINARY); CGAL::IO::set_mode(os, CGAL::IO::BINARY);
return write_PLY(os, g, comments, np); return write_PLY(os, g, comments, np);
} }
else else
{ {
std::ofstream os(fname); std::ofstream os(fname);
CGAL::set_mode(os, CGAL::IO::ASCII); CGAL::IO::set_mode(os, CGAL::IO::ASCII);
return write_PLY(os, g, comments, np); return write_PLY(os, g, comments, np);
} }
@ -558,27 +557,27 @@ bool write_PLY(const std::string& fname,
template <typename Graph> template <typename Graph>
bool write_PLY(const std::string& fname, const Graph& g, const std::string comments, bool write_PLY(const std::string& fname, const Graph& g, const std::string comments,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_PLY(fname, g, comments, parameters::all_default()); return write_PLY(fname, g, comments, parameters::all_default());
} }
template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
bool write_PLY(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS& np, bool write_PLY(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS& np,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_PLY(fname, g, std::string(), np); return write_PLY(fname, g, std::string(), np);
} }
template <typename Graph> template <typename Graph>
bool write_PLY(const std::string& fname, const Graph& g, bool write_PLY(const std::string& fname, const Graph& g,
typename boost::disable_if<IO::internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr) typename boost::disable_if<internal::is_Point_set_or_Range_or_Iterator<Graph> >::type* = nullptr)
{ {
return write_PLY(fname, g, std::string(), parameters::all_default()); return write_PLY(fname, g, std::string(), parameters::all_default());
} }
/// \endcond /// \endcond
} // namespace CGAL } } // namespace CGAL::IO
#endif // CGAL_BGL_IO_PLY_H #endif // CGAL_BGL_IO_PLY_H

View File

@ -63,7 +63,6 @@ public:
}; };
} // namespace internal } // namespace internal
} // namespace IO
/*! /*!
\ingroup PkgBGLIoFuncsSTL \ingroup PkgBGLIoFuncsSTL
@ -113,7 +112,7 @@ bool read_STL(std::istream& is,
typedef typename boost::property_traits<VPM>::value_type Point; typedef typename boost::property_traits<VPM>::value_type Point;
if(!is.good()) if(!is.good())
return false; return false;
IO::internal::STL_builder<Graph, Point> builder(is); internal::STL_builder<Graph, Point> builder(is);
return builder(g, np); return builder(g, np);
} }
@ -173,7 +172,7 @@ bool read_STL(const std::string& fname,
if(binary) if(binary)
{ {
std::ifstream is(fname, std::ios::binary); std::ifstream is(fname, std::ios::binary);
CGAL::set_mode(is, CGAL::IO::BINARY); CGAL::IO::set_mode(is, CGAL::IO::BINARY);
if(read_STL(is, g, np)) if(read_STL(is, g, np))
{ {
return true; return true;
@ -181,7 +180,7 @@ bool read_STL(const std::string& fname,
g.clear(); g.clear();
} }
std::ifstream is(fname); std::ifstream is(fname);
CGAL::set_mode(is, CGAL::IO::ASCII); CGAL::IO::set_mode(is, CGAL::IO::ASCII);
typedef typename CGAL::GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::type VPM; typedef typename CGAL::GetVertexPointMap<Graph, CGAL_BGL_NP_CLASS>::type VPM;
VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point),
@ -264,7 +263,7 @@ bool write_STL(std::ostream& os,
set_stream_precision_from_NP(os, np); set_stream_precision_from_NP(os, np);
if(get_mode(os) == IO::BINARY) if(get_mode(os) == BINARY)
{ {
os << "FileType: Binary "; os << "FileType: Binary ";
const boost::uint32_t N32 = static_cast<boost::uint32_t>(faces(g).size()); const boost::uint32_t N32 = static_cast<boost::uint32_t>(faces(g).size());
@ -364,13 +363,13 @@ bool write_STL(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS
if(binary) if(binary)
{ {
std::ofstream os(fname, std::ios::binary); std::ofstream os(fname, std::ios::binary);
CGAL::set_mode(os, CGAL::IO::BINARY); CGAL::IO::set_mode(os, CGAL::IO::BINARY);
return write_STL(os, g, np); return write_STL(os, g, np);
} }
else else
{ {
std::ofstream os(fname); std::ofstream os(fname);
CGAL::set_mode(os, CGAL::IO::ASCII); CGAL::IO::set_mode(os, CGAL::IO::ASCII);
return write_STL(os, g, np); return write_STL(os, g, np);
} }
@ -385,6 +384,6 @@ bool write_STL(const std::string& fname, const Graph& g) { return write_STL(fnam
/// \endcond /// \endcond
} // namespace CGAL }} // namespace CGAL::IO
#endif // CGAL_BGL_IO_STL_H #endif // CGAL_BGL_IO_STL_H

View File

@ -113,7 +113,6 @@ bool vtkPointSet_to_polygon_mesh(vtkPointSet* poly_data,
} }
} // namespace internal } // namespace internal
} // namespace IO
/*! /*!
* \ingroup PkgBGLIoFuncsVTP * \ingroup PkgBGLIoFuncsVTP
@ -160,13 +159,13 @@ bool read_VTP(const std::string& fname,
} }
test.close(); test.close();
vtkSmartPointer<vtkPointSet> data; vtkSmartPointer<vtkPointSet> data;
vtkSmartPointer<IO::internal::ErrorObserverVtk> obs = vtkSmartPointer<internal::ErrorObserverVtk> obs =
vtkSmartPointer<IO::internal::ErrorObserverVtk>::New(); vtkSmartPointer<internal::ErrorObserverVtk>::New();
data = vtkPolyData::SafeDownCast(IO::internal::read_vtk_file<vtkXMLPolyDataReader>(fname, obs)->GetOutput()); data = vtkPolyData::SafeDownCast(internal::read_vtk_file<vtkXMLPolyDataReader>(fname, obs)->GetOutput());
if (obs->GetError()) if (obs->GetError())
return false; return false;
return IO::internal::vtkPointSet_to_polygon_mesh(data, g, np); return internal::vtkPointSet_to_polygon_mesh(data, g, np);
} }
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
@ -180,7 +179,6 @@ bool read_VTP(const std::string& fname, Graph& g) { return read_VTP(fname, g, pa
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Write // Write
namespace IO {
namespace internal { namespace internal {
// writes the polys appended data at the end of the .vtp file // writes the polys appended data at the end of the .vtp file
@ -381,7 +379,6 @@ void write_polys_points(std::ostream& os,
} }
} // namespace internal } // namespace internal
} // namespace IO
/*! \ingroup PkgBGLIoFuncsVTP /*! \ingroup PkgBGLIoFuncsVTP
* *
@ -465,16 +462,16 @@ bool write_VTP(std::ostream& os,
std::size_t offset = 0; std::size_t offset = 0;
const bool binary = choose_parameter(get_parameter(np, internal_np::use_binary_mode), true); const bool binary = choose_parameter(get_parameter(np, internal_np::use_binary_mode), true);
IO::internal::write_points_tag(os, g, binary, offset, np); internal::write_points_tag(os, g, binary, offset, np);
IO::internal::write_polys_tag(os, g, binary, offset, np); internal::write_polys_tag(os, g, binary, offset, np);
os << " </Piece>\n" os << " </Piece>\n"
<< " </PolyData>\n"; << " </PolyData>\n";
if(binary) if(binary)
{ {
os << "<AppendedData encoding=\"raw\">\n_"; os << "<AppendedData encoding=\"raw\">\n_";
IO::internal::write_polys_points(os, g, np); internal::write_polys_points(os, g, np);
IO::internal::write_polys(os, g, np); internal::write_polys(os, g, np);
} }
os << "</VTKFile>" << std::endl; os << "</VTKFile>" << std::endl;
@ -534,7 +531,7 @@ bool write_VTP(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS
std::ofstream os; std::ofstream os;
if(binary){ if(binary){
os.open(fname, std::ios::binary); os.open(fname, std::ios::binary);
CGAL::set_mode(os, CGAL::IO::BINARY); CGAL::IO::set_mode(os, CGAL::IO::BINARY);
} }
else else
os.open(fname); os.open(fname);
@ -551,17 +548,19 @@ bool write_VTP(const std::string& fname, const Graph& g) { return write_VTP(fnam
/// \endcond /// \endcond
} // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE #ifndef CGAL_NO_DEPRECATED_CODE
/*! /*!
\ingroup PkgBGLIOFctDeprecated \ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.2, `CGAL::write_VTP()` should be used instead. \deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_VTP()` should be used instead.
*/ */
template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_vtp(std::ostream& os, const Graph& g, const CGAL_BGL_NP_CLASS& np) CGAL_DEPRECATED bool write_vtp(std::ostream& os, const Graph& g, const CGAL_BGL_NP_CLASS& np)
{ {
return write_VTP(os, g, np); return IO::write_VTP(os, g, np);
} }
template <typename Graph> template <typename Graph>

View File

@ -30,6 +30,8 @@
namespace CGAL { namespace CGAL {
namespace IO {
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Write // Write
@ -71,7 +73,7 @@ bool write_WRL(std::ostream& os,
const CGAL_BGL_NP_CLASS& np) const CGAL_BGL_NP_CLASS& np)
{ {
CGAL::VRML_2_ostream vos(os); CGAL::VRML_2_ostream vos(os);
IO::internal::Generic_facegraph_printer<CGAL::VRML_2_ostream, Graph, CGAL::File_writer_VRML_2> printer(vos); internal::Generic_facegraph_printer<CGAL::VRML_2_ostream, Graph, CGAL::File_writer_VRML_2> printer(vos);
return printer(g, np); return printer(g, np);
} }
@ -118,17 +120,19 @@ bool write_WRL(std::ostream& os, const Graph& g) { return write_WRL(os, g, param
template <typename Graph> template <typename Graph>
bool write_WRL(const std::string& fname, const Graph& g) { return write_WRL(fname, g, parameters::all_default()); } bool write_WRL(const std::string& fname, const Graph& g) { return write_WRL(fname, g, parameters::all_default()); }
} // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE #ifndef CGAL_NO_DEPRECATED_CODE
/*! /*!
\ingroup PkgBGLIOFctDeprecated \ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.2, `CGAL::write_WRL()` should be used instead. \deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_WRL()` should be used instead.
*/ */
template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_wrl(std::ostream& os, const Graph& g, const CGAL_BGL_NP_CLASS& np) CGAL_DEPRECATED bool write_wrl(std::ostream& os, const Graph& g, const CGAL_BGL_NP_CLASS& np)
{ {
return write_WRL(os, g, np); return IO::write_WRL(os, g, np);
} }
template <typename Graph> template <typename Graph>

View File

@ -28,6 +28,8 @@
namespace CGAL { namespace CGAL {
namespace IO {
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Read // Read
@ -121,7 +123,7 @@ bool read_polygon_mesh(std::istream& is,
* *
* \return `true` if reading was successful, `false` otherwise. * \return `true` if reading was successful, `false` otherwise.
* *
* \sa \link PMP_IO_grp `CGAL::Polygon_mesh_processing::read_polygon_mesh()`\endlink if the data is not 2-manifold * \sa \link PMP_IO_grp `CGAL::Polygon_mesh_processing::IO::read_polygon_mesh()`\endlink if the data is not 2-manifold
*/ */
template <class Graph, typename NamedParameters> template <class Graph, typename NamedParameters>
bool read_polygon_mesh(const std::string& fname, bool read_polygon_mesh(const std::string& fname,
@ -130,7 +132,7 @@ bool read_polygon_mesh(const std::string& fname,
{ {
const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false); const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false);
const std::string ext = IO::internal::get_file_extension(fname); const std::string ext = internal::get_file_extension(fname);
if(ext == std::string()) if(ext == std::string())
{ {
if(verbose) if(verbose)
@ -233,7 +235,7 @@ bool write_polygon_mesh(const std::string& fname,
{ {
const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false); const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false);
const std::string ext = IO::internal::get_file_extension(fname); const std::string ext = internal::get_file_extension(fname);
if(ext == std::string()) if(ext == std::string())
{ {
if(verbose) if(verbose)
@ -275,6 +277,6 @@ bool write_polygon_mesh(const std::string& fname, Graph& g)
/// \endcond /// \endcond
} // namespace CGAL }} // namespace CGAL::IO
#endif // CGAL_BOOST_GRAPH_POLYGON_MESH_IO_H #endif // CGAL_BOOST_GRAPH_POLYGON_MESH_IO_H

View File

@ -1137,8 +1137,8 @@ void expand_face_selection_for_removal(const FaceRange& faces_to_be_deleted,
//todo: take non-manifold vertices into account. //todo: take non-manifold vertices into account.
template<class PolygonMesh, class FaceRange> template<class PolygonMesh, class FaceRange>
bool is_selection_a_topological_disk(const FaceRange& face_selection, int euler_characteristic_of_selection(const FaceRange& face_selection,
PolygonMesh& pm) PolygonMesh& pm)
{ {
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<PolygonMesh>::face_descriptor face_descriptor; typedef typename boost::graph_traits<PolygonMesh>::face_descriptor face_descriptor;
@ -1154,8 +1154,18 @@ bool is_selection_a_topological_disk(const FaceRange& face_selection,
sel_edges.insert(edge(h,pm)); sel_edges.insert(edge(h,pm));
} }
} }
return (sel_vertices.size() - sel_edges.size() + face_selection.size() == 1); return static_cast<int>(sel_vertices.size())
- static_cast<int>(sel_edges.size())
+ static_cast<int>(face_selection.size());
} }
template<class PolygonMesh, class FaceRange>
bool is_selection_a_topological_disk(const FaceRange& face_selection,
PolygonMesh& pm)
{
return euler_characteristic_of_selection(face_selection, pm) == 1;
}
} //end of namespace CGAL } //end of namespace CGAL
#endif //CGAL_BOOST_GRAPH_SELECTION_H #endif //CGAL_BOOST_GRAPH_SELECTION_H

View File

@ -26,11 +26,11 @@ namespace CGAL
struct DefaultColorFunctorFaceGraph struct DefaultColorFunctorFaceGraph
{ {
template<typename Graph> template<typename Graph>
CGAL::Color operator()(const Graph&, CGAL::IO::Color operator()(const Graph&,
typename boost::graph_traits<Graph>::face_descriptor fh) const typename boost::graph_traits<Graph>::face_descriptor fh) const
{ {
if (fh==boost::graph_traits<Graph>::null_face()) // use to get the mono color if (fh==boost::graph_traits<Graph>::null_face()) // use to get the mono color
return CGAL::Color(100, 125, 200); // R G B between 0-255 return CGAL::IO::Color(100, 125, 200); // R G B between 0-255
return get_random_color(CGAL::get_default_random()); return get_random_color(CGAL::get_default_random());
} }
@ -141,7 +141,7 @@ protected:
{ {
if (fh!=boost::graph_traits<SM>::null_face()) if (fh!=boost::graph_traits<SM>::null_face())
{ {
CGAL::Color c=fcolor(sm, fh); CGAL::IO::Color c=fcolor(sm, fh);
face_begin(c); face_begin(c);
auto hd=halfedge(fh, sm); auto hd=halfedge(fh, sm);
const auto first_hd = hd; const auto first_hd = hd;

View File

@ -31,7 +31,7 @@ int main(int argc, char** argv)
Mesh m; Mesh m;
const char* filename = (argc>1) ? argv[1] : "data/genus3.off"; const char* filename = (argc>1) ? argv[1] : "data/genus3.off";
CGAL::read_polygon_mesh(filename, m); CGAL::IO::read_polygon_mesh(filename, m);
std::cout << " is_valid? " << CGAL::is_valid_polygon_mesh(m) << "\n"; std::cout << " is_valid? " << CGAL::is_valid_polygon_mesh(m) << "\n";
std::cout << "Total time: " << timer.time() << std::endl << std::endl; std::cout << "Total time: " << timer.time() << std::endl << std::endl;
@ -48,7 +48,7 @@ int main(int argc, char** argv)
const char* filename = (argc>1) ? argv[1] : "data/blobby.off"; const char* filename = (argc>1) ? argv[1] : "data/blobby.off";
std::vector<Kernel::Point_3> points; std::vector<Kernel::Point_3> points;
std::vector<std::array<std::size_t, 3> > faces_ids; std::vector<std::array<std::size_t, 3> > faces_ids;
CGAL::read_polygon_soup(filename, points, faces_ids); CGAL::IO::read_polygon_soup(filename, points, faces_ids);
std::cout << " Read soup: " << timer.time() << std::endl; std::cout << " Read soup: " << timer.time() << std::endl;
std::vector<std::array<Mesh::Vertex_index, 3> > triangles; std::vector<std::array<Mesh::Vertex_index, 3> > triangles;
@ -85,7 +85,7 @@ int main(int argc, char** argv)
std::vector<Kernel::Point_3> points; std::vector<Kernel::Point_3> points;
std::vector<std::array<std::size_t, 3> > faces_ids; std::vector<std::array<std::size_t, 3> > faces_ids;
CGAL::read_polygon_soup(filename, points, faces_ids); CGAL::IO::read_polygon_soup(filename, points, faces_ids);
std::cout << " Read soup: " << timer.time() << std::endl; std::cout << " Read soup: " << timer.time() << std::endl;
std::vector<std::array<Mesh::Vertex_index, 3> > triangles; std::vector<std::array<Mesh::Vertex_index, 3> > triangles;

View File

@ -24,7 +24,7 @@ typedef CGAL::Surface_mesh<Point_3> Mesh;
typedef std::vector<Point_3> PointRange; typedef std::vector<Point_3> PointRange;
typedef std::vector<std::size_t> Polygon; typedef std::vector<std::size_t> Polygon;
typedef std::vector<Polygon> PolygonRange; typedef std::vector<Polygon> PolygonRange;
typedef std::vector<CGAL::Color> ColorRange; typedef std::vector<CGAL::IO::Color> ColorRange;
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
@ -38,7 +38,7 @@ int main(int argc, char** argv)
std::vector<Mesh> meshes; std::vector<Mesh> meshes;
//testing reading functions. //testing reading functions.
if(!CGAL::read_3MF(filename, meshes)) if(!CGAL::IO::read_3MF(filename, meshes))
return 1; return 1;
for(std::size_t i = 0; i< meshes.size(); ++i) for(std::size_t i = 0; i< meshes.size(); ++i)
{ {
@ -86,7 +86,7 @@ int main(int argc, char** argv)
triangle.push_back(vertex_id_map[vert]); triangle.push_back(vertex_id_map[vert]);
} }
triangles.push_back(triangle); triangles.push_back(triangle);
colors.push_back(CGAL::Color(255,0,0,255)); colors.push_back(CGAL::IO::Color(255,0,0,255));
} }
all_polygons.push_back(triangles); all_polygons.push_back(triangles);
@ -113,7 +113,7 @@ int main(int argc, char** argv)
triangle.push_back(vertex_id_map[vert]); triangle.push_back(vertex_id_map[vert]);
} }
triangles.push_back(triangle); triangles.push_back(triangle);
colors.push_back(CGAL::Color(0,0,255,255)); colors.push_back(CGAL::IO::Color(0,0,255,255));
} }
all_polygons.push_back(triangles); all_polygons.push_back(triangles);
@ -125,7 +125,7 @@ int main(int argc, char** argv)
meshes[0] = sphere; meshes[0] = sphere;
meshes[1] = tube; meshes[1] = tube;
CGAL::write_3MF("meshes.3mf", meshes, names); CGAL::IO::write_3MF("meshes.3mf", meshes, names);
std::cout << "OK." << std::endl; std::cout << "OK." << std::endl;
#endif //CGAL_LINKED_WITH_3MF #endif //CGAL_LINKED_WITH_3MF

View File

@ -43,7 +43,7 @@ collapse_edge_test()
const std::string fname = "data/flat_hexahedron.off"; const std::string fname = "data/flat_hexahedron.off";
Mesh m; Mesh m;
if(!CGAL::read_OFF(fname, m)) if(!CGAL::IO::read_OFF(fname, m))
std::cout << "Error reading file: " << fname << std::endl; std::cout << "Error reading file: " << fname << std::endl;
bool m_is_valid = CGAL::is_valid(m); bool m_is_valid = CGAL::is_valid(m);

View File

@ -540,7 +540,7 @@ add_faces()
std::ifstream in("data/head.off"); std::ifstream in("data/head.off");
std::vector<Kernel::Point_3> points; std::vector<Kernel::Point_3> points;
std::vector<std::array<std::size_t, 3> > faces_ids; std::vector<std::array<std::size_t, 3> > faces_ids;
CGAL::read_OFF(in, points, faces_ids); CGAL::IO::read_OFF(in, points, faces_ids);
std::vector<vertex_descriptor> verts; std::vector<vertex_descriptor> verts;
verts.reserve(points.size()); verts.reserve(points.size());
@ -561,7 +561,7 @@ add_faces()
{ {
std::ifstream in("data/open_cube.off"); std::ifstream in("data/open_cube.off");
T m; T m;
CGAL::read_OFF(in, m); CGAL::IO::read_OFF(in, m);
std::vector<vertex_descriptor> verts(vertices(m).begin(), vertices(m).end()); std::vector<vertex_descriptor> verts(vertices(m).begin(), vertices(m).end());
std::list< std::vector<vertex_descriptor> > new_faces; std::list< std::vector<vertex_descriptor> > new_faces;
new_faces.push_back({verts[1], verts[7], verts[4]}); new_faces.push_back({verts[1], verts[7], verts[4]});
@ -574,7 +574,7 @@ add_faces()
{ {
std::ifstream in("data/open_cube.off"); std::ifstream in("data/open_cube.off");
T m; T m;
CGAL::read_OFF(in, m); CGAL::IO::read_OFF(in, m);
std::vector<vertex_descriptor> verts(vertices(m).begin(), vertices(m).end()); std::vector<vertex_descriptor> verts(vertices(m).begin(), vertices(m).end());
verts.push_back(add_vertex(m)); verts.push_back(add_vertex(m));
put(CGAL::vertex_point, m, verts.back(), Kernel::Point_3(50,0,50)); put(CGAL::vertex_point, m, verts.back(), Kernel::Point_3(50,0,50));

View File

@ -160,7 +160,7 @@ bool read_a_mesh(OMesh& s, const std::string& str) {
template<typename T> template<typename T>
bool read_a_mesh(T& m, const std::string& str) bool read_a_mesh(T& m, const std::string& str)
{ {
return CGAL::read_OFF(str, m); return CGAL::IO::read_OFF(str, m);
} }
bool read_a_mesh(Polyhedron& p, const std::string& str) bool read_a_mesh(Polyhedron& p, const std::string& str)

View File

@ -118,35 +118,35 @@ void test_bgl_OFF(const char* filename)
// read with OFF // read with OFF
Mesh fg; Mesh fg;
std::ifstream is(filename); std::ifstream is(filename);
bool ok = CGAL::read_OFF(is, fg); bool ok = CGAL::IO::read_OFF(is, fg);
assert(ok); assert(ok);
assert(num_vertices(fg) != 0 && num_faces(fg) != 0); assert(num_vertices(fg) != 0 && num_faces(fg) != 0);
is.close(); is.close();
fg.clear(); fg.clear();
is.open(filename, std::ios::binary); is.open(filename, std::ios::binary);
ok = CGAL::read_OFF(is, fg); ok = CGAL::IO::read_OFF(is, fg);
assert(ok); assert(ok);
assert(num_vertices(fg) != 0 && num_faces(fg) != 0); assert(num_vertices(fg) != 0 && num_faces(fg) != 0);
// write with OFF // write with OFF
{ {
std::ofstream os("tmp.off"); std::ofstream os("tmp.off");
ok = CGAL::write_OFF(os, fg); ok = CGAL::IO::write_OFF(os, fg);
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_OFF("tmp.off", fg2); ok = CGAL::IO::read_OFF("tmp.off", fg2);
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
// write with PM // write with PM
{ {
ok = CGAL::write_polygon_mesh("tmp.obj.off", fg); ok = CGAL::IO::write_polygon_mesh("tmp.obj.off", fg);
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_polygon_mesh("tmp.obj.off", fg2); ok = CGAL::IO::read_polygon_mesh("tmp.obj.off", fg2);
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
@ -156,63 +156,63 @@ void test_bgl_OFF(const char* filename)
typedef typename K::Point_2 Point_2; typedef typename K::Point_2 Point_2;
typedef typename K::Vector_3 Vector; typedef typename K::Vector_3 Vector;
typedef typename boost::property_map<Mesh, CGAL::dynamic_vertex_property_t<Vector> >::type VertexNormalMap; typedef typename boost::property_map<Mesh, CGAL::dynamic_vertex_property_t<Vector> >::type VertexNormalMap;
typedef typename boost::property_map<Mesh, CGAL::dynamic_vertex_property_t<CGAL::Color> >::type VertexColorMap; typedef typename boost::property_map<Mesh, CGAL::dynamic_vertex_property_t<CGAL::IO::Color> >::type VertexColorMap;
typedef typename boost::property_map<Mesh, CGAL::dynamic_vertex_property_t<Point_2> >::type VertexTextureMap; typedef typename boost::property_map<Mesh, CGAL::dynamic_vertex_property_t<Point_2> >::type VertexTextureMap;
typedef typename boost::property_map<Mesh, CGAL::dynamic_face_property_t<CGAL::Color> >::type FaceColorMap; typedef typename boost::property_map<Mesh, CGAL::dynamic_face_property_t<CGAL::IO::Color> >::type FaceColorMap;
// COFF // COFF
{ {
CGAL::clear(fg); CGAL::clear(fg);
VertexColorMap vcm = get(CGAL::dynamic_vertex_property_t<CGAL::Color>(), fg); VertexColorMap vcm = get(CGAL::dynamic_vertex_property_t<CGAL::IO::Color>(), fg);
FaceColorMap fcm = get(CGAL::dynamic_face_property_t<CGAL::Color>(), fg); FaceColorMap fcm = get(CGAL::dynamic_face_property_t<CGAL::IO::Color>(), fg);
ok = CGAL::read_OFF("data/mesh_with_colors.off", fg, CGAL::parameters::vertex_color_map(vcm) ok = CGAL::IO::read_OFF("data/mesh_with_colors.off", fg, CGAL::parameters::vertex_color_map(vcm)
.face_color_map(fcm)); .face_color_map(fcm));
assert(ok); assert(ok);
assert(num_vertices(fg) == 8 && num_faces(fg) == 4); assert(num_vertices(fg) == 8 && num_faces(fg) == 4);
for(auto v : vertices(fg)) for(auto v : vertices(fg))
assert(get(vcm, v) != CGAL::Color()); assert(get(vcm, v) != CGAL::IO::Color());
for(auto f : faces(fg)) for(auto f : faces(fg))
assert(get(fcm, f) != CGAL::Color()); assert(get(fcm, f) != CGAL::IO::Color());
// write with OFF // write with OFF
{ {
ok = CGAL::write_OFF("tmp.off", fg, CGAL::parameters::vertex_color_map(vcm) ok = CGAL::IO::write_OFF("tmp.off", fg, CGAL::parameters::vertex_color_map(vcm)
.face_color_map(fcm)); .face_color_map(fcm));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::Color>(), fg2); VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::IO::Color>(), fg2);
FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::Color>(), fg2); FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::IO::Color>(), fg2);
ok = CGAL::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_color_map(vcm2) ok = CGAL::IO::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_color_map(vcm2)
.face_color_map(fcm2)); .face_color_map(fcm2));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
for(auto v : vertices(fg2)) for(auto v : vertices(fg2))
assert(get(vcm2, v) != CGAL::Color()); assert(get(vcm2, v) != CGAL::IO::Color());
for(auto f : faces(fg2)) for(auto f : faces(fg2))
assert(get(fcm2, f) != CGAL::Color()); assert(get(fcm2, f) != CGAL::IO::Color());
} }
// write with PM // write with PM
{ {
ok = CGAL::write_polygon_mesh("tmp.off", fg, CGAL::parameters::vertex_color_map(vcm)); ok = CGAL::IO::write_polygon_mesh("tmp.off", fg, CGAL::parameters::vertex_color_map(vcm));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::Color>(), fg2); VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::IO::Color>(), fg2);
ok = CGAL::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_color_map(vcm2)); ok = CGAL::IO::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_color_map(vcm2));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
for(auto v : vertices(fg2)) for(auto v : vertices(fg2))
assert(get(vcm2, v) != CGAL::Color()); assert(get(vcm2, v) != CGAL::IO::Color());
} }
} }
@ -221,7 +221,7 @@ void test_bgl_OFF(const char* filename)
CGAL::clear(fg); CGAL::clear(fg);
VertexNormalMap vnm = get(CGAL::dynamic_vertex_property_t<Vector>(), fg); VertexNormalMap vnm = get(CGAL::dynamic_vertex_property_t<Vector>(), fg);
ok = CGAL::read_OFF("data/mesh_with_normals.off", fg, CGAL::parameters::vertex_normal_map(vnm)); ok = CGAL::IO::read_OFF("data/mesh_with_normals.off", fg, CGAL::parameters::vertex_normal_map(vnm));
assert(ok); assert(ok);
for(auto v : vertices(fg)) for(auto v : vertices(fg))
@ -230,13 +230,13 @@ void test_bgl_OFF(const char* filename)
// write with OFF // write with OFF
{ {
std::ofstream os("tmp.off"); std::ofstream os("tmp.off");
ok = CGAL::write_OFF("tmp.off", fg, CGAL::parameters::vertex_normal_map(vnm)); ok = CGAL::IO::write_OFF("tmp.off", fg, CGAL::parameters::vertex_normal_map(vnm));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
VertexNormalMap vnm2 = get(CGAL::dynamic_vertex_property_t<Vector>(), fg2); VertexNormalMap vnm2 = get(CGAL::dynamic_vertex_property_t<Vector>(), fg2);
ok = CGAL::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_normal_map(vnm2)); ok = CGAL::IO::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_normal_map(vnm2));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
@ -246,13 +246,13 @@ void test_bgl_OFF(const char* filename)
// write with PM // write with PM
{ {
ok = CGAL::write_polygon_mesh("tmp.off", fg, CGAL::parameters::vertex_normal_map(vnm)); ok = CGAL::IO::write_polygon_mesh("tmp.off", fg, CGAL::parameters::vertex_normal_map(vnm));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
VertexNormalMap vnm2 = get(CGAL::dynamic_vertex_property_t<Vector>(), fg2); VertexNormalMap vnm2 = get(CGAL::dynamic_vertex_property_t<Vector>(), fg2);
ok = CGAL::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_normal_map(vnm2)); ok = CGAL::IO::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_normal_map(vnm2));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
@ -267,121 +267,121 @@ void test_bgl_OFF(const char* filename)
std::ifstream is("data/full.off", std::ios::binary); std::ifstream is("data/full.off", std::ios::binary);
VertexNormalMap vnm2 = get(CGAL::dynamic_vertex_property_t<Vector>(), fg); VertexNormalMap vnm2 = get(CGAL::dynamic_vertex_property_t<Vector>(), fg);
VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::Color>(), fg); VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::IO::Color>(), fg);
VertexTextureMap vtm2 = get(CGAL::dynamic_vertex_property_t<Point_2>(), fg); VertexTextureMap vtm2 = get(CGAL::dynamic_vertex_property_t<Point_2>(), fg);
FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::Color>(), fg); FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::IO::Color>(), fg);
ok = CGAL::read_OFF(is, fg, CGAL::parameters::vertex_normal_map(vnm2) ok = CGAL::IO::read_OFF(is, fg, CGAL::parameters::vertex_normal_map(vnm2)
.vertex_color_map(vcm2) .vertex_color_map(vcm2)
.vertex_texture_map(vtm2) .vertex_texture_map(vtm2)
.face_color_map(fcm2)); .face_color_map(fcm2));
assert(ok); assert(ok);
assert(num_vertices(fg) != 0 && num_faces(fg) != 0); assert(num_vertices(fg) != 0 && num_faces(fg) != 0);
for(auto v : vertices(fg)) for(auto v : vertices(fg))
{ {
assert(get(vnm2, v) != CGAL::NULL_VECTOR); assert(get(vnm2, v) != CGAL::NULL_VECTOR);
assert(get(vcm2, v) != CGAL::Color()); assert(get(vcm2, v) != CGAL::IO::Color());
} }
for(auto f : faces(fg)) for(auto f : faces(fg))
assert(get(fcm2, f) != CGAL::Color()); assert(get(fcm2, f) != CGAL::IO::Color());
fg.clear(); fg.clear();
is.close(); is.close();
is.open("data/full.off"); is.open("data/full.off");
VertexNormalMap vnm = get(CGAL::dynamic_vertex_property_t<Vector>(), fg); VertexNormalMap vnm = get(CGAL::dynamic_vertex_property_t<Vector>(), fg);
VertexColorMap vcm = get(CGAL::dynamic_vertex_property_t<CGAL::Color>(), fg); VertexColorMap vcm = get(CGAL::dynamic_vertex_property_t<CGAL::IO::Color>(), fg);
VertexTextureMap vtm = get(CGAL::dynamic_vertex_property_t<Point_2>(), fg); VertexTextureMap vtm = get(CGAL::dynamic_vertex_property_t<Point_2>(), fg);
FaceColorMap fcm = get(CGAL::dynamic_face_property_t<CGAL::Color>(), fg); FaceColorMap fcm = get(CGAL::dynamic_face_property_t<CGAL::IO::Color>(), fg);
ok = CGAL::read_OFF(is, fg, CGAL::parameters::vertex_normal_map(vnm) ok = CGAL::IO::read_OFF(is, fg, CGAL::parameters::vertex_normal_map(vnm)
.vertex_color_map(vcm) .vertex_color_map(vcm)
.vertex_texture_map(vtm) .vertex_texture_map(vtm)
.face_color_map(fcm)); .face_color_map(fcm));
assert(ok); assert(ok);
assert(num_vertices(fg) != 0 && num_faces(fg) != 0); assert(num_vertices(fg) != 0 && num_faces(fg) != 0);
for(auto v : vertices(fg)) for(auto v : vertices(fg))
{ {
assert(get(vnm, v) != CGAL::NULL_VECTOR); assert(get(vnm, v) != CGAL::NULL_VECTOR);
assert(get(vcm, v) != CGAL::Color()); assert(get(vcm, v) != CGAL::IO::Color());
} }
// write with OFF // write with OFF
{ {
std::ofstream os("tmp.off"); std::ofstream os("tmp.off");
ok = CGAL::write_OFF("tmp.off", fg, CGAL::parameters::vertex_normal_map(vnm) ok = CGAL::IO::write_OFF("tmp.off", fg, CGAL::parameters::vertex_normal_map(vnm)
.vertex_color_map(vcm) .vertex_color_map(vcm)
.vertex_texture_map(vtm) .vertex_texture_map(vtm)
.face_color_map(fcm)); .face_color_map(fcm));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
VertexNormalMap vnm2 = get(CGAL::dynamic_vertex_property_t<Vector>(), fg2); VertexNormalMap vnm2 = get(CGAL::dynamic_vertex_property_t<Vector>(), fg2);
VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::Color>(), fg2); VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::IO::Color>(), fg2);
VertexTextureMap vtm2 = get(CGAL::dynamic_vertex_property_t<Point_2>(), fg2); VertexTextureMap vtm2 = get(CGAL::dynamic_vertex_property_t<Point_2>(), fg2);
FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::Color>(), fg2); FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::IO::Color>(), fg2);
ok = CGAL::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_normal_map(vnm2) ok = CGAL::IO::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_normal_map(vnm2)
.vertex_color_map(vcm2) .vertex_color_map(vcm2)
.vertex_texture_map(vtm2) .vertex_texture_map(vtm2)
.face_color_map(fcm2)); .face_color_map(fcm2));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
for(auto v : vertices(fg2)) for(auto v : vertices(fg2))
{ {
assert(get(vnm2, v) != CGAL::NULL_VECTOR); assert(get(vnm2, v) != CGAL::NULL_VECTOR);
assert(get(vcm2, v) != CGAL::Color()); assert(get(vcm2, v) != CGAL::IO::Color());
} }
for(auto f : faces(fg2)) for(auto f : faces(fg2))
assert(get(fcm2, f) != CGAL::Color()); assert(get(fcm2, f) != CGAL::IO::Color());
} }
// write with PM // write with PM
{ {
ok = CGAL::write_polygon_mesh("tmp.off", fg, CGAL::parameters::vertex_normal_map(vnm) ok = CGAL::IO::write_polygon_mesh("tmp.off", fg, CGAL::parameters::vertex_normal_map(vnm)
.vertex_color_map(vcm) .vertex_color_map(vcm)
.vertex_texture_map(vtm) .vertex_texture_map(vtm)
.face_color_map(fcm)); .face_color_map(fcm));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
VertexNormalMap vnm2 = get(CGAL::dynamic_vertex_property_t<Vector>(), fg2); VertexNormalMap vnm2 = get(CGAL::dynamic_vertex_property_t<Vector>(), fg2);
VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::Color>(), fg2); VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::IO::Color>(), fg2);
VertexTextureMap vtm2 = get(CGAL::dynamic_vertex_property_t<Point_2>(), fg2); VertexTextureMap vtm2 = get(CGAL::dynamic_vertex_property_t<Point_2>(), fg2);
FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::Color>(), fg2); FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::IO::Color>(), fg2);
ok = CGAL::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_normal_map(vnm2) ok = CGAL::IO::read_polygon_mesh("tmp.off", fg2, CGAL::parameters::vertex_normal_map(vnm2)
.vertex_color_map(vcm2) .vertex_color_map(vcm2)
.vertex_texture_map(vtm2) .vertex_texture_map(vtm2)
.face_color_map(fcm2)); .face_color_map(fcm2));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
for(auto v : vertices(fg2)) for(auto v : vertices(fg2))
{ {
assert(get(vnm2, v) != CGAL::NULL_VECTOR); assert(get(vnm2, v) != CGAL::NULL_VECTOR);
assert(get(vcm2, v) != CGAL::Color()); assert(get(vcm2, v) != CGAL::IO::Color());
} }
for(auto f : faces(fg2)) for(auto f : faces(fg2))
assert(get(fcm2, f) != CGAL::Color()); assert(get(fcm2, f) != CGAL::IO::Color());
} }
} }
//@todo test multi objects in a single file //@todo test multi objects in a single file
// test wrong inputs // test wrong inputs
std::cerr << " ########### Error text is expected to follow." << std::endl; std::cerr << " ########### Error text is expected to follow." << std::endl;
ok = CGAL::read_OFF("data/mesh_that_doesnt_exist.off", fg); ok = CGAL::IO::read_OFF("data/mesh_that_doesnt_exist.off", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_OFF("data/invalid_cut.off", fg); // cut in half ok = CGAL::IO::read_OFF("data/invalid_cut.off", fg); // cut in half
assert(!ok); assert(!ok);
ok = CGAL::read_OFF("data/invalid_nv.off", fg); // wrong number of points ok = CGAL::IO::read_OFF("data/invalid_nv.off", fg); // wrong number of points
assert(!ok); assert(!ok);
ok = CGAL::read_OFF("data/sphere.obj", fg); ok = CGAL::IO::read_OFF("data/sphere.obj", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_OFF("data/pig.stl", fg); ok = CGAL::IO::read_OFF("data/pig.stl", fg);
assert(!ok); assert(!ok);
std::cerr << " ########### No more error text from here." << std::endl; std::cerr << " ########### No more error text from here." << std::endl;
} }
@ -394,72 +394,72 @@ void test_bgl_OBJ(const std::string filename)
Mesh fg; Mesh fg;
std::ifstream is(filename); std::ifstream is(filename);
bool ok = CGAL::read_OBJ(is, fg, CGAL::parameters::verbose(true)); bool ok = CGAL::IO::read_OBJ(is, fg, CGAL::parameters::verbose(true));
assert(ok); assert(ok);
assert(filename != "data/sphere.obj" || (num_vertices(fg) == 272 && num_faces(fg) == 540)); assert(filename != "data/sphere.obj" || (num_vertices(fg) == 272 && num_faces(fg) == 540));
// write with OBJ // write with OBJ
{ {
std::ofstream os("tmp.obj"); std::ofstream os("tmp.obj");
ok = CGAL::write_OBJ(os, fg); ok = CGAL::IO::write_OBJ(os, fg);
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_OBJ("tmp.obj", fg2); ok = CGAL::IO::read_OBJ("tmp.obj", fg2);
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
// write with PM // write with PM
{ {
ok = CGAL::write_polygon_mesh("tmp.obj", fg); ok = CGAL::IO::write_polygon_mesh("tmp.obj", fg);
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_polygon_mesh("tmp.obj", fg2); ok = CGAL::IO::read_polygon_mesh("tmp.obj", fg2);
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
// Test NPs // Test NPs
CGAL::clear(fg); CGAL::clear(fg);
ok = CGAL::read_OBJ("data/sphere.obj", fg); ok = CGAL::IO::read_OBJ("data/sphere.obj", fg);
assert(ok); assert(ok);
assert(num_vertices(fg) == 272 && num_faces(fg) == 540); assert(num_vertices(fg) == 272 && num_faces(fg) == 540);
// write with OBJ // write with OBJ
{ {
std::ofstream os("tmp.obj"); std::ofstream os("tmp.obj");
ok = CGAL::write_OBJ("tmp.obj", fg); ok = CGAL::IO::write_OBJ("tmp.obj", fg);
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_polygon_mesh("tmp.obj", fg2); ok = CGAL::IO::read_polygon_mesh("tmp.obj", fg2);
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
// write with PM // write with PM
{ {
ok = CGAL::write_polygon_mesh("tmp.obj", fg); ok = CGAL::IO::write_polygon_mesh("tmp.obj", fg);
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_polygon_mesh("tmp.obj", fg2); ok = CGAL::IO::read_polygon_mesh("tmp.obj", fg2);
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
// test wrong inputs // test wrong inputs
std::cerr << " ########### Error text is expected to follow." << std::endl; std::cerr << " ########### Error text is expected to follow." << std::endl;
ok = CGAL::read_OBJ("data/mesh_that_doesnt_exist.obj", fg); ok = CGAL::IO::read_OBJ("data/mesh_that_doesnt_exist.obj", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_OBJ("data/invalid_cut.obj", fg); // invalid vertex ids ok = CGAL::IO::read_OBJ("data/invalid_cut.obj", fg); // invalid vertex ids
assert(!ok); assert(!ok);
ok = CGAL::read_OBJ("data/genus3.off", fg); // wrong extension ok = CGAL::IO::read_OBJ("data/genus3.off", fg); // wrong extension
assert(!ok); assert(!ok);
ok = CGAL::read_OBJ("data/pig.stl", fg); ok = CGAL::IO::read_OBJ("data/pig.stl", fg);
assert(!ok); assert(!ok);
std::cerr << " ########### No more error text from here." << std::endl; std::cerr << " ########### No more error text from here." << std::endl;
} }
@ -472,7 +472,7 @@ void test_bgl_PLY(const std::string filename,
Mesh fg; Mesh fg;
std::ifstream is(filename); std::ifstream is(filename);
bool ok = CGAL::read_PLY(is, fg, CGAL::parameters::use_binary_mode(false)); bool ok = CGAL::IO::read_PLY(is, fg, CGAL::parameters::use_binary_mode(false));
is.close(); is.close();
assert(ok); assert(ok);
assert(filename != "data/colored_tetra.ply" || (num_vertices(fg) == 4 && num_faces(fg) == 4)); assert(filename != "data/colored_tetra.ply" || (num_vertices(fg) == 4 && num_faces(fg) == 4));
@ -480,7 +480,7 @@ void test_bgl_PLY(const std::string filename,
{ {
fg.clear(); fg.clear();
is.open(filename, std::ios::binary); is.open(filename, std::ios::binary);
bool ok = CGAL::read_PLY(is, fg, CGAL::parameters::use_binary_mode(false)); bool ok = CGAL::IO::read_PLY(is, fg, CGAL::parameters::use_binary_mode(false));
is.close(); is.close();
assert(ok); assert(ok);
assert(filename != "data/colored_tetra.ply" || (num_vertices(fg) == 4 && num_faces(fg) == 4)); assert(filename != "data/colored_tetra.ply" || (num_vertices(fg) == 4 && num_faces(fg) == 4));
@ -492,120 +492,120 @@ void test_bgl_PLY(const std::string filename,
if(binary) if(binary)
{ {
os.open("tmp.ply", std::ios::binary); os.open("tmp.ply", std::ios::binary);
CGAL::set_mode(os, CGAL::IO::BINARY); CGAL::IO::set_mode(os, CGAL::IO::BINARY);
} }
else else
{ {
os.open("tmp.ply"); os.open("tmp.ply");
} }
ok = CGAL::write_PLY(os, fg); ok = CGAL::IO::write_PLY(os, fg);
assert(ok); assert(ok);
ok = CGAL::write_PLY(os, fg, "test"); ok = CGAL::IO::write_PLY(os, fg, "test");
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_PLY("tmp.ply", fg2); ok = CGAL::IO::read_PLY("tmp.ply", fg2);
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
// test NPs // test NPs
typedef typename boost::property_map<Mesh, CGAL::dynamic_vertex_property_t<CGAL::Color> >::type VertexColorMap; typedef typename boost::property_map<Mesh, CGAL::dynamic_vertex_property_t<CGAL::IO::Color> >::type VertexColorMap;
typedef typename boost::property_map<Mesh, CGAL::dynamic_face_property_t<CGAL::Color> >::type FaceColorMap; typedef typename boost::property_map<Mesh, CGAL::dynamic_face_property_t<CGAL::IO::Color> >::type FaceColorMap;
CGAL::clear(fg); CGAL::clear(fg);
VertexColorMap vcm = get(CGAL::dynamic_vertex_property_t<CGAL::Color>(), fg); VertexColorMap vcm = get(CGAL::dynamic_vertex_property_t<CGAL::IO::Color>(), fg);
FaceColorMap fcm = get(CGAL::dynamic_face_property_t<CGAL::Color>(), fg); FaceColorMap fcm = get(CGAL::dynamic_face_property_t<CGAL::IO::Color>(), fg);
std::ifstream is_c("data/colored_tetra.ply"); // ASCII std::ifstream is_c("data/colored_tetra.ply"); // ASCII
ok = CGAL::read_PLY(is_c, fg, CGAL::parameters::vertex_color_map(vcm) ok = CGAL::IO::read_PLY(is_c, fg, CGAL::parameters::vertex_color_map(vcm)
.face_color_map(fcm)); .face_color_map(fcm));
assert(ok); assert(ok);
assert(num_vertices(fg) == 4 && num_faces(fg) == 4); assert(num_vertices(fg) == 4 && num_faces(fg) == 4);
for(auto v : vertices(fg)) for(auto v : vertices(fg))
{ {
assert(get(vcm, v) != CGAL::Color()); assert(get(vcm, v) != CGAL::IO::Color());
} }
for(auto f : faces(fg)) for(auto f : faces(fg))
assert(get(fcm, f) != CGAL::Color()); assert(get(fcm, f) != CGAL::IO::Color());
// write with PLY // write with PLY
{ {
ok = CGAL::write_PLY("tmp.ply", fg, CGAL::parameters::vertex_color_map(vcm) ok = CGAL::IO::write_PLY("tmp.ply", fg, CGAL::parameters::vertex_color_map(vcm)
.face_color_map(fcm) .face_color_map(fcm)
.use_binary_mode(binary)); .use_binary_mode(binary));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::Color>(), fg2); VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::IO::Color>(), fg2);
FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::Color>(), fg2); FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::IO::Color>(), fg2);
std::ifstream is_rpm; std::ifstream is_rpm;
if(binary) if(binary)
{ {
is_rpm.open("tmp.ply", std::ios::binary); is_rpm.open("tmp.ply", std::ios::binary);
CGAL::set_mode(is_rpm, CGAL::IO::BINARY); CGAL::IO::set_mode(is_rpm, CGAL::IO::BINARY);
} }
else else
{ {
is_rpm.open("tmp.ply"); is_rpm.open("tmp.ply");
} }
ok = CGAL::read_PLY(is_rpm, fg2, CGAL::parameters::vertex_color_map(vcm2) ok = CGAL::IO::read_PLY(is_rpm, fg2, CGAL::parameters::vertex_color_map(vcm2)
.face_color_map(fcm2)); .face_color_map(fcm2));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
// @tmp // @tmp
// for(auto v : vertices(fg2)) // for(auto v : vertices(fg2))
// assert(get(vcm2, v) != CGAL::Color()); // assert(get(vcm2, v) != CGAL::IO::Color());
// for(auto f : faces(fg2)) // for(auto f : faces(fg2))
// assert(get(fcm2, f) != CGAL::Color()); // assert(get(fcm2, f) != CGAL::IO::Color());
} }
// write with PM // write with PM
{ {
ok = CGAL::write_polygon_mesh("tmp.ply", fg, CGAL::parameters::vertex_color_map(vcm) ok = CGAL::IO::write_polygon_mesh("tmp.ply", fg, CGAL::parameters::vertex_color_map(vcm)
.face_color_map(fcm) .face_color_map(fcm)
.use_binary_mode(binary)); .use_binary_mode(binary));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::Color>(), fg2); VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::IO::Color>(), fg2);
FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::Color>(), fg2); FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::IO::Color>(), fg2);
ok = CGAL::read_polygon_mesh("tmp.ply", fg2, CGAL::parameters::vertex_color_map(vcm2) ok = CGAL::IO::read_polygon_mesh("tmp.ply", fg2, CGAL::parameters::vertex_color_map(vcm2)
.face_color_map(fcm2) .face_color_map(fcm2)
.use_binary_mode(binary)); .use_binary_mode(binary));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
// @tmp // @tmp
// for(auto v : vertices(fg2)) // for(auto v : vertices(fg2))
// assert(get(vcm2, v) != CGAL::Color()); // assert(get(vcm2, v) != CGAL::IO::Color());
// for(auto f : faces(fg2)) // for(auto f : faces(fg2))
// assert(get(fcm2, f) != CGAL::Color()); // assert(get(fcm2, f) != CGAL::IO::Color());
} }
// test wrong inputs // test wrong inputs
std::cerr << " ########### Error text is expected to follow." << std::endl; std::cerr << " ########### Error text is expected to follow." << std::endl;
ok = CGAL::read_PLY("data/mesh_that_doesnt_exist.ply", fg); ok = CGAL::IO::read_PLY("data/mesh_that_doesnt_exist.ply", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_PLY("data/invalid_cut.ply", fg); // cut in half ok = CGAL::IO::read_PLY("data/invalid_cut.ply", fg); // cut in half
assert(!ok); assert(!ok);
ok = CGAL::read_PLY("data/invalid_nv.ply", fg); // broken formatting ok = CGAL::IO::read_PLY("data/invalid_nv.ply", fg); // broken formatting
assert(!ok); assert(!ok);
ok = CGAL::read_PLY("data/binary_cut.ply", fg); // broken binary ok = CGAL::IO::read_PLY("data/binary_cut.ply", fg); // broken binary
assert(!ok); assert(!ok);
ok = CGAL::read_PLY("data/cube.off", fg); ok = CGAL::IO::read_PLY("data/cube.off", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_PLY("data/pig.stl", fg); ok = CGAL::IO::read_PLY("data/pig.stl", fg);
assert(!ok); assert(!ok);
std::cerr << " ########### No more error text from here." << std::endl; std::cerr << " ########### No more error text from here." << std::endl;
} }
@ -635,18 +635,18 @@ void test_bgl_STL(const std::string filename)
{ {
Mesh fg; Mesh fg;
bool ok = CGAL::read_STL(filename, fg); bool ok = CGAL::IO::read_STL(filename, fg);
assert(ok); assert(ok);
ok = CGAL::write_STL("tmp.stl", fg); ok = CGAL::IO::write_STL("tmp.stl", fg);
assert(ok); assert(ok);
// write with ASCII in binary mode // write with ASCII in binary mode
{ {
ok = CGAL::write_polygon_mesh("ascii.stl", fg, CGAL::parameters::use_binary_mode(false)); ok = CGAL::IO::write_polygon_mesh("ascii.stl", fg, CGAL::parameters::use_binary_mode(false));
assert(ok); assert(ok);
std::ifstream test_ascii("ascii.stl", std::ios::binary); std::ifstream test_ascii("ascii.stl", std::ios::binary);
Mesh fg2; Mesh fg2;
ok = CGAL::read_STL(test_ascii, fg2, CGAL::parameters::use_binary_mode(false)); ok = CGAL::IO::read_STL(test_ascii, fg2, CGAL::parameters::use_binary_mode(false));
test_ascii.close(); test_ascii.close();
assert(ok); assert(ok);
assert(num_vertices(fg) == num_vertices(fg2) && num_faces(fg) == num_faces(fg2)); assert(num_vertices(fg) == num_vertices(fg2) && num_faces(fg) == num_faces(fg2));
@ -658,8 +658,8 @@ void test_bgl_STL(const std::string filename)
Custom_VPM<Mesh> cvpm(cpoints); Custom_VPM<Mesh> cvpm(cpoints);
std::ifstream is(filename, std::ios::binary); std::ifstream is(filename, std::ios::binary);
CGAL::set_mode(is, CGAL::IO::BINARY); CGAL::IO::set_mode(is, CGAL::IO::BINARY);
ok = CGAL::read_STL(is, fg, CGAL::parameters::vertex_point_map(cvpm)); ok = CGAL::IO::read_STL(is, fg, CGAL::parameters::vertex_point_map(cvpm));
assert(ok); assert(ok);
assert(filename != "data/pig.stl" || (num_vertices(fg) == 8642 && num_faces(fg) == 16848)); assert(filename != "data/pig.stl" || (num_vertices(fg) == 8642 && num_faces(fg) == 16848));
assert(filename != "data/pig.stl" || cpoints.size() == 8642); assert(filename != "data/pig.stl" || cpoints.size() == 8642);
@ -667,36 +667,36 @@ void test_bgl_STL(const std::string filename)
// write with STL // write with STL
{ {
std::ofstream os("tmp.stl"); std::ofstream os("tmp.stl");
ok = CGAL::write_STL(os, fg, CGAL::parameters::vertex_point_map(cvpm)); ok = CGAL::IO::write_STL(os, fg, CGAL::parameters::vertex_point_map(cvpm));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_STL("tmp.stl", fg2, CGAL::parameters::vertex_point_map(cvpm)); ok = CGAL::IO::read_STL("tmp.stl", fg2, CGAL::parameters::vertex_point_map(cvpm));
assert(ok); assert(ok);
assert(num_vertices(fg) == num_vertices(fg2) && num_faces(fg) == num_faces(fg2)); assert(num_vertices(fg) == num_vertices(fg2) && num_faces(fg) == num_faces(fg2));
} }
// write with PM // write with PM
{ {
ok = CGAL::write_polygon_mesh("tmp.stl", fg, CGAL::parameters::vertex_point_map(cvpm)); ok = CGAL::IO::write_polygon_mesh("tmp.stl", fg, CGAL::parameters::vertex_point_map(cvpm));
assert(ok); assert(ok);
cpoints.clear(); cpoints.clear();
Mesh fg2; Mesh fg2;
ok = CGAL::read_polygon_mesh("tmp.stl", fg2, CGAL::parameters::vertex_point_map(cvpm)); ok = CGAL::IO::read_polygon_mesh("tmp.stl", fg2, CGAL::parameters::vertex_point_map(cvpm));
assert(ok); assert(ok);
assert(num_vertices(fg) == num_vertices(fg2) && num_faces(fg) == num_faces(fg2)); assert(num_vertices(fg) == num_vertices(fg2) && num_faces(fg) == num_faces(fg2));
} }
std::cerr << " ########### Error text is expected to follow." << std::endl; std::cerr << " ########### Error text is expected to follow." << std::endl;
ok = CGAL::read_STL("data/mesh_that_doesnt_exist.stl", fg); ok = CGAL::IO::read_STL("data/mesh_that_doesnt_exist.stl", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_STL("data/invalid_cut.stl", fg); // cut in half ok = CGAL::IO::read_STL("data/invalid_cut.stl", fg); // cut in half
assert(!ok); assert(!ok);
ok = CGAL::read_STL("data/invalid_header.stl", fg); // missing solid ok = CGAL::IO::read_STL("data/invalid_header.stl", fg); // missing solid
assert(!ok); assert(!ok);
ok = CGAL::read_STL("data/sphere.obj", fg); ok = CGAL::IO::read_STL("data/sphere.obj", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_STL("data/full.off", fg); ok = CGAL::IO::read_STL("data/full.off", fg);
assert(!ok); assert(!ok);
std::cerr << " ########### No more error text from here." << std::endl; std::cerr << " ########### No more error text from here." << std::endl;
} }
@ -706,7 +706,7 @@ void test_bgl_GOCAD(const char* filename)
{ {
Mesh fg; Mesh fg;
std::ifstream is(filename); std::ifstream is(filename);
bool ok = CGAL::read_GOCAD(is, fg); bool ok = CGAL::IO::read_GOCAD(is, fg);
assert(ok); assert(ok);
assert(num_vertices(fg) != 0 && num_faces(fg) != 0); assert(num_vertices(fg) != 0 && num_faces(fg) != 0);
@ -714,19 +714,19 @@ void test_bgl_GOCAD(const char* filename)
fg.clear(); fg.clear();
CGAL::clear(fg); CGAL::clear(fg);
std::pair<std::string, std::string> name_and_color; std::pair<std::string, std::string> name_and_color;
ok = CGAL::read_GOCAD(is, name_and_color, fg); ok = CGAL::IO::read_GOCAD(is, name_and_color, fg);
assert(ok); assert(ok);
assert(num_vertices(fg) != 0 && num_faces(fg) != 0); assert(num_vertices(fg) != 0 && num_faces(fg) != 0);
// write with GOCAD // write with GOCAD
{ {
std::ofstream os("tmp.ts"); std::ofstream os("tmp.ts");
bool ok = CGAL::write_GOCAD(os, "tetrahedron", fg); bool ok = CGAL::IO::write_GOCAD(os, "tetrahedron", fg);
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
std::pair<std::string, std::string> cnn; std::pair<std::string, std::string> cnn;
ok = CGAL::read_GOCAD("tmp.ts", cnn, fg2); ok = CGAL::IO::read_GOCAD("tmp.ts", cnn, fg2);
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
assert(cnn.first == "tetrahedron"); assert(cnn.first == "tetrahedron");
@ -734,11 +734,11 @@ void test_bgl_GOCAD(const char* filename)
// write with PM // write with PM
{ {
ok = CGAL::write_polygon_mesh("tmp.ts", fg, CGAL::parameters::stream_precision(10)); ok = CGAL::IO::write_polygon_mesh("tmp.ts", fg, CGAL::parameters::stream_precision(10));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_polygon_mesh("tmp.ts", fg2); ok = CGAL::IO::read_polygon_mesh("tmp.ts", fg2);
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
@ -749,7 +749,7 @@ void test_bgl_GOCAD(const char* filename)
VertexPointMap vpm = get(CGAL::vertex_point, fg); VertexPointMap vpm = get(CGAL::vertex_point, fg);
std::ostringstream out; std::ostringstream out;
ok = CGAL::write_GOCAD(out, "tetrahedron", fg, CGAL::parameters::vertex_point_map(vpm)); ok = CGAL::IO::write_GOCAD(out, "tetrahedron", fg, CGAL::parameters::vertex_point_map(vpm));
assert(ok); assert(ok);
{ {
@ -757,7 +757,7 @@ void test_bgl_GOCAD(const char* filename)
VertexPointMap vpm2 = get(CGAL::vertex_point, fg2); VertexPointMap vpm2 = get(CGAL::vertex_point, fg2);
std::istringstream is(out.str()); std::istringstream is(out.str());
std::pair<std::string, std::string> cnn; std::pair<std::string, std::string> cnn;
ok = CGAL::read_GOCAD(is, cnn, fg2, CGAL::parameters::vertex_point_map(vpm2)); ok = CGAL::IO::read_GOCAD(is, cnn, fg2, CGAL::parameters::vertex_point_map(vpm2));
assert(ok); assert(ok);
assert(cnn.second.empty()); assert(cnn.second.empty());
assert(num_vertices(fg2) == 12491); assert(num_vertices(fg2) == 12491);
@ -765,15 +765,15 @@ void test_bgl_GOCAD(const char* filename)
} }
std::cerr << " ########### Error text is expected to follow." << std::endl; std::cerr << " ########### Error text is expected to follow." << std::endl;
ok = CGAL::read_GOCAD("data/mesh_that_doesnt_exist.ts", fg); ok = CGAL::IO::read_GOCAD("data/mesh_that_doesnt_exist.ts", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_GOCAD("data/invalid_cut.ts", fg); // cut in half ok = CGAL::IO::read_GOCAD("data/invalid_cut.ts", fg); // cut in half
assert(!ok); assert(!ok);
ok = CGAL::read_GOCAD("data/invalid_header.ts", fg); // missing header ok = CGAL::IO::read_GOCAD("data/invalid_header.ts", fg); // missing header
assert(!ok); assert(!ok);
ok = CGAL::read_GOCAD("data/sphere.obj", fg); ok = CGAL::IO::read_GOCAD("data/sphere.obj", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_GOCAD("data/full.off", fg); ok = CGAL::IO::read_GOCAD("data/full.off", fg);
assert(!ok); assert(!ok);
std::cerr << " ########### No more error text from here." << std::endl; std::cerr << " ########### No more error text from here." << std::endl;
} }
@ -785,7 +785,7 @@ void test_bgl_VTP(const char* filename,
const bool binary = false) const bool binary = false)
{ {
Mesh fg; Mesh fg;
bool ok = CGAL::read_VTP(filename, fg); bool ok = CGAL::IO::read_VTP(filename, fg);
assert(ok); assert(ok);
assert(std::string(filename) != "data/bones.vtp" || assert(std::string(filename) != "data/bones.vtp" ||
(num_vertices(fg) == 2154 && num_faces(fg) == 4204)); (num_vertices(fg) == 2154 && num_faces(fg) == 4204));
@ -795,15 +795,15 @@ void test_bgl_VTP(const char* filename,
std::ofstream os; std::ofstream os;
if(binary){ if(binary){
os.open("tmp.vtp", std::ios::binary); os.open("tmp.vtp", std::ios::binary);
CGAL::set_mode(os, CGAL::IO::BINARY); CGAL::IO::set_mode(os, CGAL::IO::BINARY);
} }
else else
os.open("tmp.vtp"); os.open("tmp.vtp");
ok = CGAL::write_VTP(os, fg, CGAL::parameters::use_binary_mode(binary)); ok = CGAL::IO::write_VTP(os, fg, CGAL::parameters::use_binary_mode(binary));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_VTP("tmp.vtp", fg2, CGAL::parameters::use_binary_mode(binary)); ok = CGAL::IO::read_VTP("tmp.vtp", fg2, CGAL::parameters::use_binary_mode(binary));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
@ -811,13 +811,13 @@ void test_bgl_VTP(const char* filename,
// write with PM // write with PM
{ {
if(binary) if(binary)
ok = CGAL::write_polygon_mesh("tmp.vtp", fg); ok = CGAL::IO::write_polygon_mesh("tmp.vtp", fg);
else else
ok = CGAL::write_polygon_mesh("tmp.vtp", fg, CGAL::parameters::use_binary_mode(false)); ok = CGAL::IO::write_polygon_mesh("tmp.vtp", fg, CGAL::parameters::use_binary_mode(false));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_polygon_mesh("tmp.vtp", fg2, CGAL::parameters::use_binary_mode(binary)); ok = CGAL::IO::read_polygon_mesh("tmp.vtp", fg2, CGAL::parameters::use_binary_mode(binary));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
@ -828,14 +828,14 @@ void test_bgl_VTP(const char* filename,
{ {
CGAL::clear(fg); CGAL::clear(fg);
ok = CGAL::read_VTP("data/bones.vtp", fg); ok = CGAL::IO::read_VTP("data/bones.vtp", fg);
assert(ok); assert(ok);
assert(num_vertices(fg) == 2154 && num_faces(fg) == 4204); assert(num_vertices(fg) == 2154 && num_faces(fg) == 4204);
Mesh fg2; Mesh fg2;
VertexPointMap vpm2 = get(CGAL::dynamic_vertex_property_t<Point>(), fg2); VertexPointMap vpm2 = get(CGAL::dynamic_vertex_property_t<Point>(), fg2);
ok = CGAL::read_VTP("data/bones.vtp", fg2, CGAL::parameters::vertex_point_map(vpm2)); ok = CGAL::IO::read_VTP("data/bones.vtp", fg2, CGAL::parameters::vertex_point_map(vpm2));
assert(ok); assert(ok);
typedef typename CGAL::GetInitializedVertexIndexMap<Mesh>::const_type VIM; typedef typename CGAL::GetInitializedVertexIndexMap<Mesh>::const_type VIM;
VIM vim1 = CGAL::get_initialized_vertex_index_map(fg); VIM vim1 = CGAL::get_initialized_vertex_index_map(fg);
@ -849,18 +849,18 @@ void test_bgl_VTP(const char* filename,
if(binary) if(binary)
{ {
os.open("tmp.vtp", std::ios::binary); os.open("tmp.vtp", std::ios::binary);
CGAL::set_mode(os, CGAL::IO::BINARY); CGAL::IO::set_mode(os, CGAL::IO::BINARY);
} }
else else
{ {
os.open("tmp.vtp"); os.open("tmp.vtp");
} }
ok = CGAL::write_VTP(os, fg, CGAL::parameters::use_binary_mode(binary)); ok = CGAL::IO::write_VTP(os, fg, CGAL::parameters::use_binary_mode(binary));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_polygon_mesh("tmp.vtp", fg2, CGAL::parameters::use_binary_mode(binary)); ok = CGAL::IO::read_polygon_mesh("tmp.vtp", fg2, CGAL::parameters::use_binary_mode(binary));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
@ -868,33 +868,33 @@ void test_bgl_VTP(const char* filename,
// write with PM // write with PM
{ {
if(binary) if(binary)
ok = CGAL::write_polygon_mesh("tmp.vtp", fg); ok = CGAL::IO::write_polygon_mesh("tmp.vtp", fg);
else else
ok = CGAL::write_polygon_mesh("tmp.vtp", fg, CGAL::parameters::use_binary_mode(false)); ok = CGAL::IO::write_polygon_mesh("tmp.vtp", fg, CGAL::parameters::use_binary_mode(false));
assert(ok); assert(ok);
Mesh fg2; Mesh fg2;
ok = CGAL::read_polygon_mesh("tmp.vtp", fg2, CGAL::parameters::use_binary_mode(binary)); ok = CGAL::IO::read_polygon_mesh("tmp.vtp", fg2, CGAL::parameters::use_binary_mode(binary));
assert(ok); assert(ok);
assert(are_equal_meshes(fg, fg2)); assert(are_equal_meshes(fg, fg2));
} }
// test wrong inputs // test wrong inputs
std::cerr << " ########### Error text is expected to follow." << std::endl; std::cerr << " ########### Error text is expected to follow." << std::endl;
ok = CGAL::read_VTP("data/mesh_that_doesnt_exist.vtp", fg); ok = CGAL::IO::read_VTP("data/mesh_that_doesnt_exist.vtp", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_VTP("data/invalid_cut.vtp", fg); // cut in half ok = CGAL::IO::read_VTP("data/invalid_cut.vtp", fg); // cut in half
assert(!ok); assert(!ok);
ok = CGAL::read_VTP("data/invalid_header.vtp", fg); // missing header ok = CGAL::IO::read_VTP("data/invalid_header.vtp", fg); // missing header
assert(!ok); assert(!ok);
ok = CGAL::read_VTP("data/wrong_nb_points.vtp", fg); // wrong number of points ok = CGAL::IO::read_VTP("data/wrong_nb_points.vtp", fg); // wrong number of points
assert(!ok); assert(!ok);
ok = CGAL::read_VTP("data/sphere.obj", fg); ok = CGAL::IO::read_VTP("data/sphere.obj", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_VTP("data/full.off", fg); ok = CGAL::IO::read_VTP("data/full.off", fg);
assert(!ok); assert(!ok);
ok = CGAL::read_VTP("corrupted_bin.vtp", fg); ok = CGAL::IO::read_VTP("corrupted_bin.vtp", fg);
assert(!ok); assert(!ok);
std::cerr << " ########### No more error text from here." << std::endl; std::cerr << " ########### No more error text from here." << std::endl;
} }
@ -909,21 +909,21 @@ int main(int argc, char** argv)
test_bgl_OFF<Polyhedron, Kernel>(off_file); test_bgl_OFF<Polyhedron, Kernel>(off_file);
Polyhedron fg; Polyhedron fg;
bool ok = CGAL::read_OFF("data/invalid_header.off", fg); // wrong header (NOFF but no normals) bool ok = CGAL::IO::read_OFF("data/invalid_header.off", fg); // wrong header (NOFF but no normals)
assert(ok); assert(ok);
test_bgl_OFF<SM, Kernel>(off_file); test_bgl_OFF<SM, Kernel>(off_file);
SM sm; SM sm;
ok = CGAL::read_OFF("data/invalid_header.off", sm); // wrong header (NOFF but no normals) ok = CGAL::IO::read_OFF("data/invalid_header.off", sm); // wrong header (NOFF but no normals)
assert(!ok); assert(!ok);
test_bgl_OFF<LCC, Kernel>(off_file); test_bgl_OFF<LCC, Kernel>(off_file);
LCC lcc; LCC lcc;
ok = CGAL::read_OFF("data/invalid_header.off", lcc); // wrong header (NOFF but no normals) ok = CGAL::IO::read_OFF("data/invalid_header.off", lcc); // wrong header (NOFF but no normals)
assert(!ok); assert(!ok);
#ifdef CGAL_USE_OPENMESH #ifdef CGAL_USE_OPENMESH
test_bgl_OFF<OMesh, EPICK>(off_file); test_bgl_OFF<OMesh, EPICK>(off_file);
OMesh om; OMesh om;
ok = CGAL::read_OFF("data/invalid_header.off", om); // wrong header (NOFF but no normals) ok = CGAL::IO::read_OFF("data/invalid_header.off", om); // wrong header (NOFF but no normals)
assert(!ok); assert(!ok);
#endif #endif
// OBJ // OBJ

Some files were not shown because too many files have changed in this diff Show More