1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
|
// Copyright (c) 2007 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/graph_traits_Seam_mesh.h $
// $Id: graph_traits_Seam_mesh.h 52164b1 2019-10-19T15:34:59+02:00 Sébastien Loriot
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Andreas Fabri
#ifndef CGAL_BOOST_GRAPH_TRAITS_SEAM_MESH_H
#define CGAL_BOOST_GRAPH_TRAITS_SEAM_MESH_H
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>
#include <CGAL/boost/iterator/transform_iterator.hpp>
#include <CGAL/boost/graph/properties_Seam_mesh.h>
#include <CGAL/boost/graph/iterator.h>
#include <CGAL/boost/graph/Seam_mesh.h>
#include <CGAL/assertions.h>
#include <iterator>
namespace CGAL {
template <class TM, class SEM, class SVM>
class Seam_mesh;
template <class HD>
class Seam_mesh_halfedge_descriptor;
} // namespace CGAL
// We specialize std::iterator_traits, as VC++ tries to instantiate std::next(T, std::iterator_traits<T>)
namespace std {
template <class HD>
struct iterator_traits<CGAL::Seam_mesh_halfedge_descriptor<HD> >
{
struct difference_type { };
struct value_type { };
struct pointer { };
struct reference { };
struct iterator_category { };
};
} // namespace std
namespace boost {
template <class TM, class SEM, class SVM>
struct graph_traits< CGAL::Seam_mesh<TM, SEM, SVM> >
{
private:
typedef CGAL::Seam_mesh<TM, SEM, SVM> SM;
struct SM_graph_traversal_category :
public virtual boost::bidirectional_graph_tag,
public virtual boost::vertex_list_graph_tag,
public virtual boost::edge_list_graph_tag
{ };
public:
// Graph
typedef typename SM::vertex_descriptor vertex_descriptor;
typedef typename SM::edge_descriptor edge_descriptor;
/*
typedef typename SM::Point vertex_property_type;
*/
typedef boost::undirected_tag directed_category;
typedef boost::disallow_parallel_edge_tag edge_parallel_category;
typedef SM_graph_traversal_category traversal_category;
// IncidenceGraph
typedef typename SM::degree_size_type degree_size_type;
// HalfedgeGraph
typedef typename SM::halfedge_descriptor halfedge_descriptor;
// FaceGraph
typedef typename SM::face_descriptor face_descriptor;
// VertexListGraph
typedef typename SM::vertex_iterator vertex_iterator;
typedef typename SM::vertices_size_type vertices_size_type;
// EdgeListGraph
typedef typename SM::edge_iterator edge_iterator;
typedef typename SM::edges_size_type edges_size_type;
// HalfEdgeListGraph
typedef typename SM::halfedge_iterator halfedge_iterator;
typedef typename SM::halfedges_size_type halfedges_size_type;
// FaceListGraph
typedef typename SM::face_iterator face_iterator;
typedef typename SM::faces_size_type faces_size_type;
typedef CGAL::In_edge_iterator<SM> in_edge_iterator;
typedef CGAL::Out_edge_iterator<SM> out_edge_iterator;
// nulls
static vertex_descriptor null_vertex() { return vertex_descriptor(); }
static face_descriptor null_face() { return face_descriptor(); }
static halfedge_descriptor null_halfedge() { return halfedge_descriptor(); }
};
template<typename TM, typename SEM, typename SVM>
struct graph_traits<const CGAL::Seam_mesh<TM, SEM, SVM> >
: public graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >
{ };
} // namespace boost
namespace CGAL {
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertices_size_type
num_vertices(const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.num_vertices();
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::edges_size_type
num_edges(const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.num_edges();
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::degree_size_type
degree(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor v,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.degree(v);
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::degree_size_type
out_degree(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor v,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.degree(v);
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::degree_size_type
in_degree(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor v,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.degree(v);
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor
source(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::edge_descriptor e,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.source(e);
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor
source(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descriptor h,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.source(h);
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor
target(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::edge_descriptor e,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.target(e);
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor
target(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descriptor h,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.target(h);
}
template <class TM, class SEM, class SVM>
Iterator_range<typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_iterator>
vertices(const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.vertices();
}
template <class TM, class SEM, class SVM>
Iterator_range<typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::edge_iterator>
edges(const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.edges();
}
#if 1
template <class TM, class SEM, class SVM>
Iterator_range<typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::in_edge_iterator>
in_edges(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor v,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
typedef typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::in_edge_iterator Iter;
return make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
}
template <class TM, class SEM, class SVM>
Iterator_range<typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::out_edge_iterator>
out_edges(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor v,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
typedef typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::out_edge_iterator Iter;
return make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
}
#endif
template<class TM, class SEM, class SVM>
std::pair<typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::edge_descriptor,
bool>
edge(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor u,
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor v,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm) {
return sm.edge(u, v);
}
//
// HalfedgeGraph
//
template <class TM, class SEM, class SVM, class HD>
CGAL::Seam_mesh_halfedge_descriptor<HD>
next(const CGAL::Seam_mesh_halfedge_descriptor<HD>& h,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.next(h);
}
template <class TM, class SEM, class SVM, class HD>
CGAL::Seam_mesh_halfedge_descriptor<HD>
prev(const CGAL::Seam_mesh_halfedge_descriptor<HD>& h,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.prev(h);
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descriptor
opposite(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descriptor h,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.opposite(h);
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::edge_descriptor
edge(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descriptor h,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.edge(h);
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descriptor
halfedge(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::edge_descriptor e,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.halfedge(e);
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descriptor
halfedge(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor v,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.halfedge(v);
}
template <class TM, class SEM, class SVM>
std::pair<
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descriptor,
bool>
halfedge(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor u,
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor v,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.halfedge(u, v);
}
//
// HalfedgeListGraph
//
template <class TM, class SEM, class SVM>
Iterator_range<typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_iterator>
halfedges(const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.halfedges();
}
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedges_size_type
num_halfedges(const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.num_halfedges();
}
//
// FaceGraph
//
template<class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descriptor
halfedge(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::face_descriptor f,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.halfedge(f);
}
template<class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::face_descriptor
face(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descriptor h,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.face(h);
}
//
// FaceListGraph
//
template <class TM, class SEM, class SVM>
typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::faces_size_type
num_faces(const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.num_faces();
}
template <class TM, class SEM, class SVM>
Iterator_range<typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::face_iterator>
faces(const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.faces();
}
} // namespace CGAL
#endif // CGAL_BOOST_GRAPH_TRAITS_SEAM_MESH_H
|