Merge pull request #7109 from afabri/Three-fix_for_no_deprecated-GF

Three, and Polyhedron Demo: Add an #include and remove deprecated code
This commit is contained in:
Laurent Rineau 2022-12-14 10:39:42 +01:00
commit 8497dcda55
7 changed files with 23 additions and 16 deletions

View File

@ -13,6 +13,7 @@
#ifndef QGLVIEWER_CAMERA_H #ifndef QGLVIEWER_CAMERA_H
#define QGLVIEWER_CAMERA_H #define QGLVIEWER_CAMERA_H
#include <array>
#include <QMap> #include <QMap>
#include <CGAL/Qt/vec.h> #include <CGAL/Qt/vec.h>
#include <CGAL/Qt/quaternion.h> #include <CGAL/Qt/quaternion.h>

View File

@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.1...3.23)
project( Polyhedron_Demo ) project( Polyhedron_Demo )
include(FeatureSummary) include(FeatureSummary)
add_definitions ( -DCGAL_NO_DEPRECATED_CODE )
# Find includes in corresponding build directories # Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)

View File

@ -1,3 +1,4 @@
#include <CGAL/IO/io.h>
#include <CGAL/Three/Three.h> #include <CGAL/Three/Three.h>
#include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h> #include <CGAL/Three/Polyhedron_demo_io_plugin_interface.h>
#include "T3_type.h" #include "T3_type.h"
@ -34,7 +35,7 @@ public:
T3 tr;; T3 tr;;
if(fileinfo.absoluteFilePath().endsWith(".binary.cgal")) if(fileinfo.absoluteFilePath().endsWith(".binary.cgal"))
CGAL::set_binary_mode(ifs); CGAL::IO::set_binary_mode(ifs);
ifs >> tr; ifs >> tr;
if(ifs.fail() || !tr.is_valid(false)) { if(ifs.fail() || !tr.is_valid(false)) {
std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl; std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl;
@ -71,11 +72,11 @@ public:
std::ofstream out(fileinfo.filePath().toUtf8()); std::ofstream out(fileinfo.filePath().toUtf8());
if(path.endsWith(".binary.cgal")) if(path.endsWith(".binary.cgal"))
{ {
CGAL::set_binary_mode(out); CGAL::IO::set_binary_mode(out);
} }
else else
{ {
CGAL::set_ascii_mode(out); CGAL::IO::set_ascii_mode(out);
} }
out << t3_item->triangulation(); out << t3_item->triangulation();
if( out.fail()) if( out.fail())

View File

@ -220,7 +220,7 @@ public Q_SLOTS:
CGAL::Polygon_mesh_processing::tangential_relaxation( CGAL::Polygon_mesh_processing::tangential_relaxation(
vset, vset,
pmesh, pmesh,
CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter) CGAL::parameters::number_of_iterations(nb_iter)
.edge_is_constrained_map(selection_item->constrained_edges_pmap()) .edge_is_constrained_map(selection_item->constrained_edges_pmap())
.vertex_is_constrained_map(selection_item->constrained_vertices_pmap()) .vertex_is_constrained_map(selection_item->constrained_vertices_pmap())
.relax_constraints(smooth_features)); .relax_constraints(smooth_features));
@ -234,7 +234,7 @@ public Q_SLOTS:
CGAL::Polygon_mesh_processing::tangential_relaxation( CGAL::Polygon_mesh_processing::tangential_relaxation(
vertices(pmesh), vertices(pmesh),
pmesh, pmesh,
CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter)); CGAL::parameters::number_of_iterations(nb_iter));
poly_item->invalidateOpenGLBuffers(); poly_item->invalidateOpenGLBuffers();
Q_EMIT poly_item->itemChanged(); Q_EMIT poly_item->itemChanged();
@ -277,7 +277,7 @@ public Q_SLOTS:
if(poly_item) if(poly_item)
{ {
angle_and_area_smoothing(pmesh, parameters::do_project(projection) angle_and_area_smoothing(pmesh, CGAL::parameters::do_project(projection)
.number_of_iterations(nb_iter) .number_of_iterations(nb_iter)
.vertex_is_constrained_map(vcmap) .vertex_is_constrained_map(vcmap)
.use_safety_constraints(use_safety_measures) .use_safety_constraints(use_safety_measures)
@ -295,7 +295,7 @@ public Q_SLOTS:
// No faces selected --> use all faces // No faces selected --> use all faces
if(std::begin(selection_item->selected_facets) == std::end(selection_item->selected_facets)) if(std::begin(selection_item->selected_facets) == std::end(selection_item->selected_facets))
{ {
angle_and_area_smoothing(pmesh, parameters::do_project(projection) angle_and_area_smoothing(pmesh, CGAL::parameters::do_project(projection)
.number_of_iterations(nb_iter) .number_of_iterations(nb_iter)
.vertex_is_constrained_map(vcmap) .vertex_is_constrained_map(vcmap)
.edge_is_constrained_map(selection_item->constrained_edges_pmap()) .edge_is_constrained_map(selection_item->constrained_edges_pmap())
@ -306,7 +306,7 @@ public Q_SLOTS:
} }
else // some faces exist in the selection else // some faces exist in the selection
{ {
angle_and_area_smoothing(selection_item->selected_facets, pmesh, parameters::do_project(projection) angle_and_area_smoothing(selection_item->selected_facets, pmesh, CGAL::parameters::do_project(projection)
.number_of_iterations(nb_iter) .number_of_iterations(nb_iter)
.vertex_is_constrained_map(vcmap) .vertex_is_constrained_map(vcmap)
.edge_is_constrained_map(selection_item->constrained_edges_pmap()) .edge_is_constrained_map(selection_item->constrained_edges_pmap())
@ -350,7 +350,7 @@ public Q_SLOTS:
if(poly_item) if(poly_item)
{ {
smooth_shape(pmesh, time_step, parameters::number_of_iterations(nb_iter) smooth_shape(pmesh, time_step, CGAL::parameters::number_of_iterations(nb_iter)
.vertex_is_constrained_map(vcmap)); .vertex_is_constrained_map(vcmap));
poly_item->invalidateOpenGLBuffers(); poly_item->invalidateOpenGLBuffers();
@ -362,13 +362,13 @@ public Q_SLOTS:
if(std::begin(selection_item->selected_facets) == std::end(selection_item->selected_facets)) if(std::begin(selection_item->selected_facets) == std::end(selection_item->selected_facets))
{ {
smooth_shape(pmesh, time_step, parameters::number_of_iterations(nb_iter) smooth_shape(pmesh, time_step, CGAL::parameters::number_of_iterations(nb_iter)
.vertex_is_constrained_map(vcmap)); .vertex_is_constrained_map(vcmap));
} }
else else
{ {
smooth_shape(selection_item->selected_facets, pmesh, time_step, smooth_shape(selection_item->selected_facets, pmesh, time_step,
parameters::number_of_iterations(nb_iter) CGAL::parameters::number_of_iterations(nb_iter)
.vertex_is_constrained_map(vcmap)); .vertex_is_constrained_map(vcmap));
} }

View File

@ -30,6 +30,7 @@
#include <boost/iterator/function_output_iterator.hpp> #include <boost/iterator/function_output_iterator.hpp>
#include <CGAL/IO/io.h>
#include <CGAL/AABB_tree.h> #include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h> #include <CGAL/AABB_traits.h>
#include <CGAL/AABB_triangulation_3_cell_primitive.h> #include <CGAL/AABB_triangulation_3_cell_primitive.h>
@ -276,7 +277,7 @@ void Scene_c3t3_item::show_cnc(bool b)
bool Scene_c3t3_item::load_binary(std::istream& is) bool Scene_c3t3_item::load_binary(std::istream& is)
{ {
if(!CGAL::Mesh_3::load_binary_file(is, c3t3())) return false; if(!CGAL::IO::load_binary_file(is, c3t3())) return false;
resetCutPlane(); resetCutPlane();
if(is.good()) { if(is.good()) {
c3t3_changed(); c3t3_changed();

View File

@ -38,6 +38,7 @@
#include <CGAL/AABB_traits.h> #include <CGAL/AABB_traits.h>
#include <CGAL/AABB_triangulation_3_cell_primitive.h> #include <CGAL/AABB_triangulation_3_cell_primitive.h>
#include <CGAL/facets_in_complex_3_to_triangle_mesh.h> #include <CGAL/facets_in_complex_3_to_triangle_mesh.h>
#include <CGAL/IO/Color.h>
#include "Scene_polygon_soup_item.h" #include "Scene_polygon_soup_item.h"
@ -188,7 +189,7 @@ public :
} }
void addTriangle(const Tr::Bare_point& pa, const Tr::Bare_point& pb, void addTriangle(const Tr::Bare_point& pa, const Tr::Bare_point& pb,
const Tr::Bare_point& pc, const CGAL::Color color) const Tr::Bare_point& pc, const CGAL::IO::Color color)
{ {
const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset();
Geom_traits::Vector_3 n = cross_product(pb - pa, pc - pa); Geom_traits::Vector_3 n = cross_product(pb - pa, pc - pa);
@ -1253,7 +1254,7 @@ void Scene_triangulation_3_item_priv::computeIntersection(const Primitive& cell)
const Tr::Bare_point& pc = wp2p(ch->vertex(2)->point()); const Tr::Bare_point& pc = wp2p(ch->vertex(2)->point());
const Tr::Bare_point& pd = wp2p(ch->vertex(3)->point()); const Tr::Bare_point& pd = wp2p(ch->vertex(3)->point());
CGAL::Color color(UC(c.red()), UC(c.green()), UC(c.blue())); CGAL::IO::Color color(UC(c.red()), UC(c.green()), UC(c.blue()));
if(is_filterable) if(is_filterable)
{ {
@ -1355,7 +1356,7 @@ void Scene_triangulation_3_item_priv::computeSpheres()
typedef unsigned char UC; typedef unsigned char UC;
tr_vertices.push_back(*vit); tr_vertices.push_back(*vit);
spheres->add_sphere(Geom_traits::Sphere_3(center, radius),s_id++, spheres->add_sphere(Geom_traits::Sphere_3(center, radius),s_id++,
CGAL::Color(UC(c.red()), UC(c.green()), UC(c.blue()))); CGAL::IO::Color(UC(c.red()), UC(c.green()), UC(c.blue())));
} }
spheres->invalidateOpenGLBuffers(); spheres->invalidateOpenGLBuffers();

View File

@ -18,7 +18,7 @@
#include <list> #include <list>
#include <vector> #include <vector>
#include <map> #include <unordered_map>
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
#include <iostream> #include <iostream>