mirror of https://github.com/CGAL/cgal
WIP. Remove read_pm for streams.
This commit is contained in:
parent
7c8dcbfd47
commit
bc360bcfd3
|
|
@ -153,16 +153,15 @@ template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(const char* fname, FaceGraph& g, const CGAL_BGL_NP_CLASS& np, bool verbose = true)
|
bool read_GOCAD(const char* fname, FaceGraph& g, const CGAL_BGL_NP_CLASS& np, bool verbose = true)
|
||||||
{
|
{
|
||||||
std::ifstream in(fname);
|
std::ifstream in(fname);
|
||||||
std::string unused_name;
|
std::pair<std::string, std::string> dummy;
|
||||||
std::string unused_color;
|
|
||||||
|
|
||||||
return read_GOCAD(in, unused_name, unused_color, g, np, verbose);
|
return read_GOCAD(in, dummy, g, np, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(const std::string& fname, FaceGraph& g, CGAL_BGL_NP_CLASS np)
|
bool read_GOCAD(const std::string& fname, FaceGraph& g, CGAL_BGL_NP_CLASS np, bool verbose = true)
|
||||||
{
|
{
|
||||||
return read_GOCAD(fname.c_str(), g, np);
|
return read_GOCAD(fname.c_str(), g, np, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FaceGraph>
|
template <typename FaceGraph>
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_PLY(const std::string& fname, FaceGraph& g, const CGAL_BGL_NP_CLASS& np,
|
bool read_PLY(const std::string& fname, FaceGraph& g, const CGAL_BGL_NP_CLASS& np,
|
||||||
bool verbose = true)
|
bool verbose = true)
|
||||||
{
|
{
|
||||||
return IO::internal::read_PLY_BGL(fname.c_str(), g, np, verbose);
|
return IO::internal::read_PLY(fname.c_str(), g, np, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,8 @@ bool read_polygon_mesh(const std::string& fname,
|
||||||
return read_VTP(fname, g, np);
|
return read_VTP(fname, g, np);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::istream is(fname.c_str());
|
std::ifstream is(fname.c_str());
|
||||||
return read_polygon_mesh(is, g, np, false);
|
return read_polygon_mesh(is, g, np);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class FaceGraph>
|
template <class FaceGraph>
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,10 @@ void fill_soup(PointRange& points, PolygonRange& polygons)
|
||||||
template<typename Mesh>
|
template<typename Mesh>
|
||||||
void test_bgl_OFF(const char* filename)
|
void test_bgl_OFF(const char* filename)
|
||||||
{
|
{
|
||||||
Mesh sm;
|
Mesh sm, sm2;
|
||||||
std::ifstream in(filename);
|
std::ifstream in(filename);
|
||||||
CGAL::read_polygon_mesh(in,sm);
|
CGAL::read_polygon_mesh(in,sm);
|
||||||
|
CGAL::read_polygon_mesh(filename, sm2);
|
||||||
|
|
||||||
CGAL::write_OFF(std::cout, sm);
|
CGAL::write_OFF(std::cout, sm);
|
||||||
}
|
}
|
||||||
|
|
@ -104,6 +105,12 @@ void test_bgl_OFF_with_np()
|
||||||
.vertex_texture_map(vtm)
|
.vertex_texture_map(vtm)
|
||||||
.face_color_map(fcm));
|
.face_color_map(fcm));
|
||||||
CGAL_assertion(ok);
|
CGAL_assertion(ok);
|
||||||
|
fg.clear();
|
||||||
|
ok = CGAL::read_polygon_mesh("data/full.off", fg, CGAL::parameters::vertex_normal_map(vnm)
|
||||||
|
.vertex_color_map(vcm)
|
||||||
|
.vertex_texture_map(vtm)
|
||||||
|
.face_color_map(fcm));
|
||||||
|
CGAL_assertion(ok);
|
||||||
|
|
||||||
ok = CGAL::write_OFF(std::cout, fg, CGAL::parameters::vertex_normal_map(vnm)
|
ok = CGAL::write_OFF(std::cout, fg, CGAL::parameters::vertex_normal_map(vnm)
|
||||||
.vertex_color_map(vcm)
|
.vertex_color_map(vcm)
|
||||||
|
|
@ -134,6 +141,11 @@ bool test_bgl_OBJ()
|
||||||
CGAL::read_polygon_mesh(in, fg);
|
CGAL::read_polygon_mesh(in, fg);
|
||||||
CGAL_assertion(num_vertices(fg) == 4);
|
CGAL_assertion(num_vertices(fg) == 4);
|
||||||
CGAL_assertion(num_faces(fg) == 4);
|
CGAL_assertion(num_faces(fg) == 4);
|
||||||
|
fg.clear();
|
||||||
|
CGAL::read_polygon_mesh("data/sphere.obj", fg);
|
||||||
|
CGAL_assertion(num_vertices(fg) == 162);
|
||||||
|
CGAL_assertion(num_faces(fg) == 320);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -203,7 +215,7 @@ bool test_bgl_vtp(bool binary = false)
|
||||||
}
|
}
|
||||||
os.close();
|
os.close();
|
||||||
Mesh fg2;
|
Mesh fg2;
|
||||||
if(!CGAL::read_VTP("tetrahedron.vtp", fg2))
|
if(!CGAL::read_polygon_mesh("tetrahedron.vtp", fg2))
|
||||||
{
|
{
|
||||||
std::cerr<<"vtp reading failed."<<std::endl;
|
std::cerr<<"vtp reading failed."<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -239,7 +251,7 @@ bool test_bgl_vtp<Polyhedron>(bool binary)
|
||||||
}
|
}
|
||||||
os.close();
|
os.close();
|
||||||
Polyhedron fg2;
|
Polyhedron fg2;
|
||||||
if(!CGAL::read_VTP("tetrahedron.vtp", fg2))
|
if(!CGAL::read_polygon_mesh("tetrahedron.vtp", fg2))
|
||||||
{
|
{
|
||||||
std::cerr<<"vtp reading failed."<<std::endl;
|
std::cerr<<"vtp reading failed."<<std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@ namespace CGAL {
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Read
|
/// Read
|
||||||
template <typename PointRange, typename PolygonRange, typename NamedParameters>
|
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(std::istream& input,
|
bool read_GOCAD(std::istream& input,
|
||||||
std::pair<std::string, std::string>& name_and_color,
|
std::pair<std::string, std::string>& name_and_color,
|
||||||
PointRange& points,
|
PointRange& points,
|
||||||
PolygonRange& polygons,
|
PolygonRange& polygons,
|
||||||
const NamedParameters&,
|
const CGAL_BGL_NP_CLASS&,
|
||||||
bool verbose = true)
|
bool verbose = true)
|
||||||
{
|
{
|
||||||
CGAL_USE(verbose);
|
CGAL_USE(verbose);
|
||||||
|
|
@ -105,33 +105,33 @@ bool read_GOCAD(std::istream& input,
|
||||||
return !input.fail();
|
return !input.fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename PointRange, typename PolygonRange, typename NamedParameters>
|
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(std::istream& is,
|
bool read_GOCAD(std::istream& is,
|
||||||
PointRange& points,
|
PointRange& points,
|
||||||
PolygonRange& polygons,
|
PolygonRange& polygons,
|
||||||
const NamedParameters&np)
|
const CGAL_BGL_NP_CLASS&np)
|
||||||
{
|
{
|
||||||
std::pair<std::string, std::string> dummy;
|
std::pair<std::string, std::string> dummy;
|
||||||
return read_GOCAD(is, dummy, points, polygons, np);
|
return read_GOCAD(is, dummy, points, polygons, np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename PointRange, typename PolygonRange, typename NamedParameters>
|
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(const char* fname,
|
bool read_GOCAD(const char* fname,
|
||||||
PointRange& points,
|
PointRange& points,
|
||||||
PolygonRange& polygons,
|
PolygonRange& polygons,
|
||||||
const NamedParameters& np)
|
const CGAL_BGL_NP_CLASS& np)
|
||||||
{
|
{
|
||||||
std::ifstream in(fname);
|
std::ifstream in(fname);
|
||||||
std::pair<std::string, std::string> dummy;
|
std::pair<std::string, std::string> dummy;
|
||||||
return read_GOCAD(in, dummy, points, polygons, np);
|
return read_GOCAD(in, dummy, points, polygons, np);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename PointRange, typename PolygonRange, typename NamedParameters>
|
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
|
||||||
bool read_GOCAD(const std::string& fname,
|
bool read_GOCAD(const std::string& fname,
|
||||||
PointRange& points,
|
PointRange& points,
|
||||||
PolygonRange& polygons,
|
PolygonRange& polygons,
|
||||||
const NamedParameters& np)
|
const CGAL_BGL_NP_CLASS& np)
|
||||||
{
|
{
|
||||||
return read_GOCAD(fname.c_str(), points, polygons, np);
|
return read_GOCAD(fname.c_str(), points, polygons, np);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ public: // virtual interface of Base_property_array
|
||||||
if(pa != nullptr){
|
if(pa != nullptr){
|
||||||
std::copy((*pa).data_.begin(), (*pa).data_.end(), data_.end()-(*pa).data_.size());
|
std::copy((*pa).data_.begin(), (*pa).data_.end(), data_.end()-(*pa).data_.size());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,7 +221,7 @@ private:
|
||||||
|
|
||||||
template<typename, typename>
|
template<typename, typename>
|
||||||
class Property_container;
|
class Property_container;
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -291,7 +291,7 @@ public:
|
||||||
parrays_.back()->resize(size_);
|
parrays_.back()->resize(size_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transfer one element with all properties
|
// Transfer one element with all properties
|
||||||
// WARNING: properties must be the same in the two containers
|
// WARNING: properties must be the same in the two containers
|
||||||
bool transfer(const Property_container& _rhs, std::size_t from, std::size_t to)
|
bool transfer(const Property_container& _rhs, std::size_t from, std::size_t to)
|
||||||
|
|
@ -326,7 +326,7 @@ public:
|
||||||
typedef typename Ref_class::template Get_property_map<Key, T>::type type;
|
typedef typename Ref_class::template Get_property_map<Key, T>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
std::pair<typename Get_pmap_type<T>::type, bool>
|
std::pair<typename Get_pmap_type<T>::type, bool>
|
||||||
get(const std::string& name, std::size_t i) const
|
get(const std::string& name, std::size_t i) const
|
||||||
{
|
{
|
||||||
|
|
@ -365,7 +365,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// get a property by its name. returns invalid property if it does not exist.
|
// get a property by its name. returns invalid property if it does not exist.
|
||||||
template <class T>
|
template <class T>
|
||||||
std::pair<typename Get_pmap_type<T>::type, bool>
|
std::pair<typename Get_pmap_type<T>::type, bool>
|
||||||
get(const std::string& name) const
|
get(const std::string& name) const
|
||||||
{
|
{
|
||||||
|
|
@ -394,7 +394,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// get the type of property by its name. returns typeid(void) if it does not exist.
|
// get the type of property by its name. returns typeid(void) if it does not exist.
|
||||||
const std::type_info&
|
const std::type_info&
|
||||||
get_type(const std::string& name) const
|
get_type(const std::string& name) const
|
||||||
{
|
{
|
||||||
for (std::size_t i=0; i<parrays_.size(); ++i)
|
for (std::size_t i=0; i<parrays_.size(); ++i)
|
||||||
|
|
@ -405,7 +405,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// delete a property
|
// delete a property
|
||||||
template <class T>
|
template <class T>
|
||||||
bool
|
bool
|
||||||
remove(typename Get_pmap_type<T>::type& h)
|
remove(typename Get_pmap_type<T>::type& h)
|
||||||
{
|
{
|
||||||
|
|
@ -487,7 +487,7 @@ public:
|
||||||
this->parrays_.swap (other.parrays_);
|
this->parrays_.swap (other.parrays_);
|
||||||
std::swap(this->size_, other.size_);
|
std::swap(this->size_, other.size_);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Base_property_array*> parrays_;
|
std::vector<Base_property_array*> parrays_;
|
||||||
size_t size_;
|
size_t size_;
|
||||||
|
|
@ -497,11 +497,11 @@ private:
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
#ifndef DOXYGEN_RUNNING
|
#ifndef DOXYGEN_RUNNING
|
||||||
///
|
|
||||||
///
|
///
|
||||||
/// `Property_map` enables to attach properties to the simplices of a
|
///
|
||||||
|
/// `Property_map` enables to attach properties to the simplices of a
|
||||||
/// surface mesh.
|
/// surface mesh.
|
||||||
///
|
///
|
||||||
/// @tparam Key The key type of the property map. It must be a model of `Index`.
|
/// @tparam Key The key type of the property map. It must be a model of `Index`.
|
||||||
/// @tparam Value The value type of the property.
|
/// @tparam Value The value type of the property.
|
||||||
///
|
///
|
||||||
|
|
@ -510,7 +510,7 @@ private:
|
||||||
template <class I, class T, class CRTP_derived_class>
|
template <class I, class T, class CRTP_derived_class>
|
||||||
class Property_map_base
|
class Property_map_base
|
||||||
/// @cond CGAL_DOCUMENT_INTERNALS
|
/// @cond CGAL_DOCUMENT_INTERNALS
|
||||||
: public boost::put_get_helper<
|
: public boost::put_get_helper<
|
||||||
typename Property_array<T>::reference,
|
typename Property_array<T>::reference,
|
||||||
CRTP_derived_class>
|
CRTP_derived_class>
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
@ -528,7 +528,7 @@ public:
|
||||||
typedef typename Property_array<T>::const_reference const_reference;
|
typedef typename Property_array<T>::const_reference const_reference;
|
||||||
typedef typename Property_array<T>::iterator iterator;
|
typedef typename Property_array<T>::iterator iterator;
|
||||||
typedef typename Property_array<T>::const_iterator const_iterator;
|
typedef typename Property_array<T>::const_iterator const_iterator;
|
||||||
#else
|
#else
|
||||||
/// A reference to the value type of the property.
|
/// A reference to the value type of the property.
|
||||||
typedef unspecified_type reference;
|
typedef unspecified_type reference;
|
||||||
|
|
||||||
|
|
@ -549,14 +549,14 @@ public:
|
||||||
{
|
{
|
||||||
parray_ = nullptr;
|
parray_ = nullptr;
|
||||||
}
|
}
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \name Accessing Properties
|
/// \name Accessing Properties
|
||||||
//@{
|
//@{
|
||||||
#ifdef DOXYGEN_RUNNING
|
#ifdef DOXYGEN_RUNNING
|
||||||
/// Conversion to a Boolean. It is \c true when the property map
|
/// Conversion to a Boolean. It is \c true when the property map
|
||||||
/// can be used, and \c false otherwise.
|
/// can be used, and \c false otherwise.
|
||||||
operator bool () const;
|
operator bool () const;
|
||||||
#else
|
#else
|
||||||
operator bool_type() const {
|
operator bool_type() const {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue