1 // Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
2 //
3 // This file is part of CGAL (www.cgal.org)
4 //
5 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Polyhedron/include/CGAL/Polyhedron_items_with_id_3.h $
6 // $Id: Polyhedron_items_with_id_3.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot
7 // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
8 //
9 //
10 // Author(s)     : Andreas Fabri, Fernando Cacciola
11 
12 #ifndef CGAL_POLYHEDRON_ITEMS_WITH_ID_3_H
13 #define CGAL_POLYHEDRON_ITEMS_WITH_ID_3_H 1
14 
15 #include <CGAL/HalfedgeDS_vertex_max_base_with_id.h>
16 #include <CGAL/HalfedgeDS_halfedge_max_base_with_id.h>
17 #include <CGAL/HalfedgeDS_face_max_base_with_id.h>
18 
19 namespace CGAL {
20 
21 class Polyhedron_items_with_id_3 {
22 public:
23     template < class Refs, class Traits>
24     struct Vertex_wrapper {
25         typedef typename Traits::Point_3 Point;
26         typedef HalfedgeDS_vertex_max_base_with_id< Refs, Point, std::size_t> Vertex;
27     };
28     template < class Refs, class Traits>
29     struct Halfedge_wrapper {
30         typedef HalfedgeDS_halfedge_max_base_with_id<Refs, std::size_t> Halfedge;
31     };
32     template < class Refs, class Traits>
33     struct Face_wrapper {
34         typedef HalfedgeDS_face_max_base_with_id< Refs, Tag_false, std::size_t>  Face;
35     };
36 };
37 
38 template<class HalfedgeDS_with_id>
set_halfedgeds_items_id(HalfedgeDS_with_id & hds)39 void set_halfedgeds_items_id ( HalfedgeDS_with_id& hds )
40 {
41   std::size_t vertex_id   = 0 ;
42   std::size_t halfedge_id = 0 ;
43   std::size_t face_id     = 0 ;
44 
45   for ( typename HalfedgeDS_with_id::Vertex_iterator vit = hds.vertices_begin(), evit = hds.vertices_end()
46       ; vit != evit
47       ; ++  vit
48       )
49     vit->id() = vertex_id ++ ;
50 
51   for ( typename HalfedgeDS_with_id::Halfedge_iterator hit = hds.halfedges_begin(), ehit = hds.halfedges_end()
52       ; hit != ehit
53       ; ++  hit
54       )
55     hit->id() = halfedge_id ++ ;
56 
57   for ( typename HalfedgeDS_with_id::Face_iterator fit = hds.facets_begin(), efit = hds.facets_end()
58       ; fit != efit
59       ; ++  fit
60       )
61     fit->id() = face_id ++ ;
62 }
63 
64 } //namespace CGAL
65 
66 #endif // CGAL_POLYHEDRON_ITEMS_WITH_ID_3_H //
67 // EOF //
68