mirror of https://github.com/CGAL/cgal
Fix VTK tests
This commit is contained in:
parent
512975b354
commit
c52f63c6ca
|
|
@ -531,7 +531,14 @@ bool write_VTP(std::ostream& os,
|
||||||
template<typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
template<typename Graph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool write_VTP(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS& np)
|
bool write_VTP(const std::string& fname, const Graph& g, const CGAL_BGL_NP_CLASS& np)
|
||||||
{
|
{
|
||||||
std::ofstream os(fname);
|
const bool binary = CGAL::parameters::choose_parameter(CGAL::parameters::get_parameter(np, internal_np::use_binary_mode), true);
|
||||||
|
std::ofstream os;
|
||||||
|
if(binary){
|
||||||
|
os.open(fname, std::ios::binary);
|
||||||
|
CGAL::set_mode(os, CGAL::IO::BINARY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
os.open(fname);
|
||||||
return write_VTP(os, g, np);
|
return write_VTP(os, g, np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -750,14 +750,18 @@ void test_bgl_VTP(const char* filename,
|
||||||
|
|
||||||
// write with VTP
|
// write with VTP
|
||||||
{
|
{
|
||||||
std::ofstream os("tmp.vtp");
|
std::ofstream os;
|
||||||
if(binary)
|
if(binary){
|
||||||
|
os.open("tmp.vtp", std::ios::binary);
|
||||||
CGAL::set_mode(os, CGAL::IO::BINARY);
|
CGAL::set_mode(os, CGAL::IO::BINARY);
|
||||||
ok = CGAL::write_VTP(os, fg);
|
}
|
||||||
|
else
|
||||||
|
os.open("tmp.vtp");
|
||||||
|
ok = CGAL::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);
|
ok = CGAL::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));
|
||||||
}
|
}
|
||||||
|
|
@ -771,7 +775,7 @@ void test_bgl_VTP(const char* filename,
|
||||||
assert(ok);
|
assert(ok);
|
||||||
|
|
||||||
Mesh fg2;
|
Mesh fg2;
|
||||||
ok = CGAL::read_polygon_mesh("tmp.vtp", fg2);
|
ok = CGAL::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));
|
||||||
}
|
}
|
||||||
|
|
@ -799,15 +803,22 @@ void test_bgl_VTP(const char* filename,
|
||||||
|
|
||||||
// write with VTP
|
// write with VTP
|
||||||
{
|
{
|
||||||
std::ofstream os("tmp.vtp");
|
std::ofstream os;
|
||||||
if(binary)
|
if(binary)
|
||||||
|
{
|
||||||
|
os.open("tmp.vtp", std::ios::binary);
|
||||||
CGAL::set_mode(os, CGAL::IO::BINARY);
|
CGAL::set_mode(os, CGAL::IO::BINARY);
|
||||||
ok = CGAL::write_VTP(os, fg);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os.open("tmp.vtp");
|
||||||
|
}
|
||||||
|
ok = CGAL::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);
|
ok = CGAL::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));
|
||||||
}
|
}
|
||||||
|
|
@ -822,7 +833,7 @@ void test_bgl_VTP(const char* filename,
|
||||||
|
|
||||||
Mesh fg2;
|
Mesh fg2;
|
||||||
|
|
||||||
ok = CGAL::read_polygon_mesh("tmp.vtp", fg2);
|
ok = CGAL::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));
|
||||||
}
|
}
|
||||||
|
|
@ -898,8 +909,8 @@ int main(int argc, char** argv)
|
||||||
#ifdef CGAL_USE_VTK
|
#ifdef CGAL_USE_VTK
|
||||||
const char* vtp_file = (argc > 6) ? argv[6] : "data/bones.vtp";
|
const char* vtp_file = (argc > 6) ? argv[6] : "data/bones.vtp";
|
||||||
|
|
||||||
//test_bgl_VTP<Polyhedron, Kernel>(vtp_file, false);
|
test_bgl_VTP<Polyhedron, Kernel>(vtp_file, false);
|
||||||
//test_bgl_VTP<SM, Kernel>(vtp_file, false);
|
test_bgl_VTP<SM, Kernel>(vtp_file, false);
|
||||||
test_bgl_VTP<LCC, Kernel>(vtp_file, false);
|
test_bgl_VTP<LCC, Kernel>(vtp_file, false);
|
||||||
|
|
||||||
test_bgl_VTP<Polyhedron, Kernel>(vtp_file, true);
|
test_bgl_VTP<Polyhedron, Kernel>(vtp_file, true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue