// Copyright (c) 2015 GeometryFactory (France). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL: https://github.com/CGAL/cgal/blob/v5.2/BGL/include/CGAL/boost/graph/properties_Seam_mesh.h $ // $Id: properties_Seam_mesh.h c999ce1 2020-02-19T10:07:53+01:00 Maxime Gimeno // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // // Author(s) : Andreas Fabri #ifndef CGAL_PROPERTIES_SEAM_MESH_H #define CGAL_PROPERTIES_SEAM_MESH_H #include #include namespace CGAL { template class Seam_mesh; template class Seam_mesh_point_map { typedef typename boost::property_map::const_type Graph_pmap; public: typedef boost::readable_property_map_tag category; typedef typename boost::property_traits::value_type value_type; typedef typename boost::property_traits::reference reference; typedef typename boost::graph_traits >::vertex_descriptor key_type; public: Seam_mesh_point_map(const Seam_mesh& mesh, Graph_pmap map) : mesh(mesh), map(map) { } friend reference get(const Seam_mesh_point_map& pmap, key_type vd) { typename boost::graph_traits::halfedge_descriptor hd = vd; return get(pmap.map, target(hd, pmap.mesh.mesh())); } private: const Seam_mesh& mesh; Graph_pmap map; }; template class Seam_mesh_uv_map { typedef Seam_mesh_uv_map Self; public: typedef boost::read_write_property_map_tag category; typedef typename boost::property_traits::value_type value_type; typedef typename boost::property_traits::reference reference; typedef typename boost::graph_traits >::vertex_descriptor key_type; // assert that key_type equals boost::property_traits::key_type typedef Seam_mesh Mesh; public: Seam_mesh_uv_map(const Seam_mesh& mesh, Map map) : mesh(mesh), map(map) { } Seam_mesh_uv_map(const Self& other) : mesh(other.mesh), map(other.map) { } //reference operator[](const key_type& vd) const //{ // typename boost::graph_traits::halfedge_descriptor hd = vd; // return map[target(hd, mesh.mesh())]; //} inline friend reference get(const Self& pm, key_type vd) { typename boost::graph_traits::halfedge_descriptor hd = vd; return get(pm.map, target(hd, pm.mesh.mesh())); } inline friend void put(const Self& pm, key_type vd, const value_type& uv) { typename boost::graph_traits::halfedge_descriptor hd = vd; put(pm.map, target(hd, pm.mesh.mesh()), uv); } private: const Seam_mesh& mesh; Map map; }; } // namespace CGAL // overloads and specializations in the boost namespace namespace boost { template struct property_map, T> : public cgal_no_property { }; template struct property_map, CGAL::vertex_point_t> { typedef CGAL::Seam_mesh SM; typedef CGAL::Seam_mesh_point_map type; typedef type const_type; }; template struct property_map, CGAL::dynamic_vertex_property_t > { typedef typename boost::graph_traits >::vertex_descriptor vertex_descriptor; typedef CGAL::internal::Dynamic_property_map type; typedef type const_type; }; template struct property_map, CGAL::dynamic_halfedge_property_t > { typedef typename boost::graph_traits >::halfedge_descriptor halfedge_descriptor; typedef CGAL::internal::Dynamic_property_map type; typedef type const_type; }; template struct property_map, CGAL::dynamic_edge_property_t > { typedef typename boost::graph_traits >::edge_descriptor edge_descriptor; typedef CGAL::internal::Dynamic_property_map type; typedef type const_type; }; template struct property_map, CGAL::dynamic_face_property_t > { typedef typename boost::graph_traits >::face_descriptor face_descriptor; typedef CGAL::internal::Dynamic_property_map type; typedef type const_type; }; } // namespace boost namespace CGAL { template typename boost:: property_map, vertex_point_t>::const_type get(vertex_point_t, const Seam_mesh& sm) { return Seam_mesh_point_map(sm, get(vertex_point, sm.mesh())); } template struct graph_has_property, CGAL::vertex_point_t> : CGAL::Tag_true {}; } // namespace CGAL #endif // CGAL_PROPERTIES_SEAM_MESH_H