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/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h $ 00015 // $Id: Arr_unb_planar_batched_pl_helper.h 49772 2009-06-03 21:25:53Z eric $ 00016 // 00017 // 00018 // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> 00019 // Ron Wein <wein@post.tau.ac.il> 00020 // Efi Fogel <efif@post.tau.ac.il> 00021 00022 #ifndef CGAL_ARR_UNB_PLANAR_BATCHED_PL_HELPER_H 00023 #define CGAL_ARR_UNB_PLANAR_BATCHED_PL_HELPER_H 00024 00029 CGAL_BEGIN_NAMESPACE 00030 00031 #include <CGAL/Sweep_line_empty_visitor.h> 00032 00038 template <class Traits_, class Arrangement_> 00039 class Arr_unb_planar_batched_pl_helper 00040 { 00041 public: 00042 00043 typedef Traits_ Traits_2; 00044 typedef Arrangement_ Arrangement_2; 00045 00046 typedef typename Arrangement_2::Face_const_handle Face_const_handle; 00047 00048 typedef Sweep_line_empty_visitor<Traits_2> Base_visitor; 00049 typedef typename Base_visitor::Event Event; 00050 typedef typename Base_visitor::Subcurve Subcurve; 00051 00052 protected: 00053 00054 typedef typename Arrangement_2::Topology_traits Topology_traits; 00055 typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; 00056 typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; 00057 00058 // Data members: 00059 const Topology_traits *m_top_traits; // The topology-traits class. 00060 Halfedge_const_handle m_top_fict; // The current top fictitious halfedge. 00061 00062 public: 00063 00068 Arr_unb_planar_batched_pl_helper (const Arrangement_2 *arr) : 00069 m_top_traits (arr->topology_traits()) 00070 {} 00071 00073 00074 00075 /* A notification issued before the sweep process starts. */ 00076 void before_sweep (); 00077 00082 void after_handle_event (Event* event); 00084 00086 Face_const_handle top_face () const 00087 { 00088 return (m_top_fict->face()); 00089 } 00090 }; 00091 00092 //----------------------------------------------------------------------------- 00093 // Memeber-function definitions: 00094 //----------------------------------------------------------------------------- 00095 00096 //----------------------------------------------------------------------------- 00097 // A notification issued before the sweep process starts. 00098 // 00099 template <class Tr, class Arr> 00100 void Arr_unb_planar_batched_pl_helper<Tr, Arr>::before_sweep () 00101 { 00102 // Initialize the fictitious halfedge lying on the top edge of the 00103 // fictitious face. We start from the leftmost halfedge, which is 00104 // incident to the top-left vertex and directed from right to left. 00105 Vertex_const_handle v_tl = 00106 Vertex_const_handle (m_top_traits->top_left_vertex()); 00107 00108 m_top_fict = v_tl->incident_halfedges(); 00109 if (m_top_fict->direction() == ARR_LEFT_TO_RIGHT) 00110 m_top_fict = m_top_fict->next()->twin(); 00111 00112 CGAL_assertion_code ( 00113 Vertex_const_handle v_tr = 00114 Vertex_const_handle (m_top_traits->top_right_vertex()); 00115 ); 00116 CGAL_assertion 00117 ((m_top_fict->source() == v_tr) || 00118 (m_top_fict->source()->parameter_space_in_x() == ARR_INTERIOR && 00119 m_top_fict->source()->parameter_space_in_y() == ARR_TOP_BOUNDARY)); 00120 00121 return; 00122 } 00123 00124 //----------------------------------------------------------------------------- 00125 // A notification invoked after the sweep-line finishes handling the given 00126 // event. 00127 // 00128 template <class Tr, class Arr> 00129 void Arr_unb_planar_batched_pl_helper<Tr, Arr>:: 00130 after_handle_event (Event* event) 00131 { 00132 // If the event is at infinity and occurs on the top edge of the fictitious 00133 // face (namely x is finite and y = +oo), we have to update the fictitious 00134 // edge we keep. 00135 if (event->is_closed()) 00136 return; 00137 00138 if (event->parameter_space_in_x() != ARR_INTERIOR) 00139 return; 00140 00141 if (event->parameter_space_in_y() == ARR_TOP_BOUNDARY) 00142 m_top_fict = m_top_fict->twin()->next()->twin(); 00143 00144 return; 00145 } 00146 00147 CGAL_END_NAMESPACE 00148 00149 #endif