From fbc7af1345e42c79e6c8eba6fcbf3b99d918f9ab Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 26 Apr 2018 09:07:49 +0200 Subject: [PATCH 1/8] Add a property_map that converts points from a cartesian kernel to another, for a mesh. --- Property_map/include/CGAL/property_map.h | 42 +++++++++++++++++++ Property_map/test/Property_map/CMakeLists.txt | 2 + .../kernel_converter_properties_test.cpp | 36 ++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 Property_map/test/Property_map/kernel_converter_properties_test.cpp diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index e8612db429c..1452c46f60a 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -36,6 +36,8 @@ #include // defines std::pair +#include + namespace CGAL { /// \cond SKIP_DOXYGEN @@ -503,6 +505,46 @@ make_boolean_property_map(Set& set_) return Boolean_property_map(set_); } +/// \ingroup PkgProperty_map +/// Read-write Property map turning a `CGAL::Point_3` into a +/// `CGAL::Point_3`, using a `Cartesian_converter`. +/// It means that `K1` and `K2` must be Cartesian Kernels. +/// \cgalModels `ReadWritePropertyMap` +template::category> +struct Kernel_converter_property_map +{ + typedef typename boost::property_traits::key_type key_type; + typedef typename K2::Point_3 value_type; + typedef typename K2::Point_3 reference; + typedef t_category category; + Vpm* vpm; + Kernel_converter_property_map(Vpm* vpm):vpm(vpm){} + Kernel_converter_property_map():vpm(NULL){} + + friend value_type get(const Kernel_converter_property_map& pm, const key_type& k) + { + CGAL_assertion(pm.vpm!=NULL); + value_type res = + CGAL::Cartesian_converter()(get(*pm.vpm, k)); + return res; + } + + friend void put(Kernel_converter_property_map& pm, const key_type& k, const value_type& v) + { + CGAL_assertion(pm.vpm!=NULL); + put(*pm.vpm, k, CGAL::Cartesian_converter()(v)); + } +}; + +/// \ingroup PkgProperty_map +/// returns `Kernel_converter_property_map(&vpm)` +template::category> +Kernel_converter_property_map +make_kernel_converter_property_map(Vpm& vpm) +{ + return Kernel_converter_property_map(&vpm); +} + } // namespace CGAL diff --git a/Property_map/test/Property_map/CMakeLists.txt b/Property_map/test/Property_map/CMakeLists.txt index 1e0da002349..8e294e8dbae 100644 --- a/Property_map/test/Property_map/CMakeLists.txt +++ b/Property_map/test/Property_map/CMakeLists.txt @@ -53,6 +53,8 @@ create_single_source_cgal_program( "dynamic_property_map.cpp" ) create_single_source_cgal_program( "dynamic_properties_test.cpp" ) +create_single_source_cgal_program( "kernel_converter_properties_test.cpp" ) + if(OpenMesh_FOUND) target_link_libraries( dynamic_properties_test PRIVATE ${OPENMESH_LIBRARIES} ) endif() diff --git a/Property_map/test/Property_map/kernel_converter_properties_test.cpp b/Property_map/test/Property_map/kernel_converter_properties_test.cpp new file mode 100644 index 00000000000..a6c46424ed2 --- /dev/null +++ b/Property_map/test/Property_map/kernel_converter_properties_test.cpp @@ -0,0 +1,36 @@ + +#include +#include +#include +#include +#include + +typedef CGAL::Simple_cartesian K1; +typedef CGAL::Simple_cartesian > K2; +typedef K1::Point_3 Point_3; + +template +void +test() +{ + Mesh m; + CGAL::make_triangle(Point_3(2,0,0),Point_3(1,0,0),Point_3(1,1,0),m); + + typedef typename boost::property_map::type VPMap; + VPMap vmap = get(CGAL::vertex_point, m); + + CGAL::Kernel_converter_property_map kcmap =CGAL::make_kernel_converter_property_map(vmap); + CGAL_assertion(get(kcmap, *vertices(m).begin()) == CGAL::Point_3(2,0,0)); + put(kcmap, *vertices(m).begin(), CGAL::Point_3(0,2,3)); + CGAL_assertion(get(kcmap, *vertices(m).begin()) == CGAL::Point_3(0,2,3)); + +} + +int main() +{ + + typedef CGAL::Surface_mesh SM; + test(); + return 0; +} + From 7298214c57b31ea3b93105dc585c467fbc9663f0 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 26 Apr 2018 14:14:31 +0200 Subject: [PATCH 2/8] Clean-up --- Property_map/include/CGAL/property_map.h | 25 ++++++++----------- .../kernel_converter_properties_test.cpp | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 1452c46f60a..0679de87ad4 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -511,38 +511,35 @@ make_boolean_property_map(Set& set_) /// It means that `K1` and `K2` must be Cartesian Kernels. /// \cgalModels `ReadWritePropertyMap` template::category> -struct Kernel_converter_property_map +struct Cartesian_converter_property_map { typedef typename boost::property_traits::key_type key_type; typedef typename K2::Point_3 value_type; typedef typename K2::Point_3 reference; typedef t_category category; - Vpm* vpm; - Kernel_converter_property_map(Vpm* vpm):vpm(vpm){} - Kernel_converter_property_map():vpm(NULL){} + Vpm vpm; + Cartesian_converter_property_map(Vpm vpm):vpm(vpm){} - friend value_type get(const Kernel_converter_property_map& pm, const key_type& k) + friend value_type get(const Cartesian_converter_property_map& pm, const key_type& k) { - CGAL_assertion(pm.vpm!=NULL); value_type res = - CGAL::Cartesian_converter()(get(*pm.vpm, k)); + CGAL::Cartesian_converter()(get(pm.vpm, k)); return res; } - friend void put(Kernel_converter_property_map& pm, const key_type& k, const value_type& v) + friend void put(Cartesian_converter_property_map& pm, const key_type& k, const value_type& v) { - CGAL_assertion(pm.vpm!=NULL); - put(*pm.vpm, k, CGAL::Cartesian_converter()(v)); + put(pm.vpm, k, CGAL::Cartesian_converter()(v)); } }; /// \ingroup PkgProperty_map -/// returns `Kernel_converter_property_map(&vpm)` +/// returns `Cartesian_converter_property_map(&vpm)` template::category> -Kernel_converter_property_map -make_kernel_converter_property_map(Vpm& vpm) +Cartesian_converter_property_map +make_cartesian_converter_property_map(Vpm vpm) { - return Kernel_converter_property_map(&vpm); + return Kernel_converter_property_map(vpm); } } // namespace CGAL diff --git a/Property_map/test/Property_map/kernel_converter_properties_test.cpp b/Property_map/test/Property_map/kernel_converter_properties_test.cpp index a6c46424ed2..7adadb06af1 100644 --- a/Property_map/test/Property_map/kernel_converter_properties_test.cpp +++ b/Property_map/test/Property_map/kernel_converter_properties_test.cpp @@ -19,7 +19,7 @@ test() typedef typename boost::property_map::type VPMap; VPMap vmap = get(CGAL::vertex_point, m); - CGAL::Kernel_converter_property_map kcmap =CGAL::make_kernel_converter_property_map(vmap); + CGAL::Cartesian_converter_property_map kcmap =CGAL::make_cartesian_converter_property_map(vmap); CGAL_assertion(get(kcmap, *vertices(m).begin()) == CGAL::Point_3(2,0,0)); put(kcmap, *vertices(m).begin(), CGAL::Point_3(0,2,3)); CGAL_assertion(get(kcmap, *vertices(m).begin()) == CGAL::Point_3(0,2,3)); From dbb4b9dc202e18326e310aba5d6aee2ed083833f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 26 Apr 2018 15:34:32 +0200 Subject: [PATCH 3/8] Fixes --- BGL/package_info/BGL/dependencies | 8 -------- Classification/package_info/Classification/dependencies | 1 + Generator/package_info/Generator/dependencies | 1 + HalfedgeDS/package_info/HalfedgeDS/dependencies | 1 + Interpolation/package_info/Interpolation/dependencies | 3 +++ .../Optimal_transportation_reconstruction_2/dependencies | 1 + Partition_2/package_info/Partition_2/dependencies | 1 + Point_set_2/package_info/Point_set_2/dependencies | 1 + Point_set_3/package_info/Point_set_3/dependencies | 1 + .../package_info/Point_set_shape_detection_3/dependencies | 1 + Polyhedron/package_info/Polyhedron/dependencies | 1 + Polyhedron_IO/package_info/Polyhedron_IO/dependencies | 2 +- Property_map/include/CGAL/property_map.h | 2 +- Property_map/package_info/Property_map/dependencies | 8 ++++++++ Ridges_3/package_info/Ridges_3/dependencies | 1 + .../package_info/Spatial_searching/dependencies | 1 + Spatial_sorting/package_info/Spatial_sorting/dependencies | 3 +++ Stream_lines_2/package_info/Stream_lines_2/dependencies | 1 + .../Surface_mesh_parameterization/dependencies | 1 + Triangulation_2/package_info/Triangulation_2/dependencies | 1 - Visibility_2/package_info/Visibility_2/dependencies | 1 + 21 files changed, 30 insertions(+), 11 deletions(-) diff --git a/BGL/package_info/BGL/dependencies b/BGL/package_info/BGL/dependencies index 73de807750e..3d5f5f0db25 100644 --- a/BGL/package_info/BGL/dependencies +++ b/BGL/package_info/BGL/dependencies @@ -1,19 +1,11 @@ Algebraic_foundations -Arithmetic_kernel BGL Cartesian_kernel Circulator -Distance_2 -Distance_3 -Filtered_kernel Hash_map -Homogeneous_kernel Installation -Intersections_2 -Intersections_3 Interval_support Kernel_23 -Kernel_d Modular_arithmetic Number_types Profiling_tools diff --git a/Classification/package_info/Classification/dependencies b/Classification/package_info/Classification/dependencies index dbac1f495ad..27c78fe9bcd 100644 --- a/Classification/package_info/Classification/dependencies +++ b/Classification/package_info/Classification/dependencies @@ -1,5 +1,6 @@ Algebraic_foundations BGL +Cartesian_kernel Circulator Classification Distance_2 diff --git a/Generator/package_info/Generator/dependencies b/Generator/package_info/Generator/dependencies index 04faaf3547d..d07c3a3e2ed 100644 --- a/Generator/package_info/Generator/dependencies +++ b/Generator/package_info/Generator/dependencies @@ -1,5 +1,6 @@ Algebraic_foundations BGL +Cartesian_kernel Circulator Generator Installation diff --git a/HalfedgeDS/package_info/HalfedgeDS/dependencies b/HalfedgeDS/package_info/HalfedgeDS/dependencies index 08b771effbc..b200611754d 100644 --- a/HalfedgeDS/package_info/HalfedgeDS/dependencies +++ b/HalfedgeDS/package_info/HalfedgeDS/dependencies @@ -1,5 +1,6 @@ Algebraic_foundations BGL +Cartesian_kernel Circulator HalfedgeDS Hash_map diff --git a/Interpolation/package_info/Interpolation/dependencies b/Interpolation/package_info/Interpolation/dependencies index 244b876a53c..12cc6206e09 100644 --- a/Interpolation/package_info/Interpolation/dependencies +++ b/Interpolation/package_info/Interpolation/dependencies @@ -1,10 +1,13 @@ Algebraic_foundations +Cartesian_kernel Circulator Filtered_kernel Hash_map Installation Interpolation +Interval_support Kernel_23 +Modular_arithmetic Number_types Polygon Profiling_tools diff --git a/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies b/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies index 625a107675c..4e6bf12bc2d 100644 --- a/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies +++ b/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies @@ -1,4 +1,5 @@ Algebraic_foundations +Cartesian_kernel Circulator Distance_2 Filtered_kernel diff --git a/Partition_2/package_info/Partition_2/dependencies b/Partition_2/package_info/Partition_2/dependencies index 6ff0abd837d..b5203b6c7ea 100644 --- a/Partition_2/package_info/Partition_2/dependencies +++ b/Partition_2/package_info/Partition_2/dependencies @@ -1,4 +1,5 @@ Algebraic_foundations +Cartesian_kernel Circulator Convex_hull_2 Distance_2 diff --git a/Point_set_2/package_info/Point_set_2/dependencies b/Point_set_2/package_info/Point_set_2/dependencies index 8978ceba4bf..7ac0828196c 100644 --- a/Point_set_2/package_info/Point_set_2/dependencies +++ b/Point_set_2/package_info/Point_set_2/dependencies @@ -1,4 +1,5 @@ Algebraic_foundations +Cartesian_kernel Circulator Distance_2 Filtered_kernel diff --git a/Point_set_3/package_info/Point_set_3/dependencies b/Point_set_3/package_info/Point_set_3/dependencies index 372b476bbed..5f04823a1da 100644 --- a/Point_set_3/package_info/Point_set_3/dependencies +++ b/Point_set_3/package_info/Point_set_3/dependencies @@ -1,5 +1,6 @@ Algebraic_foundations BGL +Cartesian_kernel Installation Interval_support Kernel_23 diff --git a/Point_set_shape_detection_3/package_info/Point_set_shape_detection_3/dependencies b/Point_set_shape_detection_3/package_info/Point_set_shape_detection_3/dependencies index 9195ca64a0b..a29db70c07b 100644 --- a/Point_set_shape_detection_3/package_info/Point_set_shape_detection_3/dependencies +++ b/Point_set_shape_detection_3/package_info/Point_set_shape_detection_3/dependencies @@ -1,4 +1,5 @@ Algebraic_foundations +Cartesian_kernel Circulator Distance_2 Distance_3 diff --git a/Polyhedron/package_info/Polyhedron/dependencies b/Polyhedron/package_info/Polyhedron/dependencies index 47699a9637a..c05439fa229 100644 --- a/Polyhedron/package_info/Polyhedron/dependencies +++ b/Polyhedron/package_info/Polyhedron/dependencies @@ -1,5 +1,6 @@ Algebraic_foundations BGL +Cartesian_kernel Circulator Distance_2 HalfedgeDS diff --git a/Polyhedron_IO/package_info/Polyhedron_IO/dependencies b/Polyhedron_IO/package_info/Polyhedron_IO/dependencies index b8678f37e1c..be5d5ad8a68 100644 --- a/Polyhedron_IO/package_info/Polyhedron_IO/dependencies +++ b/Polyhedron_IO/package_info/Polyhedron_IO/dependencies @@ -1,8 +1,8 @@ Algebraic_foundations BGL +Cartesian_kernel Circulator Distance_2 -Geomview HalfedgeDS Hash_map Installation diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 0679de87ad4..e9e37076a85 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -539,7 +539,7 @@ template make_cartesian_converter_property_map(Vpm vpm) { - return Kernel_converter_property_map(vpm); + return Cartesian_converter_property_map(vpm); } } // namespace CGAL diff --git a/Property_map/package_info/Property_map/dependencies b/Property_map/package_info/Property_map/dependencies index 76331fefe0d..c41fa31ace1 100644 --- a/Property_map/package_info/Property_map/dependencies +++ b/Property_map/package_info/Property_map/dependencies @@ -1,2 +1,10 @@ +Algebraic_foundations +Cartesian_kernel Installation +Interval_support +Kernel_23 +Modular_arithmetic +Number_types +Profiling_tools STL_Extension +Stream_support diff --git a/Ridges_3/package_info/Ridges_3/dependencies b/Ridges_3/package_info/Ridges_3/dependencies index f4b40909932..2dd776864cc 100644 --- a/Ridges_3/package_info/Ridges_3/dependencies +++ b/Ridges_3/package_info/Ridges_3/dependencies @@ -1,5 +1,6 @@ Algebraic_foundations BGL +Cartesian_kernel Circulator Installation Interval_support diff --git a/Spatial_searching/package_info/Spatial_searching/dependencies b/Spatial_searching/package_info/Spatial_searching/dependencies index 7f1f1b8ce69..a42d0d5839a 100644 --- a/Spatial_searching/package_info/Spatial_searching/dependencies +++ b/Spatial_searching/package_info/Spatial_searching/dependencies @@ -1,4 +1,5 @@ Algebraic_foundations +Cartesian_kernel Circulator Installation Interval_support diff --git a/Spatial_sorting/package_info/Spatial_sorting/dependencies b/Spatial_sorting/package_info/Spatial_sorting/dependencies index ca434381fc1..887a32e04dc 100644 --- a/Spatial_sorting/package_info/Spatial_sorting/dependencies +++ b/Spatial_sorting/package_info/Spatial_sorting/dependencies @@ -1,6 +1,9 @@ Algebraic_foundations +Cartesian_kernel Installation +Interval_support Kernel_23 +Modular_arithmetic Number_types Polygon Profiling_tools diff --git a/Stream_lines_2/package_info/Stream_lines_2/dependencies b/Stream_lines_2/package_info/Stream_lines_2/dependencies index 8634ae398fb..191ae06a73a 100644 --- a/Stream_lines_2/package_info/Stream_lines_2/dependencies +++ b/Stream_lines_2/package_info/Stream_lines_2/dependencies @@ -1,4 +1,5 @@ Algebraic_foundations +Cartesian_kernel Circulator Distance_2 Filtered_kernel diff --git a/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies b/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies index 3ea7153c7fe..ad5b0735677 100644 --- a/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies +++ b/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies @@ -1,6 +1,7 @@ Algebraic_foundations BGL Box_intersection_d +Cartesian_kernel Circulator Distance_2 Filtered_kernel diff --git a/Triangulation_2/package_info/Triangulation_2/dependencies b/Triangulation_2/package_info/Triangulation_2/dependencies index b28aeef4d20..28c356c1be4 100644 --- a/Triangulation_2/package_info/Triangulation_2/dependencies +++ b/Triangulation_2/package_info/Triangulation_2/dependencies @@ -6,7 +6,6 @@ Circulator Distance_2 Distance_3 Filtered_kernel -Geomview Hash_map Homogeneous_kernel Installation diff --git a/Visibility_2/package_info/Visibility_2/dependencies b/Visibility_2/package_info/Visibility_2/dependencies index c4a79a1d03c..0b339c6dc9a 100644 --- a/Visibility_2/package_info/Visibility_2/dependencies +++ b/Visibility_2/package_info/Visibility_2/dependencies @@ -1,5 +1,6 @@ Algebraic_foundations Arrangement_on_surface_2 +Cartesian_kernel Circulator Distance_2 Filtered_kernel From a7721389b2cd1111dfe4316069fc98d099ecd6fb Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 27 Apr 2018 09:52:15 +0200 Subject: [PATCH 4/8] Forward declare the Cartesian_converter to avoid messing with the dependencies tree. --- .../include/CGAL/Cartesian_converter.h | 3 +- .../include/CGAL/Cartesian_converter_fwd.h | 42 +++++++++++++++++++ Property_map/include/CGAL/property_map.h | 2 +- .../package_info/Property_map/dependencies | 8 ---- .../kernel_converter_properties_test.cpp | 1 + 5 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 Installation/include/CGAL/Cartesian_converter_fwd.h diff --git a/Cartesian_kernel/include/CGAL/Cartesian_converter.h b/Cartesian_kernel/include/CGAL/Cartesian_converter.h index d77689adca9..fb25953c85f 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian_converter.h +++ b/Cartesian_kernel/include/CGAL/Cartesian_converter.h @@ -32,6 +32,7 @@ // provided you give a NT converter from A to B. // There's a Homogeneous counterpart. +#include #include #include #include @@ -91,7 +92,7 @@ struct Converting_visitor : boost::static_visitor<> { template < class K1, class K2, // class Converter = NT_converter > - class Converter = typename internal::Default_converter::Type > + class Converter> class Cartesian_converter : public Enum_converter { typedef Enum_converter Base; diff --git a/Installation/include/CGAL/Cartesian_converter_fwd.h b/Installation/include/CGAL/Cartesian_converter_fwd.h new file mode 100644 index 00000000000..d0e36618c20 --- /dev/null +++ b/Installation/include/CGAL/Cartesian_converter_fwd.h @@ -0,0 +1,42 @@ +// Copyright (C) 2018 GeometryFactory Sarl +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// + +#ifndef CGAL_CARTESIAN_CONVERTER_FWD_H +#define CGAL_CARTESIAN_CONVERTER_FWD_H + +/// \file Cartesian_converter_fwd.h +/// Forward declarations of the Cartesian_converter class. + +#ifndef DOXYGEN_RUNNING +namespace CGAL { + +namespace internal { +template < typename K1, typename K2 > +struct Default_converter; +}//internal + +template < class K1, class K2, + class Converter = typename internal::Default_converter::Type > +class Cartesian_converter; + +} // CGAL +#endif + +#endif /* CGAL_CARTESIAN_CONVERTER_FWD_H */ + + diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index e9e37076a85..4935629ddf0 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -36,7 +36,7 @@ #include // defines std::pair -#include +#include namespace CGAL { diff --git a/Property_map/package_info/Property_map/dependencies b/Property_map/package_info/Property_map/dependencies index c41fa31ace1..76331fefe0d 100644 --- a/Property_map/package_info/Property_map/dependencies +++ b/Property_map/package_info/Property_map/dependencies @@ -1,10 +1,2 @@ -Algebraic_foundations -Cartesian_kernel Installation -Interval_support -Kernel_23 -Modular_arithmetic -Number_types -Profiling_tools STL_Extension -Stream_support diff --git a/Property_map/test/Property_map/kernel_converter_properties_test.cpp b/Property_map/test/Property_map/kernel_converter_properties_test.cpp index 7adadb06af1..77905467df4 100644 --- a/Property_map/test/Property_map/kernel_converter_properties_test.cpp +++ b/Property_map/test/Property_map/kernel_converter_properties_test.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include typedef CGAL::Simple_cartesian K1; From 2e5161b06c166134d6c58e83d45f51d91229b59d Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 27 Apr 2018 10:01:12 +0200 Subject: [PATCH 5/8] reset dependencies --- BGL/package_info/BGL/dependencies | 8 ++++++++ Classification/package_info/Classification/dependencies | 1 - Generator/package_info/Generator/dependencies | 1 - HalfedgeDS/package_info/HalfedgeDS/dependencies | 1 - Interpolation/package_info/Interpolation/dependencies | 3 --- .../Optimal_transportation_reconstruction_2/dependencies | 1 - Partition_2/package_info/Partition_2/dependencies | 1 - Point_set_2/package_info/Point_set_2/dependencies | 1 - Point_set_3/package_info/Point_set_3/dependencies | 1 - .../package_info/Point_set_shape_detection_3/dependencies | 1 - Polyhedron/package_info/Polyhedron/dependencies | 1 - Polyhedron_IO/package_info/Polyhedron_IO/dependencies | 2 +- Ridges_3/package_info/Ridges_3/dependencies | 1 - .../package_info/Spatial_searching/dependencies | 1 - Spatial_sorting/package_info/Spatial_sorting/dependencies | 3 --- Stream_lines_2/package_info/Stream_lines_2/dependencies | 1 - .../Surface_mesh_parameterization/dependencies | 1 - Triangulation_2/package_info/Triangulation_2/dependencies | 1 + Visibility_2/package_info/Visibility_2/dependencies | 1 - 19 files changed, 10 insertions(+), 21 deletions(-) diff --git a/BGL/package_info/BGL/dependencies b/BGL/package_info/BGL/dependencies index 3d5f5f0db25..73de807750e 100644 --- a/BGL/package_info/BGL/dependencies +++ b/BGL/package_info/BGL/dependencies @@ -1,11 +1,19 @@ Algebraic_foundations +Arithmetic_kernel BGL Cartesian_kernel Circulator +Distance_2 +Distance_3 +Filtered_kernel Hash_map +Homogeneous_kernel Installation +Intersections_2 +Intersections_3 Interval_support Kernel_23 +Kernel_d Modular_arithmetic Number_types Profiling_tools diff --git a/Classification/package_info/Classification/dependencies b/Classification/package_info/Classification/dependencies index 27c78fe9bcd..dbac1f495ad 100644 --- a/Classification/package_info/Classification/dependencies +++ b/Classification/package_info/Classification/dependencies @@ -1,6 +1,5 @@ Algebraic_foundations BGL -Cartesian_kernel Circulator Classification Distance_2 diff --git a/Generator/package_info/Generator/dependencies b/Generator/package_info/Generator/dependencies index d07c3a3e2ed..04faaf3547d 100644 --- a/Generator/package_info/Generator/dependencies +++ b/Generator/package_info/Generator/dependencies @@ -1,6 +1,5 @@ Algebraic_foundations BGL -Cartesian_kernel Circulator Generator Installation diff --git a/HalfedgeDS/package_info/HalfedgeDS/dependencies b/HalfedgeDS/package_info/HalfedgeDS/dependencies index b200611754d..08b771effbc 100644 --- a/HalfedgeDS/package_info/HalfedgeDS/dependencies +++ b/HalfedgeDS/package_info/HalfedgeDS/dependencies @@ -1,6 +1,5 @@ Algebraic_foundations BGL -Cartesian_kernel Circulator HalfedgeDS Hash_map diff --git a/Interpolation/package_info/Interpolation/dependencies b/Interpolation/package_info/Interpolation/dependencies index 12cc6206e09..244b876a53c 100644 --- a/Interpolation/package_info/Interpolation/dependencies +++ b/Interpolation/package_info/Interpolation/dependencies @@ -1,13 +1,10 @@ Algebraic_foundations -Cartesian_kernel Circulator Filtered_kernel Hash_map Installation Interpolation -Interval_support Kernel_23 -Modular_arithmetic Number_types Polygon Profiling_tools diff --git a/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies b/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies index 4e6bf12bc2d..625a107675c 100644 --- a/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies +++ b/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies @@ -1,5 +1,4 @@ Algebraic_foundations -Cartesian_kernel Circulator Distance_2 Filtered_kernel diff --git a/Partition_2/package_info/Partition_2/dependencies b/Partition_2/package_info/Partition_2/dependencies index b5203b6c7ea..6ff0abd837d 100644 --- a/Partition_2/package_info/Partition_2/dependencies +++ b/Partition_2/package_info/Partition_2/dependencies @@ -1,5 +1,4 @@ Algebraic_foundations -Cartesian_kernel Circulator Convex_hull_2 Distance_2 diff --git a/Point_set_2/package_info/Point_set_2/dependencies b/Point_set_2/package_info/Point_set_2/dependencies index 7ac0828196c..8978ceba4bf 100644 --- a/Point_set_2/package_info/Point_set_2/dependencies +++ b/Point_set_2/package_info/Point_set_2/dependencies @@ -1,5 +1,4 @@ Algebraic_foundations -Cartesian_kernel Circulator Distance_2 Filtered_kernel diff --git a/Point_set_3/package_info/Point_set_3/dependencies b/Point_set_3/package_info/Point_set_3/dependencies index 5f04823a1da..372b476bbed 100644 --- a/Point_set_3/package_info/Point_set_3/dependencies +++ b/Point_set_3/package_info/Point_set_3/dependencies @@ -1,6 +1,5 @@ Algebraic_foundations BGL -Cartesian_kernel Installation Interval_support Kernel_23 diff --git a/Point_set_shape_detection_3/package_info/Point_set_shape_detection_3/dependencies b/Point_set_shape_detection_3/package_info/Point_set_shape_detection_3/dependencies index a29db70c07b..9195ca64a0b 100644 --- a/Point_set_shape_detection_3/package_info/Point_set_shape_detection_3/dependencies +++ b/Point_set_shape_detection_3/package_info/Point_set_shape_detection_3/dependencies @@ -1,5 +1,4 @@ Algebraic_foundations -Cartesian_kernel Circulator Distance_2 Distance_3 diff --git a/Polyhedron/package_info/Polyhedron/dependencies b/Polyhedron/package_info/Polyhedron/dependencies index c05439fa229..47699a9637a 100644 --- a/Polyhedron/package_info/Polyhedron/dependencies +++ b/Polyhedron/package_info/Polyhedron/dependencies @@ -1,6 +1,5 @@ Algebraic_foundations BGL -Cartesian_kernel Circulator Distance_2 HalfedgeDS diff --git a/Polyhedron_IO/package_info/Polyhedron_IO/dependencies b/Polyhedron_IO/package_info/Polyhedron_IO/dependencies index be5d5ad8a68..b8678f37e1c 100644 --- a/Polyhedron_IO/package_info/Polyhedron_IO/dependencies +++ b/Polyhedron_IO/package_info/Polyhedron_IO/dependencies @@ -1,8 +1,8 @@ Algebraic_foundations BGL -Cartesian_kernel Circulator Distance_2 +Geomview HalfedgeDS Hash_map Installation diff --git a/Ridges_3/package_info/Ridges_3/dependencies b/Ridges_3/package_info/Ridges_3/dependencies index 2dd776864cc..f4b40909932 100644 --- a/Ridges_3/package_info/Ridges_3/dependencies +++ b/Ridges_3/package_info/Ridges_3/dependencies @@ -1,6 +1,5 @@ Algebraic_foundations BGL -Cartesian_kernel Circulator Installation Interval_support diff --git a/Spatial_searching/package_info/Spatial_searching/dependencies b/Spatial_searching/package_info/Spatial_searching/dependencies index a42d0d5839a..7f1f1b8ce69 100644 --- a/Spatial_searching/package_info/Spatial_searching/dependencies +++ b/Spatial_searching/package_info/Spatial_searching/dependencies @@ -1,5 +1,4 @@ Algebraic_foundations -Cartesian_kernel Circulator Installation Interval_support diff --git a/Spatial_sorting/package_info/Spatial_sorting/dependencies b/Spatial_sorting/package_info/Spatial_sorting/dependencies index 887a32e04dc..ca434381fc1 100644 --- a/Spatial_sorting/package_info/Spatial_sorting/dependencies +++ b/Spatial_sorting/package_info/Spatial_sorting/dependencies @@ -1,9 +1,6 @@ Algebraic_foundations -Cartesian_kernel Installation -Interval_support Kernel_23 -Modular_arithmetic Number_types Polygon Profiling_tools diff --git a/Stream_lines_2/package_info/Stream_lines_2/dependencies b/Stream_lines_2/package_info/Stream_lines_2/dependencies index 191ae06a73a..8634ae398fb 100644 --- a/Stream_lines_2/package_info/Stream_lines_2/dependencies +++ b/Stream_lines_2/package_info/Stream_lines_2/dependencies @@ -1,5 +1,4 @@ Algebraic_foundations -Cartesian_kernel Circulator Distance_2 Filtered_kernel diff --git a/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies b/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies index ad5b0735677..3ea7153c7fe 100644 --- a/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies +++ b/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies @@ -1,7 +1,6 @@ Algebraic_foundations BGL Box_intersection_d -Cartesian_kernel Circulator Distance_2 Filtered_kernel diff --git a/Triangulation_2/package_info/Triangulation_2/dependencies b/Triangulation_2/package_info/Triangulation_2/dependencies index 28c356c1be4..b28aeef4d20 100644 --- a/Triangulation_2/package_info/Triangulation_2/dependencies +++ b/Triangulation_2/package_info/Triangulation_2/dependencies @@ -6,6 +6,7 @@ Circulator Distance_2 Distance_3 Filtered_kernel +Geomview Hash_map Homogeneous_kernel Installation diff --git a/Visibility_2/package_info/Visibility_2/dependencies b/Visibility_2/package_info/Visibility_2/dependencies index 0b339c6dc9a..c4a79a1d03c 100644 --- a/Visibility_2/package_info/Visibility_2/dependencies +++ b/Visibility_2/package_info/Visibility_2/dependencies @@ -1,6 +1,5 @@ Algebraic_foundations Arrangement_on_surface_2 -Cartesian_kernel Circulator Distance_2 Filtered_kernel From 8bc315c97459ccacacf5c40421e25f92ab490ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 3 May 2018 15:05:47 +0200 Subject: [PATCH 6/8] make it work with any Kernel object --- .../include/CGAL/Cartesian_converter_fwd.h | 2 +- Installation/include/CGAL/Kernel_traits_fwd.h | 33 +++++++++++++++ Kernel_23/include/CGAL/Kernel_traits.h | 1 + Property_map/include/CGAL/property_map.h | 40 +++++++++++-------- .../kernel_converter_properties_test.cpp | 2 +- 5 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 Installation/include/CGAL/Kernel_traits_fwd.h diff --git a/Installation/include/CGAL/Cartesian_converter_fwd.h b/Installation/include/CGAL/Cartesian_converter_fwd.h index d0e36618c20..2e265bc205c 100644 --- a/Installation/include/CGAL/Cartesian_converter_fwd.h +++ b/Installation/include/CGAL/Cartesian_converter_fwd.h @@ -20,7 +20,7 @@ #define CGAL_CARTESIAN_CONVERTER_FWD_H /// \file Cartesian_converter_fwd.h -/// Forward declarations of the Cartesian_converter class. +/// Forward declarations of the `Cartesian_converter` class. #ifndef DOXYGEN_RUNNING namespace CGAL { diff --git a/Installation/include/CGAL/Kernel_traits_fwd.h b/Installation/include/CGAL/Kernel_traits_fwd.h new file mode 100644 index 00000000000..0f7359e7b72 --- /dev/null +++ b/Installation/include/CGAL/Kernel_traits_fwd.h @@ -0,0 +1,33 @@ +// Copyright (C) 2018 GeometryFactory Sarl +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// + +#ifndef CGAL_KERNEL_TRAITS_FWD_H +#define CGAL_KERNEL_TRAITS_FWD_H + +/// \file Kernel_traits_fwd.h +/// Forward declarations of the `Kernel_traits` class. + +#ifndef DOXYGEN_RUNNING +namespace CGAL { + +template struct Kernel_traits; + +} // CGAL +#endif + +#endif // CGAL_KERNEL_TRAITS_FWD_H diff --git a/Kernel_23/include/CGAL/Kernel_traits.h b/Kernel_23/include/CGAL/Kernel_traits.h index e52020fcb47..dc5d38257c0 100644 --- a/Kernel_23/include/CGAL/Kernel_traits.h +++ b/Kernel_23/include/CGAL/Kernel_traits.h @@ -26,6 +26,7 @@ #ifndef CGAL_KERNEL_TRAITS_H #define CGAL_KERNEL_TRAITS_H +#include #include #include diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 4935629ddf0..acd4ad57337 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -37,6 +37,7 @@ #include // defines std::pair #include +#include namespace CGAL { @@ -459,7 +460,7 @@ struct Default_property_map{ }; /// \ingroup PkgProperty_map -/// Read-write Property map turning a set (such a `std::set`, +/// Read-write property map turning a set (such a `std::set`, /// `boost::unordered_set`, `std::unordered_set`) into a property map /// associating a Boolean to the value type of the set. The function `get` will /// return `true` if the key is inside the set and `false` otherwise. The `put` @@ -506,40 +507,47 @@ make_boolean_property_map(Set& set_) } /// \ingroup PkgProperty_map -/// Read-write Property map turning a `CGAL::Point_3` into a -/// `CGAL::Point_3`, using a `Cartesian_converter`. -/// It means that `K1` and `K2` must be Cartesian Kernels. +/// Read-write property map doing on-the-fly conversions between two default constructible \cgal %Cartesian kernels. +/// Its value type is `GeomObject` and its key type is the same as `Vpm`. +/// `GeomObject` must be a geometric object from a \cgal kernel. +/// `Vpm` is a model `of ReadWritePropertyMap` and its value type must be +/// a geometric object of the same type as `GeomObject` but possibly from +/// another kernel. +/// Conversions between the two geometric objects are done using `Cartesian_converter`. /// \cgalModels `ReadWritePropertyMap` -template::category> +template struct Cartesian_converter_property_map { typedef typename boost::property_traits::key_type key_type; - typedef typename K2::Point_3 value_type; - typedef typename K2::Point_3 reference; - typedef t_category category; + typedef GeomObject value_type; + typedef value_type reference; + typedef boost::read_write_property_map_tag category; Vpm vpm; + + typedef typename Kernel_traits::type K2; + typedef typename Kernel_traits::value_type>::type K1; + Cartesian_converter_property_map(Vpm vpm):vpm(vpm){} - friend value_type get(const Cartesian_converter_property_map& pm, const key_type& k) + friend value_type get(const Cartesian_converter_property_map& pm, const key_type& k) { - value_type res = + return CGAL::Cartesian_converter()(get(pm.vpm, k)); - return res; } - friend void put(Cartesian_converter_property_map& pm, const key_type& k, const value_type& v) + friend void put(Cartesian_converter_property_map& pm, const key_type& k, const value_type& v) { put(pm.vpm, k, CGAL::Cartesian_converter()(v)); } }; /// \ingroup PkgProperty_map -/// returns `Cartesian_converter_property_map(&vpm)` -template::category> -Cartesian_converter_property_map +/// returns `Cartesian_converter_property_map(&vpm)` +template +Cartesian_converter_property_map make_cartesian_converter_property_map(Vpm vpm) { - return Cartesian_converter_property_map(vpm); + return Cartesian_converter_property_map(vpm); } } // namespace CGAL diff --git a/Property_map/test/Property_map/kernel_converter_properties_test.cpp b/Property_map/test/Property_map/kernel_converter_properties_test.cpp index 77905467df4..586cdd49383 100644 --- a/Property_map/test/Property_map/kernel_converter_properties_test.cpp +++ b/Property_map/test/Property_map/kernel_converter_properties_test.cpp @@ -20,7 +20,7 @@ test() typedef typename boost::property_map::type VPMap; VPMap vmap = get(CGAL::vertex_point, m); - CGAL::Cartesian_converter_property_map kcmap =CGAL::make_cartesian_converter_property_map(vmap); + CGAL::Cartesian_converter_property_map kcmap =CGAL::make_cartesian_converter_property_map(vmap); CGAL_assertion(get(kcmap, *vertices(m).begin()) == CGAL::Point_3(2,0,0)); put(kcmap, *vertices(m).begin(), CGAL::Point_3(0,2,3)); CGAL_assertion(get(kcmap, *vertices(m).begin()) == CGAL::Point_3(0,2,3)); From 1e9669cec3208d2db8aa2f2da4571b4b3fa9f59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 4 May 2018 10:49:48 +0200 Subject: [PATCH 7/8] fix doc --- Property_map/include/CGAL/property_map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index acd4ad57337..fba1c0d6573 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -542,7 +542,7 @@ struct Cartesian_converter_property_map }; /// \ingroup PkgProperty_map -/// returns `Cartesian_converter_property_map(&vpm)` +/// returns `Cartesian_converter_property_map(vpm)` template Cartesian_converter_property_map make_cartesian_converter_property_map(Vpm vpm) From 4bcb37d241b68e654c0092519477908338786e91 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 4 May 2018 14:59:49 +0200 Subject: [PATCH 8/8] Update CHANGES.md --- Installation/CHANGES.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 158b28aaf7f..d78140eb019 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -1,6 +1,13 @@ Release History =============== +Release 4.13 +------------ +### CGAL and Boost Property Maps + +- Addition of a read-write property map to convert on-the-fly geometric + object from Cartesian kernels + Release 4.12 ------------