Fixes of warnings and errors

This commit is contained in:
Maxime Gimeno 2020-12-01 11:33:35 +01:00
parent 2cd6d38764
commit 37b5928df2
6 changed files with 33 additions and 31 deletions

View File

@ -416,9 +416,7 @@ bool read_LAS_with_properties(std::istream& is,
OutputIterator output, OutputIterator output,
PropertyHandler&& ... properties) PropertyHandler&& ... properties)
{ {
typedef typename value_type_traits<OutputIterator>::type OutputValueType; return read_LAS_with_properties<typename value_type_traits<OutputIterator>::type>(is, output, std::forward<PropertyHandler>(properties)...);
return read_LAS_with_properties<OutputValueType>(is, output, std::forward<PropertyHandler>(properties)...);
} }
/// \endcond /// \endcond
@ -625,9 +623,7 @@ CGAL_DEPRECATED bool read_las_points_with_properties(std::istream& is,
OutputIterator output, OutputIterator output,
PropertyHandler&& ... properties) PropertyHandler&& ... properties)
{ {
typedef typename value_type_traits<OutputIterator>::type OutputValueType; return read_LAS_with_properties<typename value_type_traits<OutputIterator>::type>(is, output, std::forward<PropertyHandler>(properties)...);
return read_LAS_with_properties<OutputValueType>(is, output, std::forward<PropertyHandler>(properties)...);
} }
/// \endcond /// \endcond
@ -647,9 +643,7 @@ CGAL_DEPRECATED bool read_las_points(std::istream& is,
using parameters::choose_parameter; using parameters::choose_parameter;
using parameters::get_parameter; using parameters::get_parameter;
typedef Point_set_processing_3::Fake_point_range<OutputIteratorValueType> PointRange; typedef typename CGAL::GetPointMap<Point_set_processing_3::Fake_point_range<OutputIteratorValueType>, CGAL_BGL_NP_CLASS>::type PointMap;
typedef typename CGAL::GetPointMap<PointRange, CGAL_BGL_NP_CLASS>::type PointMap;
PointMap point_map = choose_parameter<PointMap>(get_parameter(np, internal_np::point_map)); PointMap point_map = choose_parameter<PointMap>(get_parameter(np, internal_np::point_map));
return read_LAS(is, output, make_las_point_reader(point_map)); return read_LAS(is, output, make_las_point_reader(point_map));

View File

@ -99,6 +99,7 @@ bool read_OFF(std::istream& is,
typedef typename CGAL::GetPointMap<PointRange, CGAL_BGL_NP_CLASS>::type PointMap; typedef typename CGAL::GetPointMap<PointRange, CGAL_BGL_NP_CLASS>::type PointMap;
typedef typename Point_set_processing_3::GetNormalMap<PointRange, CGAL_BGL_NP_CLASS>::type NormalMap; typedef typename Point_set_processing_3::GetNormalMap<PointRange, CGAL_BGL_NP_CLASS>::type NormalMap;
typedef typename Point_set_processing_3::GetK<PointRange, CGAL_BGL_NP_CLASS>::Kernel Kernel; typedef typename Point_set_processing_3::GetK<PointRange, CGAL_BGL_NP_CLASS>::Kernel Kernel;
typedef typename Kernel::FT FT;
bool has_normals = !(boost::is_same<NormalMap, bool has_normals = !(boost::is_same<NormalMap,
typename Point_set_processing_3::GetNormalMap<PointRange, CGAL_BGL_NP_CLASS>::NoMap>::value); typename Point_set_processing_3::GetNormalMap<PointRange, CGAL_BGL_NP_CLASS>::NoMap>::value);
@ -167,14 +168,15 @@ bool read_OFF(std::istream& is,
double nx,ny,nz; double nx,ny,nz;
if (iss >> iformat(x) >> iformat(y) >> iformat(z)) if (iss >> iformat(x) >> iformat(y) >> iformat(z))
{ {
Point point(x,y,z); FT fx(x), fy(y), fz(z);
Point point(fx, fy, fz);
Vector normal = CGAL::NULL_VECTOR; Vector normal = CGAL::NULL_VECTOR;
// ... + normal... // ... + normal...
if (iss >> iformat(nx)) if (iss >> iformat(nx))
{ {
// In case we could read one number, we expect that there are two more // In case we could read one number, we expect that there are two more
if(iss >> iformat(ny) >> iformat(nz)){ if(iss >> iformat(ny) >> iformat(nz)){
normal = Vector(nx,ny,nz); normal = Vector(FT(nx),FT(ny),FT(nz));
} else { } else {
std::cerr << "Error line " << lineNumber << " of file" << std::endl; std::cerr << "Error line " << lineNumber << " of file" << std::endl;
return false; return false;

View File

@ -124,8 +124,10 @@ void Polyhedron_scan_OFF<HDS>:: operator()(HDS& target)
for(std::size_t j=0; j<no; ++j) for(std::size_t j=0; j<no; ++j)
{ {
std::size_t index; std::size_t index = 0;
scanner.scan_facet_vertex_index( index, j+1, i); //current_entry = j + 1 for the size entry scanner.scan_facet_vertex_index( index, j+1, i); //current_entry = j + 1 for the size entry
if(!m_in)
return;
B.add_vertex_to_facet( index); B.add_vertex_to_facet( index);
} }
B.end_facet(); B.end_facet();

View File

@ -82,7 +82,7 @@ bool read_OFF(std::istream& is,
for(std::size_t i=0; i<scanner.size_of_vertices(); ++i) for(std::size_t i=0; i<scanner.size_of_vertices(); ++i)
{ {
double x, y, z, w; double x(0), y(0), z(0), w(0);
scanner.scan_vertex(x, y, z, w); scanner.scan_vertex(x, y, z, w);
CGAL_assertion(w != 0); CGAL_assertion(w != 0);
IO::internal::fill_point(x, y, z, w, points[i]); IO::internal::fill_point(x, y, z, w, points[i]);
@ -103,10 +103,9 @@ bool read_OFF(std::istream& is,
if(scanner.has_textures()) if(scanner.has_textures())
{ {
double nx, ny, nw; double nx, ny;
scanner.scan_texture(nx, ny, nw); scanner.scan_texture(nx, ny);
CGAL_assertion(nw != 0); *vt_out++ = Texture(FT(nx), FT(ny));
*vt_out++ = Texture(nx, ny, nw);
} }
if(!is.good()) if(!is.good())
return false; return false;
@ -118,7 +117,7 @@ bool read_OFF(std::istream& is,
std::size_t no(-1); std::size_t no(-1);
scanner.scan_facet(no, i); scanner.scan_facet(no, i);
if(!is.good() || no == std::size_t(-1)) if((!is.eof() && !is.good()) || no == std::size_t(-1))
return false; return false;
CGAL::internal::resize(polygons[i], no); CGAL::internal::resize(polygons[i], no);
@ -126,6 +125,10 @@ bool read_OFF(std::istream& is,
{ {
std::size_t id; std::size_t id;
scanner.scan_facet_vertex_index(id,j+1, i); scanner.scan_facet_vertex_index(id,j+1, i);
if(!is)
{
return false;
}
if(id < scanner.size_of_vertices()) if(id < scanner.size_of_vertices())
polygons[i][j] = id; polygons[i][j] = id;
else else

View File

@ -138,7 +138,7 @@ public:
void scan_vertex(float& x, float& y, float& z, float& w) void scan_vertex(float& x, float& y, float& z, float& w)
{ {
double dx, dy, dz, dw; double dx(0), dy(0), dz(0), dw(0);
scan_vertex(dx, dy, dz, dw); scan_vertex(dx, dy, dz, dw);
x = static_cast<float>(dx); x = static_cast<float>(dx);
y = static_cast<float>(dy); y = static_cast<float>(dy);
@ -148,7 +148,7 @@ public:
void scan_vertex(int& x, int& y, int& z, int& w) void scan_vertex(int& x, int& y, int& z, int& w)
{ {
double dx, dy, dz, dw; double dx(0), dy(0), dz(0), dw(0);
scan_vertex(dx, dy, dz, dw); scan_vertex(dx, dy, dz, dw);
x = static_cast<int>(dx); x = static_cast<int>(dx);
y = static_cast<int>(dy); y = static_cast<int>(dy);
@ -158,7 +158,7 @@ public:
void scan_vertex(double& x, double& y, double& z) void scan_vertex(double& x, double& y, double& z)
{ {
double dx, dy, dz, dw; double dx(0), dy(0), dz(0), dw(0);
scan_vertex(dx, dy, dz, dw); scan_vertex(dx, dy, dz, dw);
x = dx / dw; x = dx / dw;
y = dy / dw; y = dy / dw;
@ -167,7 +167,7 @@ public:
void scan_vertex(float& x, float& y, float& z) void scan_vertex(float& x, float& y, float& z)
{ {
double dx, dy, dz; double dx(0), dy(0), dz(0);
scan_vertex(dx, dy, dz); scan_vertex(dx, dy, dz);
x = static_cast<float>(dx); x = static_cast<float>(dx);
y = static_cast<float>(dy); y = static_cast<float>(dy);
@ -176,7 +176,7 @@ public:
void scan_vertex(int& x, int& y, int& z) void scan_vertex(int& x, int& y, int& z)
{ {
double dx, dy, dz; double dx(0), dy(0), dz(0);
scan_vertex(dx, dy, dz); scan_vertex(dx, dy, dz);
x = static_cast<int>(dx); x = static_cast<int>(dx);
y = static_cast<int>(dy); y = static_cast<int>(dy);
@ -322,7 +322,7 @@ public:
void scan_normal(float& x, float& y, float& z, float& w) void scan_normal(float& x, float& y, float& z, float& w)
{ {
double dx, dy, dz, dw; double dx(0), dy(0), dz(0), dw(0);
scan_normal(dx, dy, dz, dw); scan_normal(dx, dy, dz, dw);
x = static_cast<float>(dx); x = static_cast<float>(dx);
y = static_cast<float>(dy); y = static_cast<float>(dy);
@ -332,7 +332,7 @@ public:
void scan_normal(int& x, int& y, int& z, int& w) void scan_normal(int& x, int& y, int& z, int& w)
{ {
double dx, dy, dz, dw; double dx(0), dy(0), dz(0), dw(0);
scan_normal(dx, dy, dz, dw); scan_normal(dx, dy, dz, dw);
x = static_cast<int>(dx); x = static_cast<int>(dx);
y = static_cast<int>(dy); y = static_cast<int>(dy);
@ -342,7 +342,7 @@ public:
void scan_normal(double& x, double& y, double& z) void scan_normal(double& x, double& y, double& z)
{ {
double dx, dy, dz, dw; double dx(0), dy(0), dz(0), dw(0);
scan_normal(dx, dy, dz, dw); scan_normal(dx, dy, dz, dw);
x = dx / dw; x = dx / dw;
y = dy / dw; y = dy / dw;
@ -351,7 +351,7 @@ public:
void scan_normal(float& x, float& y, float& z) void scan_normal(float& x, float& y, float& z)
{ {
double dx, dy, dz; double dx(0), dy(0), dz(0);
scan_normal(dx, dy, dz); scan_normal(dx, dy, dz);
x = static_cast<float>(dx); x = static_cast<float>(dx);
y = static_cast<float>(dy); y = static_cast<float>(dy);
@ -360,7 +360,7 @@ public:
void scan_normal(int& x, int& y, int& z) void scan_normal(int& x, int& y, int& z)
{ {
double dx, dy, dz; double dx(0), dy(0), dz(0);
scan_normal(dx, dy, dz); scan_normal(dx, dy, dz);
x = static_cast<int>(dx); x = static_cast<int>(dx);
y = static_cast<int>(dy); y = static_cast<int>(dy);
@ -853,7 +853,7 @@ Point& file_scan_vertex(File_scanner_OFF& scanner, Point& p)
{ {
typedef typename Point::R R; typedef typename Point::R R;
typedef typename R::RT RT; typedef typename R::RT RT;
double x, y, z, w; double x(0), y(0), z(0), w(0);
scanner.scan_vertex(x, y, z, w); scanner.scan_vertex(x, y, z, w);
@ -882,7 +882,7 @@ file_scan_normal(File_scanner_OFF& scanner, Vector& v)
typedef typename Vector::R R; typedef typename Vector::R R;
typedef typename R::RT RT; typedef typename R::RT RT;
double x, y, z, w; double x(0), y(0), z(0), w(0);
scanner.scan_normal(x, y, z, w); scanner.scan_normal(x, y, z, w);
if(w == 1) if(w == 1)
v = Vector(RT(x), RT(y), RT(z)); v = Vector(RT(x), RT(y), RT(z));

View File

@ -30,7 +30,8 @@ namespace internal {
template <typename Kernel> template <typename Kernel>
void fill_point(const double x, const double y, const double z, const double w, CGAL::Point_3<Kernel>& pt) void fill_point(const double x, const double y, const double z, const double w, CGAL::Point_3<Kernel>& pt)
{ {
pt = CGAL::Point_3<Kernel>(x, y, z, w); typedef typename Kernel::FT FT;
pt = CGAL::Point_3<Kernel>(FT(x/w), FT(y/w), FT(z/w));
} }
template <typename Point_3> template <typename Point_3>