|
BWAPI
|
00001 // Copyright (c) 2005 Tel-Aviv University (Israel). 00002 // All rights reserved. 00003 // 00004 // This file is part of CGAL (www.cgal.org); you may redistribute it under 00005 // the terms of the Q Public License version 1.0. 00006 // See the file LICENSE.QPL distributed with CGAL. 00007 // 00008 // Licensees holding a valid commercial license may use this file in 00009 // accordance with the commercial license agreement provided with the software. 00010 // 00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 // 00014 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_with_history_accessor.h $ 00015 // $Id: Arr_with_history_accessor.h 35665 2007-01-05 07:55:34Z wein $ 00016 // 00017 // 00018 // Author(s) : Ron Wein <wein@post.tau.ac.il> 00019 00020 #ifndef CGAL_ARR_WITH_HISTORY_ACCESSOR_H 00021 #define CGAL_ARR_WITH_HISTORY_ACCESSOR_H 00022 00027 CGAL_BEGIN_NAMESPACE 00028 00035 template <class ArrWithHistory_> 00036 class Arr_with_history_accessor 00037 { 00038 public: 00039 00040 typedef ArrWithHistory_ Arrangement_with_history_2; 00041 typedef Arr_with_history_accessor<Arrangement_with_history_2> Self; 00042 00043 typedef typename Arrangement_with_history_2::Geometry_traits_2 00044 Geometry_traits_2; 00045 typedef typename Arrangement_with_history_2::Topology_traits 00046 Topology_traits; 00047 typedef typename Arrangement_with_history_2::Size Size; 00048 typedef typename Arrangement_with_history_2::Point_2 Point_2; 00049 typedef typename Arrangement_with_history_2::Curve_2 Curve_2; 00050 typedef typename Arrangement_with_history_2::Curve_handle Curve_handle; 00051 typedef typename Arrangement_with_history_2::Halfedge_handle 00052 Halfedge_handle; 00053 00054 private: 00055 00056 Arrangement_with_history_2 *p_arr; // The associated arrangement. 00057 00058 public: 00059 00061 Arr_with_history_accessor (Arrangement_with_history_2& arr) : 00062 p_arr (&arr) 00063 {} 00064 00066 00067 00074 template <class PointLocation> 00075 Curve_handle insert_curve (const Curve_2& cv, 00076 const PointLocation& pl) 00077 { 00078 return (p_arr->_insert_curve (cv, pl)); 00079 } 00080 00087 Curve_handle insert_curve (const Curve_2& cv) 00088 { 00089 return (p_arr->_insert_curve (cv)); 00090 } 00091 00097 template <class InputIterator> 00098 void insert_curves (InputIterator begin, InputIterator end) 00099 { 00100 p_arr->_insert_curves (begin, end); 00101 return; 00102 } 00103 00109 Size remove_curve (Curve_handle ch) 00110 { 00111 return (p_arr->_remove_curve (ch)); 00112 } 00114 00116 00117 00123 Curve_handle new_curve (const Curve_2& cv) 00124 { 00125 // Allocate an extended curve (with an initially empty set of edges) 00126 // and store it in the curves' list. 00127 typename Arrangement_with_history_2::Curve_halfedges *p_cv = 00128 p_arr->m_curves_alloc.allocate (1); 00129 00130 p_arr->m_curves_alloc.construct (p_cv, cv); 00131 p_arr->m_curves.push_back (*p_cv); 00132 00133 // Return a handle to the inserted curve (the last in the list). 00134 Curve_handle ch = p_arr->m_curves.end(); 00135 return (--ch); 00136 } 00137 00143 void connect_curve_edge (Curve_handle ch, Halfedge_handle he) 00144 { 00145 // Add the edge to the list of cv's induced edges. 00146 typename Arrangement_with_history_2::Curve_halfedges& cv = *ch; 00147 cv._insert (he); 00148 00149 // Add the curve to the set of he's inducing curves. 00150 he->curve().data().insert (&cv); 00151 00152 return; 00153 } 00154 }; 00155 00156 CGAL_END_NAMESPACE 00157 00158 #endif
1.7.6.1