1 // Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). 2 // All rights reserved. 3 // 4 // This file is part of CGAL (www.cgal.org). 5 // 6 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Arrangement_on_surface_2/include/CGAL/Arr_enums.h $ 7 // $Id: Arr_enums.h 4e519a3 2021-05-05T13:15:37+02:00 Sébastien Loriot 8 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial 9 // 10 // 11 // Author(s): Ron Wein <wein@post.tau.ac.il> 12 // Efi Fogel <efif@post.tau.ac.il> 13 14 #ifndef CGAL_ARR_ENUM_H 15 #define CGAL_ARR_ENUM_H 16 17 #include <CGAL/license/Arrangement_on_surface_2.h> 18 19 #include <CGAL/disable_warnings.h> 20 21 /*! \file 22 * Definition of the enumeration types for the arrangement package. 23 */ 24 25 #include <CGAL/basic.h> 26 #include <CGAL/enum.h> 27 28 namespace CGAL { 29 30 /*! \enum 31 * Selection of a curve end. 32 */ 33 enum Arr_curve_end 34 { 35 ARR_MIN_END, 36 ARR_MAX_END 37 }; 38 39 //! \brief prints curve end (for debugging) 40 template< class OutputStream > 41 inline 42 OutputStream& operator<<( 43 OutputStream& os, 44 const Arr_curve_end& ce) { 45 46 switch(ce) { 47 case CGAL::ARR_MIN_END: 48 os << "ARR_MIN_END"; 49 break; 50 case CGAL::ARR_MAX_END: 51 os << "ARR_MAX_END"; 52 break; 53 default: 54 CGAL_error_msg("bogus curve end"); 55 } 56 return os; 57 } 58 59 60 /*! \enum 61 * Indicator whether a halfedge is directed from left to right (from the 62 * xy-lexicographically smaller vertex to the larger one), or from right to 63 * left. 64 */ 65 enum Arr_halfedge_direction 66 { 67 ARR_LEFT_TO_RIGHT = -1, 68 ARR_RIGHT_TO_LEFT = 1 69 }; 70 71 //! \brief prints halfedge direction (for debugging) 72 template< class OutputStream > 73 inline 74 OutputStream& operator<<( 75 OutputStream& os, 76 const Arr_halfedge_direction& dir) { 77 78 switch(dir) { 79 case CGAL::ARR_LEFT_TO_RIGHT: 80 os << "ARR_LEFT_TO_RIGHT"; 81 break; 82 case CGAL::ARR_RIGHT_TO_LEFT: 83 os << "ARR_RIGHT_TO_LEFT"; 84 break; 85 default: 86 CGAL_error_msg("bogus halfedge direction"); 87 } 88 return os; 89 } 90 91 /*! \enum The various surface boundary types. 92 * For example: 93 * - The plain has unbounded boundaries. 94 * - The sphere has 2 contraction points and one identification curve. 95 */ 96 enum Arr_boundary_type { 97 ARR_OBLIVIOUS = 0, 98 ARR_OPEN, 99 ARR_CLOSED, 100 ARR_CONTRACTION, 101 ARR_IDENTIFICATION 102 }; 103 104 //! \brief prints boundary type (for debugging) 105 template< class OutputStream > 106 inline 107 OutputStream& operator<<( 108 OutputStream& os, 109 const Arr_boundary_type& bt) { 110 111 switch(bt) { 112 case CGAL::ARR_OPEN: 113 os << "ARR_OPEN"; 114 break; 115 case CGAL::ARR_CLOSED: 116 os << "ARR_CLOSED"; 117 break; 118 case CGAL::ARR_CONTRACTION: 119 os << "ARR_CONTRACTION"; 120 break; 121 case CGAL::ARR_IDENTIFICATION: 122 os << "ARR_IDENTIFICATION"; 123 break; 124 case CGAL::ARR_OBLIVIOUS: 125 os << "ARR_OBLIVIOUS"; 126 break; 127 default: 128 CGAL_error_msg("bogus boundary type"); 129 } 130 return os; 131 } 132 133 134 /*! \enum The various surface parameter space options categorizing the 135 * surface range according to the parameter domain. 136 */ 137 138 typedef Box_parameter_space_2 Arr_parameter_space; 139 140 const Arr_parameter_space ARR_LEFT_BOUNDARY = LEFT_BOUNDARY; 141 142 const Arr_parameter_space ARR_RIGHT_BOUNDARY = RIGHT_BOUNDARY; 143 144 const Arr_parameter_space ARR_BOTTOM_BOUNDARY = BOTTOM_BOUNDARY; 145 146 const Arr_parameter_space ARR_TOP_BOUNDARY = TOP_BOUNDARY; 147 148 const Arr_parameter_space ARR_INTERIOR = INTERIOR; 149 150 151 //! \brief prints parameter space (for debugging) 152 template< class OutputStream > 153 inline 154 OutputStream& operator<<( 155 OutputStream& os, 156 const Arr_parameter_space& ps) { 157 158 switch (::CGAL::IO::get_mode(os)) { 159 case ::CGAL::IO::PRETTY: 160 switch(ps) { 161 case CGAL::ARR_LEFT_BOUNDARY: 162 os << "ARR_LEFT_BOUNDARY"; 163 break; 164 case CGAL::ARR_RIGHT_BOUNDARY: 165 os << "ARR_RIGHT_BOUNDARY"; 166 break; 167 case CGAL::ARR_BOTTOM_BOUNDARY: 168 os << "ARR_BOTTOM_BOUNDARY"; 169 break; 170 case CGAL::ARR_TOP_BOUNDARY: 171 os << "ARR_TOP_BOUNDARY"; 172 break; 173 case CGAL::ARR_INTERIOR: 174 os << "ARR_INTERIOR"; 175 break; 176 default: 177 CGAL_error_msg("bogus parameter space"); 178 } 179 break; 180 case ::CGAL::IO::BINARY: 181 std::cerr << "BINARY format not yet implemented" << std::endl; 182 break; 183 default: 184 os << static_cast< int >(ps); 185 } 186 187 return os; 188 } 189 190 191 //! \brief reads parameter space 192 template< class InputStream > 193 inline 194 InputStream& operator>>( 195 InputStream& is, 196 Arr_parameter_space& ps) { 197 198 CGAL_precondition(CGAL::IO::is_ascii(is)); 199 200 int i; 201 is >> i; 202 ps = static_cast< Arr_parameter_space >(i); 203 204 return is; 205 206 } 207 208 209 } //namespace CGAL 210 211 #include <CGAL/enable_warnings.h> 212 213 #endif 214