// Copyright (c) 2014 GeometryFactory (France). All rights reserved. // // 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$ // // // Author(s) : Philipp Möller #ifndef CGAL_PROPERTIES_TRIMESH_ARRAYKERNELT_H #define CGAL_PROPERTIES_TRIMESH_ARRAYKERNELT_H #include #include #include #include #include #include // overloads and specializations in the boost namespace namespace boost { // // edge_weight // template struct property_map, boost::edge_weight_t > { typedef OpenMesh::TriMesh_ArrayKernelT Mesh; typedef CGAL::OM_edge_weight_pmap type; typedef CGAL::OM_edge_weight_pmap const_type; }; // // vertex_index // template struct property_map, boost::vertex_index_t > { typedef CGAL::OM_index_pmap >::vertex_descriptor> type; typedef CGAL::OM_index_pmap >::vertex_descriptor> const_type; }; // // face_index // template struct property_map, boost::face_index_t > { typedef CGAL::OM_index_pmap >::face_descriptor> type; typedef CGAL::OM_index_pmap >::face_descriptor> const_type; }; // // edge_index // template struct property_map, boost::edge_index_t > { typedef CGAL::OM_index_pmap >::edge_descriptor> type; typedef CGAL::OM_index_pmap >::edge_descriptor> const_type; }; // // halfedge_index // template struct property_map, boost::halfedge_index_t > { typedef CGAL::OM_index_pmap >::halfedge_descriptor> type; typedef CGAL::OM_index_pmap >::halfedge_descriptor> const_type; }; template struct property_map, boost::vertex_point_t > { typedef CGAL::Exact_predicates_inexact_constructions_kernel::Point_3 P; typedef OpenMesh::TriMesh_ArrayKernelT Mesh; typedef CGAL::OM_point_pmap type; typedef type const_type; }; } // namespace boost namespace OpenMesh { template typename boost::property_map, boost::edge_weight_t>::const_type get(boost::edge_weight_t, const OpenMesh::TriMesh_ArrayKernelT& sm) { return CGAL::OM_edge_weight_pmap(sm); } template typename OpenMesh::TriMesh_ArrayKernelT::Scalar get(boost::edge_weight_t, const OpenMesh::TriMesh_ArrayKernelT& sm, const typename boost::graph_traits >::edge_descriptor& e) { return CGAL::OM_edge_weight_pmap(sm)[e]; } template CGAL::OM_index_pmap >::vertex_descriptor> get(const boost::vertex_index_t&, const OpenMesh::TriMesh_ArrayKernelT&) { return CGAL::OM_index_pmap >::vertex_descriptor>(); } template typename boost::property_map, boost::face_index_t>::const_type get(const boost::face_index_t&, const OpenMesh::TriMesh_ArrayKernelT&) { return CGAL::OM_index_pmap >::face_descriptor>(); } template CGAL::OM_index_pmap >::edge_descriptor> get(const boost::edge_index_t&, const OpenMesh::TriMesh_ArrayKernelT&) { return CGAL::OM_index_pmap >::edge_descriptor>(); } template CGAL::OM_index_pmap >::halfedge_descriptor> get(const boost::halfedge_index_t&, const OpenMesh::TriMesh_ArrayKernelT&) { return CGAL::OM_index_pmap >::halfedge_descriptor>(); } template CGAL::OM_point_pmap, typename CGAL::Exact_predicates_inexact_constructions_kernel::Point_3> get(boost::vertex_point_t, const OpenMesh::TriMesh_ArrayKernelT& g) { typedef typename CGAL::Exact_predicates_inexact_constructions_kernel::Point_3 P; typedef OpenMesh::TriMesh_ArrayKernelT Mesh; return CGAL::OM_point_pmap(g); } // get for intrinsic properties #define CGAL_OM_INTRINSIC_PROPERTY(RET, PROP, TYPE) \ template \ RET \ get(PROP p, const OpenMesh::TriMesh_ArrayKernelT& sm, \ typename boost::graph_traits< OpenMesh::TriMesh_ArrayKernelT >::TYPE x) \ { return get(get(p, sm), x); } \ CGAL_OM_INTRINSIC_PROPERTY(int, boost::vertex_index_t, vertex_descriptor) CGAL_OM_INTRINSIC_PROPERTY(int, boost::edge_index_t, edge_descriptor) CGAL_OM_INTRINSIC_PROPERTY(int, boost::halfedge_index_t, halfedge_descriptor) CGAL_OM_INTRINSIC_PROPERTY(int, boost::face_index_t, face_descriptor) // CGAL_OM_INTRINSIC_PROPERTY(std::size_t, boost::halfedge_index_t, face_descriptor) CGAL_OM_INTRINSIC_PROPERTY(typename CGAL::Exact_predicates_inexact_constructions_kernel::Point_3, boost::vertex_point_t, vertex_descriptor) #undef CGAL_OM_INTRINSIC_PROPERTY // put for intrinsic properties // only available for vertex_point template void put(boost::vertex_point_t p, OpenMesh::TriMesh_ArrayKernelT& g, typename boost::graph_traits< OpenMesh::TriMesh_ArrayKernelT >::vertex_descriptor vd, const typename K::Point& point) { put(get(p,g), vd, point); } } // namespace OpenMesh #endif /* CGAL_PROPERTIES_TRIMESH_ARRAYKERNELT_H */