BWAPI
|
00001 // Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany). 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/Nef_S2/include/CGAL/Nef_S2/SM_items.h $ 00015 // $Id: SM_items.h 28567 2006-02-16 14:30:13Z lsaboret $ 00016 // 00017 // 00018 // Author(s) : Michael Seel <seel@mpi-sb.mpg.de> 00019 // Miguel Granados <granados@mpi-sb.mpg.de> 00020 // Susan Hert <hert@mpi-sb.mpg.de> 00021 // Lutz Kettner <kettner@mpi-sb.mpg.de> 00022 // Peter Hachenberger <hachenberger@mpi-sb.mpg.de> 00023 00024 #ifndef CGAL_SM_ITEMS_H 00025 #define CGAL_SM_ITEMS_H 00026 00027 #include <CGAL/basic.h> 00028 #include <CGAL/In_place_list.h> 00029 #include <CGAL/Object.h> 00030 #include <CGAL/Nef_S2/Sphere_geometry.h> 00031 #include <string> 00032 #include <sstream> 00033 00034 CGAL_BEGIN_NAMESPACE 00035 00036 //template <typename K, typename I,typename C> class Sphere_map; 00037 template <typename SM> class SM_const_decorator; 00038 template <typename SM> class SM_decorator; 00039 00040 struct SM_items { 00041 public: 00042 00043 template <typename Refs> 00044 class SVertex 00045 { 00046 typedef void* GenPtr; 00047 typedef typename Refs::Mark Mark; 00048 typedef typename Refs::Sphere_point Sphere_point; 00049 typedef typename Refs::SVertex_handle SVertex_handle; 00050 typedef typename Refs::SVertex_const_handle SVertex_const_handle; 00051 typedef typename Refs::SHalfedge_handle SHalfedge_handle; 00052 typedef typename Refs::SHalfedge_const_handle SHalfedge_const_handle; 00053 typedef typename Refs::SFace_handle SFace_handle; 00054 typedef typename Refs::SFace_const_handle SFace_const_handle; 00055 00056 Sphere_point point_; 00057 Mark mark_; 00058 SHalfedge_handle out_sedge_; 00059 SFace_handle incident_sface_; 00060 GenPtr info_; 00061 // temporary information: 00062 00063 public: 00064 SVertex() : 00065 point_(), mark_(), out_sedge_(), incident_sface_(), info_() {} 00066 SVertex(const Mark& m) : 00067 point_(), mark_(m), out_sedge_(), incident_sface_(), info_() {} 00068 SVertex(const Sphere_point& p) : 00069 point_(p), mark_(), out_sedge_(), incident_sface_(), info_() {} 00070 00071 ~SVertex() {} 00072 00073 SVertex(const SVertex<Refs>& v) 00074 { point_ = v.point_; 00075 mark_ = v.mark_; 00076 out_sedge_ = v.out_sedge_; 00077 incident_sface_ = v.incident_sface_; 00078 info_ = 0; 00079 } 00080 00081 SVertex<Refs>& operator=(const SVertex<Refs>& v) 00082 { point_ = v.point_; 00083 mark_ = v.mark_; 00084 out_sedge_ = v.out_sedge_; 00085 incident_sface_ = v.incident_sface_; 00086 info_ = 0; 00087 return *this; 00088 } 00089 00090 Mark& mark() { return mark_; } 00091 const Mark& mark() const { return mark_; } 00092 00093 Sphere_point& point(){ return point_; } 00094 const Sphere_point& point() const { return point_; } 00095 00096 SHalfedge_handle& out_sedge() { return out_sedge_; } 00097 SHalfedge_const_handle out_sedge() const { return out_sedge_; } 00098 00099 SFace_handle& incident_sface() { return incident_sface_; } 00100 SFace_const_handle incident_sface() const { return incident_sface_; } 00101 00102 bool is_isolated() const { return (out_sedge() == SHalfedge_handle()); } 00103 00104 GenPtr& info() { return info_; } 00105 const GenPtr& info() const { return info_; } 00106 00107 public: 00108 std::string debug() const 00109 { std::ostringstream os; set_pretty_mode(os); 00110 os<<"V"<<point_<<' '<<info_<<'\0'; 00111 std::string res(os.str()); return res; 00112 } 00113 00114 }; // SVertex 00115 00116 00117 template <typename Refs> 00118 class SHalfedge 00119 { 00120 typedef void* GenPtr; 00121 typedef typename Refs::Mark Mark; 00122 typedef typename Refs::Sphere_circle Sphere_circle; 00123 typedef typename Refs::SVertex_handle SVertex_handle; 00124 typedef typename Refs::SVertex_const_handle SVertex_const_handle; 00125 typedef typename Refs::SHalfedge_handle SHalfedge_handle; 00126 typedef typename Refs::SHalfedge_const_handle SHalfedge_const_handle; 00127 typedef typename Refs::SFace_handle SFace_handle; 00128 typedef typename Refs::SFace_const_handle SFace_const_handle; 00129 00130 // Role within local graph: 00131 Sphere_circle circle_; 00132 Mark mark_; 00133 SHalfedge_handle twin_, sprev_, snext_; 00134 SVertex_handle source_; 00135 SFace_handle incident_sface_; 00136 GenPtr info_; 00137 00138 public: 00139 SHalfedge() : circle_(), mark_(), twin_(), sprev_(), snext_(), 00140 source_(), incident_sface_(), info_() {} 00141 00142 ~SHalfedge() {} 00143 00144 SHalfedge(const SHalfedge<Refs>& e) 00145 { 00146 circle_ = e.circle_; 00147 mark_ = e.mark_; 00148 twin_ = e.twin_; 00149 sprev_ = e.sprev_; 00150 snext_ = e.snext_; 00151 source_ = e.source_; 00152 incident_sface_ = e.incident_sface_; 00153 info_ = 0; 00154 } 00155 SHalfedge<Refs>& operator=(const SHalfedge<Refs>& e) 00156 { 00157 circle_ = e.circle_; 00158 mark_ = e.mark_; 00159 twin_ = e.twin_; 00160 sprev_ = e.sprev_; 00161 snext_ = e.snext_; 00162 source_ = e.source_; 00163 incident_sface_ = e.incident_sface_; 00164 info_ = 0; 00165 return *this; 00166 } 00167 00168 bool is_twin() const { return (&*twin_ < this); } 00169 00170 Mark& mark() { 00171 return mark_; 00172 } 00173 const Mark& mark() const { 00174 return mark_; 00175 } 00176 00177 SHalfedge_handle& twin() { return twin_; } 00178 SHalfedge_const_handle twin() const { return twin_; } 00179 00180 SVertex_handle& source() { return source_; } 00181 SVertex_const_handle source() const { return source_; } 00182 00183 SVertex_handle& target() { return twin()->source(); } 00184 SVertex_const_handle target() const { return twin()->source(); } 00185 00186 SHalfedge_handle& sprev() { return sprev_; } 00187 SHalfedge_const_handle sprev() const { return sprev_; } 00188 00189 SHalfedge_handle& snext() { return snext_; } 00190 SHalfedge_const_handle snext() const { return snext_; } 00191 00192 Sphere_circle& circle() { return circle_; } 00193 const Sphere_circle& circle() const { return circle_; } 00194 00195 SFace_handle& incident_sface() { return incident_sface_; } 00196 SFace_const_handle incident_sface() const { return incident_sface_; } 00197 00198 GenPtr& info() { return info_; } 00199 const GenPtr& info() const { return info_; } 00200 00201 std::string debug() const 00202 { std::ostringstream os; set_pretty_mode(os); 00203 os <<"e["<<source_->debug()<<", " 00204 <<twin_->source_->debug()<<" "<<info_<<"]"<<'\0'; 00205 std::string res(os.str()); return res; 00206 } 00207 00208 }; // SHalfedge 00209 00210 template <typename Refs> 00211 class SHalfloop 00212 { 00213 typedef void* GenPtr; 00214 typedef typename Refs::Mark Mark; 00215 typedef typename Refs::Sphere_circle Sphere_circle; 00216 typedef typename Refs::SHalfloop_handle SHalfloop_handle; 00217 typedef typename Refs::SHalfloop_const_handle SHalfloop_const_handle; 00218 typedef typename Refs::SFace_handle SFace_handle; 00219 typedef typename Refs::SFace_const_handle SFace_const_handle; 00220 00221 00222 Sphere_circle circle_; 00223 Mark mark_; 00224 SHalfloop_handle twin_; 00225 SFace_handle incident_sface_; 00226 GenPtr info_; 00227 // temporary needed: 00228 00229 public: 00230 SHalfloop() : circle_(), mark_(), twin_(), incident_sface_(), info_() {} 00231 ~SHalfloop() {} 00232 SHalfloop(const SHalfloop<Refs>& l) 00233 { 00234 circle_ = l.circle_; 00235 mark_ = l.mark_; 00236 twin_ = l.twin_; 00237 incident_sface_ = l.incident_sface_; 00238 info_ = 0; 00239 } 00240 SHalfloop<Refs>& operator=(const SHalfloop<Refs>& l) 00241 { 00242 circle_ = l.circle_; 00243 mark_ = l.mark_; 00244 twin_ = l.twin_; 00245 incident_sface_ = l.incident_sface_; 00246 info_ = 0; 00247 return *this; 00248 } 00249 00250 bool is_twin() const { return (&*twin_ < this); } 00251 00252 Mark& mark() { 00253 return mark_; 00254 } 00255 00256 const Mark& mark() const { 00257 return mark_; 00258 } 00259 00260 SHalfloop_handle& twin() { return twin_; } 00261 SHalfloop_const_handle twin() const { return twin_; } 00262 00263 Sphere_circle& circle() { return circle_; } 00264 const Sphere_circle& circle() const { return circle_; } 00265 00266 SFace_handle& incident_sface() { return incident_sface_; } 00267 SFace_const_handle incident_sface() const { return incident_sface_; } 00268 00269 GenPtr& info() { return info_; } 00270 const GenPtr& info() const { return info_; } 00271 00272 std::string debug() const 00273 { std::ostringstream os; set_pretty_mode(os); 00274 os<<"l"<<circle_<<' '<<info_<<'\0'; 00275 std::string res(os.str()); return res; 00276 } 00277 00278 }; // SHalfloop 00279 00280 template <typename Refs> 00281 class SFace 00282 { 00283 typedef void* GenPtr; 00284 typedef typename Refs::Mark Mark; 00285 typedef typename Refs::Object_handle Object_handle; 00286 typedef typename Refs::Object_list Object_list; 00287 typedef typename Refs::SFace_cycle_iterator SFace_cycle_iterator; 00288 typedef typename Refs::SFace_cycle_const_iterator 00289 SFace_cycle_const_iterator; 00290 00291 Mark mark_; 00292 Object_list boundary_entry_objects_; 00293 // SHalfedges, SHalfloops, Vertices 00294 GenPtr info_; 00295 // temporary needed: 00296 00297 public: 00298 SFace() : mark_(), info_() {} 00299 ~SFace() {} 00300 00301 SFace(const SFace<Refs>& f) 00302 { mark_ = f.mark_; 00303 boundary_entry_objects_ = f.boundary_entry_objects_; 00304 info_ = 0; 00305 } 00306 SFace<Refs>& operator=(const SFace<Refs>& f) 00307 { if (this == &f) return *this; 00308 mark_ = f.mark_; 00309 boundary_entry_objects_ = f.boundary_entry_objects_; 00310 info_ = 0; 00311 return *this; 00312 } 00313 00314 SFace_cycle_iterator sface_cycles_begin() 00315 { return boundary_entry_objects_.begin(); } 00316 SFace_cycle_iterator sface_cycles_end() 00317 { return boundary_entry_objects_.end(); } 00318 00319 SFace_cycle_const_iterator sface_cycles_begin() const 00320 { return boundary_entry_objects_.begin(); } 00321 SFace_cycle_const_iterator sface_cycles_end() const 00322 { return boundary_entry_objects_.end(); } 00323 00324 Mark& mark() { return mark_; } 00325 const Mark& mark() const { return mark_; } 00326 00327 Object_list& boundary_entry_objects() { return boundary_entry_objects_; } 00328 const Object_list& boundary_entry_objects() const { return boundary_entry_objects_; } 00329 00330 GenPtr& info() { return info_; } 00331 const GenPtr& info() const { return info_; } 00332 00333 }; // SFace 00334 00335 }; // SM_items 00336 00337 00338 CGAL_END_NAMESPACE 00339 #endif // CGAL_SM_ITEMS_H 00340 00341