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/Sweep_line_2_debug.h $ 00015 // $Id: Sweep_line_2_debug.h 49772 2009-06-03 21:25:53Z eric $ 00016 // 00017 // 00018 // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> 00019 00020 #ifndef CGAL_SWEEP_LINE_2_DEBUG_H 00021 #define CGAL_SWEEP_LINE_2_DEBUG_H 00022 00023 00024 #include <CGAL/Basic_sweep_line_2.h> 00025 00026 00029 // DEBUG UTILITIES // 00032 00033 00034 template <class Tr, class Visit, class Crv, class Evnt, class Alloc> 00035 void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::PrintEventQueue() 00036 { 00037 CGAL_SL_DEBUG(std::cout << std::endl << "Event queue: " << std::endl;) 00038 Event_queue_iterator iter = m_queue->begin(); 00039 while ( iter != m_queue->end() ) 00040 { 00041 CGAL_SL_DEBUG(std::cout << "Point (" << iter->first << ")" << std::endl;) 00042 Event *e = iter->second; 00043 e->Print(); 00044 ++iter; 00045 } 00046 CGAL_SL_DEBUG(std::cout << "--------------------------------" << std::endl;) 00047 } 00048 00049 template <class Tr, class Visit, class Crv, class Evnt, class Alloc> 00050 void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::PrintSubCurves() 00051 { 00052 CGAL_SL_DEBUG(std::cout << std::endl << "Sub curves: " << std::endl;) 00053 for(unsigned int i=0 ; i < m_num_of_subCurves ; ++i) 00054 { 00055 m_subCurves[i].Print(); 00056 } 00057 } 00058 00059 template <class Tr, class Visit, class Crv, class Evnt, class Alloc> 00060 void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>::PrintStatusLine() 00061 { 00062 if ( m_statusLine.size() == 0) { 00063 std::cout << std::endl << "Status line: empty" << std::endl; 00064 return; 00065 } 00066 std::cout << std::endl << "Status line: (" ; 00067 if(m_currentEvent->is_closed()) 00068 std::cout << m_currentEvent->point() << ")" << std::endl; 00069 else 00070 { 00071 Arr_parameter_space x = m_currentEvent->parameter_space_in_x(), 00072 y = m_currentEvent->parameter_space_in_y(); 00073 00074 PrintOpenBoundaryType(x, y); 00075 } 00076 Status_line_iterator iter = m_statusLine.begin(); 00077 while ( iter != m_statusLine.end() ) 00078 { 00079 (*iter)->Print(); 00080 ++iter; 00081 } 00082 std::cout << "Status line - end" << std::endl; 00083 } 00084 00085 template <class Tr, class Visit, class Crv, class Evnt, class Alloc> 00086 void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>:: 00087 PrintOpenBoundaryType (Arr_parameter_space ps_x, Arr_parameter_space ps_y) 00088 { 00089 switch (ps_x) { 00090 case ARR_LEFT_BOUNDARY: std::cout << "left boundary"; return; 00091 case ARR_RIGHT_BOUNDARY: std::cout << "right boundary"; return; 00092 case ARR_INTERIOR: 00093 default: break; 00094 } 00095 00096 switch (ps_y) { 00097 case ARR_BOTTOM_BOUNDARY: std::cout << "bottom boundary"; return; 00098 case ARR_TOP_BOUNDARY: std::cout << "top boundary"; return; 00099 case ARR_INTERIOR: 00100 default: CGAL_error(); 00101 } 00102 } 00103 00104 template <class Tr, class Visit, class Crv, class Evnt, class Alloc> 00105 void Basic_sweep_line_2<Tr, Visit, Crv, Evnt, Alloc>:: 00106 PrintEvent(const Event* e) 00107 { 00108 if (e->is_closed()) 00109 std::cout << e->point(); 00110 else 00111 { 00112 Arr_parameter_space x = e->parameter_space_in_x(); 00113 Arr_parameter_space y = e->parameter_space_in_y(); 00114 PrintOpenBoundaryType(x, y); 00115 std::cout << " with open curve: " << e->curve(); 00116 } 00117 } 00118 00119 #endif