BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Arrangement_2.h
Go to the documentation of this file.
00001 // Copyright (c) 2006 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/Arrangement_2.h $
00015 // $Id: Arrangement_2.h 50778 2009-07-23 12:14:22Z efif $
00016 // 
00017 //
00018 // Author(s): Ron Wein          <wein@post.tau.ac.il>
00019 //            Efi Fogel         <efif@post.tau.ac.il>
00020 
00021 #ifndef CGAL_ARRANGEMENT_2_H
00022 #define CGAL_ARRANGEMENT_2_H
00023 
00028 #include <CGAL/Arr_tags.h>
00029 #include <CGAL/Arrangement_on_surface_2.h>
00030 #include <CGAL/Arrangement_2/Arr_default_planar_topology.h>
00031 
00032 CGAL_BEGIN_NAMESPACE
00033 
00043 template <class GeomTraits_, 
00044           class Dcel_ = Arr_default_dcel<GeomTraits_> > 
00045 class Arrangement_2 :
00046   public Arrangement_on_surface_2
00047     <GeomTraits_, typename Default_planar_topology<GeomTraits_, Dcel_>::Traits>
00048 {
00049 
00050 protected:
00051 
00052   typedef Default_planar_topology<GeomTraits_, Dcel_ >    Default_topology;
00053 
00054 public:
00055   typedef Arrangement_on_surface_2<GeomTraits_,
00056                                    typename Default_topology::Traits>
00057                                                           Base;
00058 
00059   typedef GeomTraits_                                     Geometry_traits_2;
00060 
00061   typedef Dcel_                                           Dcel;
00062   typedef Arrangement_2<Geometry_traits_2, Dcel>          Self;
00063 
00064   typedef typename Base::Point_2                          Point_2;
00065   typedef typename Base::X_monotone_curve_2               X_monotone_curve_2;
00066   
00067   typedef typename Default_topology::Traits               Topology_traits;
00068 
00069   // Type definitions.
00070   typedef typename Base::Vertex                   Vertex;
00071   typedef typename Base::Halfedge                 Halfedge;
00072   typedef typename Base::Face                     Face;
00073   typedef typename Base::Size                     Size;
00074 
00075   typedef typename Base::Vertex_iterator          Vertex_iterator;
00076   typedef typename Base::Vertex_const_iterator    Vertex_const_iterator;
00077   
00078   typedef typename Base::Halfedge_iterator        Halfedge_iterator;
00079   typedef typename Base::Halfedge_const_iterator  Halfedge_const_iterator;
00080 
00081   typedef typename Base::Edge_iterator            Edge_iterator;
00082   typedef typename Base::Edge_const_iterator      Edge_const_iterator;
00083 
00084   typedef typename Base::Face_iterator            Face_iterator;
00085   typedef typename Base::Face_const_iterator      Face_const_iterator;
00086   
00087   typedef typename Base::Halfedge_around_vertex_circulator 
00088     Halfedge_around_vertex_circulator;
00089   typedef typename Base::Halfedge_around_vertex_const_circulator
00090     Halfedge_around_vertex_const_circulator;
00091 
00092   typedef typename Base::Ccb_halfedge_circulator   Ccb_halfedge_circulator;
00093   typedef typename Base::Ccb_halfedge_const_circulator
00094     Ccb_halfedge_const_circulator;
00095   
00096   typedef typename Base::Outer_ccb_iterator        Outer_ccb_iterator;
00097   typedef typename Base::Outer_ccb_const_iterator  Outer_ccb_const_iterator;
00098 
00099   typedef typename Base::Inner_ccb_iterator        Inner_ccb_iterator;
00100   typedef typename Base::Inner_ccb_const_iterator  Inner_ccb_const_iterator;
00101 
00102   typedef typename Base::Isolated_vertex_iterator  Isolated_vertex_iterator;
00103   typedef typename Base::Isolated_vertex_const_iterator
00104     Isolated_vertex_const_iterator;
00105 
00106   typedef typename Base::Vertex_handle             Vertex_handle;
00107   typedef typename Base::Vertex_const_handle       Vertex_const_handle;
00108 
00109   typedef typename Base::Halfedge_handle           Halfedge_handle;
00110   typedef typename Base::Halfedge_const_handle     Halfedge_const_handle;
00111 
00112   typedef typename Base::Face_handle               Face_handle;
00113   typedef typename Base::Face_const_handle         Face_const_handle;
00114 
00115   // These types are defined for backward compatibility:
00116   typedef Geometry_traits_2                        Traits_2;
00117   typedef typename Base::Inner_ccb_iterator        Hole_iterator;
00118   typedef typename Base::Inner_ccb_const_iterator  Hole_const_iterator;
00119 
00120 private:
00121 
00122   friend class Arr_observer<Self>;
00123   friend class Arr_accessor<Self>;
00124 
00125 public:
00126 
00128 
00129 
00131   Arrangement_2 () :
00132     Base ()
00133   {}
00134 
00136   Arrangement_2 (const Base& base) :
00137     Base (base)
00138   {}
00139 
00141   Arrangement_2 (const Traits_2 *tr) :
00142     Base (tr)
00143   {}
00145 
00147 
00148 
00150   Self& operator= (const Base& base)
00151   {
00152     Base::assign (base);
00153     return (*this);
00154   }
00155 
00157   void assign (const Base& base)
00158   {
00159     Base::assign (base);
00160     return;
00161   }
00163 
00165 
00166 
00168   const Traits_2* traits () const
00169   {
00170     return (this->geometry_traits());
00171   }
00172 
00173   Traits_2* traits ()
00174   {
00175     return (this->geometry_traits());
00176   }
00177 
00179   Size number_of_vertices_at_infinity () const
00180   {
00181     // The vertices at infinity are valid, but not concrete:
00182     return (this->topology_traits()->number_of_valid_vertices() -
00183             this->topology_traits()->number_of_concrete_vertices());
00184   }
00185 
00187   Face_handle unbounded_face ()
00188   {
00189     // The fictitious un_face contains all other valid faces in a single
00190     // hole inside it. We return a handle to one of its neighboring faces,
00191     // which is necessarily unbounded.
00192     typename Base::DFace      *un_face =
00193       const_cast<typename Base::DFace*>(this->topology_traits()->
00194                                         initial_face());
00195 
00196     if (! un_face->is_fictitious())
00197       return (Face_handle (un_face));
00198 
00199     typename Base::DHalfedge  *p_he = *(un_face->inner_ccbs_begin());
00200     typename Base::DHalfedge  *p_opp = p_he->opposite();
00201     typename Base::DOuter_ccb *p_oc = p_opp->outer_ccb();
00202 
00203     return (Face_handle (p_oc->face()));
00204   }
00205 
00207   Face_const_handle unbounded_face () const
00208   {
00209     // The fictitious un_face contains all other valid faces in a single
00210     // hole inside it. We return a handle to one of its neighboring faces,
00211     // which is necessarily unbounded.
00212     const typename Base::DFace      *un_face =
00213                                    this->topology_traits()->initial_face(); 
00214 
00215     if (! un_face->is_fictitious())
00216       return (Face_const_handle (un_face));
00217 
00218     const typename Base::DHalfedge  *p_he = *(un_face->inner_ccbs_begin());
00219     const typename Base::DHalfedge  *p_opp = p_he->opposite();
00220     const typename Base::DOuter_ccb *p_oc = p_opp->outer_ccb();
00221     
00222     return (Face_const_handle (p_oc->face()));
00223   }
00224 
00226 
00227 protected:
00228 
00230 
00231   typedef Arr_observer<Self>                      Observer;
00232 
00237   void _register_observer (Observer *p_obs)
00238   {
00239     Base::_register_observer ((typename Base::Observer*)p_obs);
00240     return;
00241   }
00242 
00248   bool _unregister_observer (Observer *p_obs)
00249   {
00250     return (Base::_unregister_observer ((typename Base::Observer*)p_obs));
00251   }
00253 
00254 };
00255 
00256 CGAL_END_NAMESPACE
00257 
00258 #endif
00259 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines