BWAPI
|
00001 // Copyright (c) 1997 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/Sweep_line_2/Arr_construction_subcurve.h $ 00015 // $Id: Arr_construction_subcurve.h 33430 2006-08-20 12:29:57Z wein $ 00016 // 00017 // 00018 // Author(s) : Tali Zvi <talizvi@post.tau.ac.il> 00019 // Baruch Zukerman <baruchzu@post.tau.ac.il> 00020 00021 #ifndef CGAL_ARR_CONSTRUCTION_SUBCURVE_H 00022 #define CGAL_ARR_CONSTRUCTION_SUBCURVE_H 00023 00028 #include <CGAL/Sweep_line_2/Sweep_line_subcurve.h> 00029 00030 CGAL_BEGIN_NAMESPACE 00031 00045 template<class Traits_> 00046 class Arr_construction_subcurve : public Sweep_line_subcurve<Traits_> 00047 { 00048 public: 00049 00050 typedef Traits_ Traits_2; 00051 typedef typename Traits_2::Point_2 Point_2; 00052 typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2; 00053 00054 typedef Sweep_line_subcurve<Traits_2> Base; 00055 typedef Arr_construction_subcurve<Traits_2> Self; 00056 00057 typedef typename Base::Status_line_iterator Status_line_iterator; 00058 typedef void* Event_ptr; 00059 typedef std::list<unsigned int> Halfedge_indices_list; 00060 00061 protected: 00062 00063 // Data members: 00064 Event_ptr m_lastEvent; // The last event that was handled on the curve. 00065 00070 unsigned int m_index; // Index for a subcurve that may represent a hole 00071 // (emarge from the leftmost vertex of a hole, 00072 // and it is the topmost curve). Other subcurves 00073 // have a 0 (invalid) index. 00074 00075 Halfedge_indices_list m_halfedge_indices; 00076 // Indices of all halfedge below the curve that 00077 // may represent a hole. 00078 00079 public: 00080 00082 Arr_construction_subcurve() : 00083 Base(), 00084 m_lastEvent(0), 00085 m_index(0) 00086 {} 00087 00089 Arr_construction_subcurve (X_monotone_curve_2& curve) : 00090 Base( curve), 00091 m_lastEvent(0), 00092 m_index(0) 00093 {} 00094 00096 void init (const X_monotone_curve_2& curve) 00097 { 00098 Base::init(curve); 00099 } 00100 00102 template<class SweepEvent> 00103 void set_left_event (SweepEvent* left) 00104 { 00105 Base::set_left_event(left); 00106 m_lastEvent = left; 00107 } 00108 00110 void set_last_event (Event_ptr e) 00111 { 00112 m_lastEvent = e; 00113 } 00114 00116 Event_ptr last_event() const 00117 { 00118 return m_lastEvent; 00119 } 00120 00122 unsigned int index() const 00123 { 00124 return (m_index); 00125 } 00126 00128 void set_index(unsigned int i) 00129 { 00130 m_index = i; 00131 } 00132 00134 bool has_valid_index() const 00135 { 00136 return (m_index != 0); 00137 } 00138 00140 void add_halfedge_index (unsigned int i) 00141 { 00142 m_halfedge_indices.push_back(i); 00143 } 00144 00146 void clear_halfedge_indices() 00147 { 00148 m_halfedge_indices.clear(); 00149 } 00150 00152 bool has_halfedge_indices() const 00153 { 00154 return (!m_halfedge_indices.empty()); 00155 } 00156 00158 Halfedge_indices_list& halfedge_indices_list() 00159 { 00160 return (m_halfedge_indices); 00161 } 00162 }; 00163 00164 00165 CGAL_END_NAMESPACE 00166 00167 #endif