diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 158071c3f98..bf499143eb2 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -355,7 +355,7 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa friend void put(const DummyNormalMap&, const key_type&, const value_type&) { } }; - typedef DummyNormalMap NoMap; + typedef DummyNormalMap NoMap; // public typedef typename internal_np::Lookup_named_param_def< internal_np::normal_t, NamedParameters, @@ -367,6 +367,11 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa return parameters::choose_parameter(parameters::get_parameter(np, internal_np::point_map)); } + static Point_map get_point_map(const NamedParameters& np) + { + return parameters::choose_parameter(parameters::get_parameter(np, internal_np::point_map)); + } + static Const_point_map get_const_point_map(const PointRange&, const NamedParameters& np) { return parameters::choose_parameter(parameters::get_parameter(np, internal_np::point_map)); @@ -377,6 +382,11 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa return parameters::choose_parameter(parameters::get_parameter(np, internal_np::normal_map)); } + static Normal_map get_normal_map(const NamedParameters& np) + { + return parameters::choose_parameter(parameters::get_parameter(np, internal_np::normal_map)); + } + static Geom_traits get_geom_traits(const PointRange&, const NamedParameters& np) { return parameters::choose_parameter(parameters::get_parameter(np, internal_np::geom_traits)); @@ -397,67 +407,6 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa }; }; - namespace parameters - { - template - CGAL::parameters::Default_named_parameters - inline all_default(const PointRange&) - { - return CGAL::parameters::all_default(); - } - } - - template - class GetFT - { - public: - typedef typename Kernel_traits< - typename std::iterator_traits< - typename PointRange::iterator - >::value_type - >::Kernel::FT type; - }; - - template - class GetK - { - typedef typename GetPointMap::type Vpm; - typedef typename Kernel_traits< - typename boost::property_traits::value_type - >::Kernel Default_kernel; - - public: - typedef typename internal_np::Lookup_named_param_def < - internal_np::geom_traits_t, - NamedParameters, - Default_kernel - > ::type Kernel; - }; - - template - class GetNormalMap - { - struct DummyNormalMap - { - typedef typename std::iterator_traits::value_type key_type; - typedef typename GetK::Kernel::Vector_3 value_type; - typedef value_type reference; - typedef boost::read_write_property_map_tag category; - - typedef DummyNormalMap Self; - friend value_type get(const Self&, const key_type&) { return CGAL::NULL_VECTOR; } - friend void put(const Self&, const key_type&, const value_type&) { } - }; - - public: - typedef DummyNormalMap NoMap; - typedef typename internal_np::Lookup_named_param_def < - internal_np::normal_t, - NamedParameters, - DummyNormalMap//default - > ::type type; - }; - template class GetPlaneMap { diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index cac9a61de93..9e7935232c5 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -92,16 +92,16 @@ bool read_OFF(std::istream& is, typedef Point_set_processing_3::Fake_point_range PointRange; // basic geometric types - typedef typename CGAL::GetPointMap::type PointMap; - typedef typename Point_set_processing_3::GetNormalMap::type NormalMap; - typedef typename Point_set_processing_3::GetK::Kernel Kernel; - typedef typename Kernel::FT FT; + typedef Point_set_processing_3_np_helper NP_helper; + typedef typename NP_helper::Point_map PointMap; + typedef typename NP_helper::Normal_map NormalMap; + typedef typename NP_helper::Geom_traits Kernel; + typedef typename Kernel::FT FT; - bool has_normals = !(boost::is_same::NoMap>::value); + bool has_normals = !(boost::is_same::value); - PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); - NormalMap normal_map = choose_parameter(get_parameter(np, internal_np::normal_map)); + PointMap point_map = NP_helper::get_point_map(np); + NormalMap normal_map = NP_helper::get_normal_map(np); // value_type_traits is a workaround as back_insert_iterator's value_type is void // typedef typename value_type_traits::type Enriched_point; diff --git a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h index 3a0170a0242..feaaa1c07f6 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h @@ -254,14 +254,14 @@ bool read_PLY(std::istream& is, typedef Point_set_processing_3::Fake_point_range PointRange; // basic geometric types - typedef typename CGAL::GetPointMap::type PointMap; - typedef typename Point_set_processing_3::GetNormalMap::type NormalMap; + typedef Point_set_processing_3_np_helper NP_helper; + typedef typename NP_helper::Point_map PointMap; + typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = !(boost::is_same::NoMap>::value); + bool has_normals = !(boost::is_same::value); - PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); - NormalMap normal_map = choose_parameter(get_parameter(np, internal_np::normal_map)); + PointMap point_map = NP_helper::get_point_map(np); + NormalMap normal_map = NP_helper::get_normal_map(np); if(has_normals) return read_PLY_with_properties(is, output, diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index 7fa9e7b6da2..abece867487 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -85,15 +85,15 @@ bool read_XYZ(std::istream& is, typedef Point_set_processing_3::Fake_point_range PointRange; // basic geometric types - typedef typename CGAL::GetPointMap::type PointMap; - typedef typename Point_set_processing_3::GetNormalMap::type NormalMap; - typedef typename Point_set_processing_3::GetK::Kernel Kernel; + typedef Point_set_processing_3_np_helper NP_helper; + typedef typename NP_helper::Point_map PointMap; + typedef typename NP_helper::Normal_map NormalMap; + typedef typename NP_helper::Geom_traits Kernel; - bool has_normals = !(boost::is_same::NoMap>::value); + bool has_normals = !(boost::is_same::value); - PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); - NormalMap normal_map = choose_parameter(get_parameter(np, internal_np::normal_map)); + PointMap point_map = NP_helper::get_point_map(np); + NormalMap normal_map = NP_helper::get_normal_map(np); // value_type_traits is a workaround as back_insert_iterator's value_type is void //typedef typename value_type_traits::type Enriched_point; diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index 7de17f726f0..658d7f2c9cb 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -44,13 +44,14 @@ bool write_OFF_PSP(std::ostream& os, using CGAL::parameters::is_default_parameter; // basic geometric types - typedef typename CGAL::GetPointMap::type PointMap; - typedef typename Point_set_processing_3::GetNormalMap::type NormalMap; + typedef Point_set_processing_3_np_helper NP_helper; + typedef typename NP_helper::Const_point_map PointMap; + typedef typename NP_helper::Normal_map NormalMap; const bool has_normals = !(is_default_parameter(get_parameter(np, internal_np::normal_map))); - PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); - NormalMap normal_map = choose_parameter(get_parameter(np, internal_np::normal_map)); + PointMap point_map = NP_helper::get_const_point_map(points, np); + NormalMap normal_map = NP_helper::get_normal_map(points, np); CGAL_point_set_processing_precondition(points.begin() != points.end()); diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index 66eedccfac6..15e0d460ccc 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -201,8 +201,7 @@ bool write_PLY(std::ostream& os, typedef typename NP_helper::Const_point_map PointMap; typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = !(boost::is_same::NoMap>::value); + bool has_normals = !(boost::is_same::value); PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h index 9d7383cd83c..ff154a4e26b 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h @@ -43,15 +43,14 @@ bool write_XYZ_PSP(std::ostream& os, using CGAL::parameters::get_parameter; // basic geometric types - typedef typename CGAL::GetPointMap::type PointMap; - typedef typename Point_set_processing_3::GetNormalMap::type NormalMap; + typedef Point_set_processing_3_np_helper NP_helper; + typedef typename NP_helper::Const_point_map PointMap; + typedef typename NP_helper::Normal_map NormalMap; - bool has_normals = !(std::is_same::NoMap>::value); + bool has_normals = !(boost::is_same::value); - PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); - NormalMap normal_map = choose_parameter(get_parameter(np, internal_np::normal_map)); + PointMap point_map = NP_helper::get_const_point_map(points, np); + NormalMap normal_map = NP_helper::get_normal_map(points, np); CGAL_point_set_processing_precondition(points.begin() != points.end()); diff --git a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h index 440685f4d9d..45d0675b81d 100644 --- a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h @@ -278,8 +278,7 @@ bilateral_smooth_point_set( typedef typename Kernel::Point_3 Point_3; typedef typename Kernel::Vector_3 Vector_3; - CGAL_static_assertion_msg(!(boost::is_same::NoMap>::value), + CGAL_static_assertion_msg(!(boost::is_same::value), "Error: no normal map"); typedef typename Kernel::FT FT; diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index 6db7f9fd060..6d9b25d8a04 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -367,8 +367,7 @@ edge_aware_upsample_point_set( typedef typename NP_helper::Geom_traits Kernel; - CGAL_static_assertion_msg(!(boost::is_same::NoMap>::value), + CGAL_static_assertion_msg(!(boost::is_same::value), "Error: no normal map"); typedef typename Kernel::Point_3 Point; diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h index 91304a5790c..c2b7f68bb4f 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -196,8 +196,7 @@ jet_estimate_normals( typedef typename Kernel::FT FT; typedef typename GetSvdTraits::type SvdTraits; - CGAL_static_assertion_msg(!(boost::is_same::NoMap>::value), + CGAL_static_assertion_msg(!(boost::is_same::value), "Error: no normal map"); CGAL_static_assertion_msg(!(boost::is_same::NoTraits>::value), diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index c16cf95afb9..a0c38a5c47b 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -617,8 +617,7 @@ mst_orient_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Point_set_processing_3::GetIsConstrainedMap::type ConstrainedMap; - CGAL_static_assertion_msg(!(boost::is_same::NoMap>::value), + CGAL_static_assertion_msg(!(boost::is_same::value), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h index a4011bde4c5..5db5769c599 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -168,8 +168,7 @@ pca_estimate_normals( typedef typename NP_helper::Geom_traits Kernel; typedef typename Kernel::FT FT; - CGAL_static_assertion_msg(!(boost::is_same::NoMap>::value), + CGAL_static_assertion_msg(!(boost::is_same::value), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h index 520ca3dcc1e..2b314612c8d 100644 --- a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h @@ -478,9 +478,7 @@ void scanline_orient_normals (PointRange& points, const NamedParameters& np = pa ::type; using Fallback_scanline_ID = Boolean_tag::value>; - CGAL_static_assertion_msg(!(std::is_same::NoMap>::value), + CGAL_static_assertion_msg(!(std::is_same::value), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index 4b7d318add0..5b01d11f8b6 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -233,8 +233,7 @@ public: typedef typename Point_set_processing_3::GetPlaneMap::type PlaneMap; typedef typename Point_set_processing_3::GetPlaneIndexMap::type PlaneIndexMap; - CGAL_static_assertion_msg(!(boost::is_same::NoMap>::value), + CGAL_static_assertion_msg(!(boost::is_same::value), "Error: no normal map"); CGAL_static_assertion_msg(!(boost::is_same::NoMap>::value), diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index 3f6cf27075c..6fdc2570e76 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -321,8 +321,7 @@ vcm_estimate_normals_internal (PointRange& points, typedef typename NP_helper::Geom_traits Kernel; typedef typename GetDiagonalizeTraits::type DiagonalizeTraits; - CGAL_static_assertion_msg(!(boost::is_same::NoMap>::value), + CGAL_static_assertion_msg(!(boost::is_same::value), "Error: no normal map"); PointMap point_map = NP_helper::get_point_map(points, np); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h index d5e39611018..974cc8a520c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/simplify_polyline.h @@ -45,7 +45,7 @@ void simplify_polyline(const PointRangeIn& input, typedef typename GetPointMap::type Point_map_in; typedef typename GetPointMap::type Point_map_out; - typedef typename Point_set_processing_3::GetK::Kernel Kernel; + typedef typename Point_set_processing_3_np_helper::Geom_traits Kernel; Point_map_in in_pm = choose_parameter(get_parameter(np_in, internal_np::point_map)); Point_map_out out_pm = choose_parameter(get_parameter(np_out, internal_np::point_map));