BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Sweep_line_2/Arr_overlay_subcurve.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/Sweep_line_2/Arr_overlay_subcurve.h $
00015 // $Id: Arr_overlay_subcurve.h 33531 2006-08-23 09:44:26Z wein $
00016 // 
00017 //
00018 // Author(s)     : Baruch Zukerman <baruchzu@post.tau.ac.il>
00019 //                 Ron Wein <wein@post.tau.ac.il>
00020 
00021 #ifndef CGAL_OVERLAY_SUBCURVE_H
00022 #define CGAL_OVERLAY_SUBCURVE_H
00023 
00028 #include <CGAL/Sweep_line_2/Arr_construction_subcurve.h>
00029 
00030 CGAL_BEGIN_NAMESPACE
00031 
00039 template<class Traits_>
00040 class Arr_overlay_subcurve : public Arr_construction_subcurve<Traits_>
00041 {
00042 public:
00043 
00044   typedef Traits_                                        Traits_2;
00045   typedef typename Traits_2::Point_2                     Point_2;
00046   typedef typename Traits_2::X_monotone_curve_2          X_monotone_curve_2;
00047 
00048   typedef Arr_construction_subcurve<Traits_2>            Base;
00049   typedef Arr_overlay_subcurve<Traits_2>                 Self;
00050 
00051   typedef typename Base::Status_line_iterator            Status_line_iterator;
00052 
00053   typedef typename Traits_2::Color                       Color;
00054 
00055   typedef typename Traits_2::Halfedge_handle_red         Halfedge_handle_red;
00056   typedef typename Traits_2::Face_handle_red             Face_handle_red;
00057   typedef typename Face_handle_red::value_type           Face_red;
00058 
00059   typedef typename Traits_2::Halfedge_handle_blue        Halfedge_handle_blue;
00060   typedef typename Traits_2::Face_handle_blue            Face_handle_blue;
00061   typedef typename Face_handle_blue::value_type          Face_blue;
00062 
00063   typedef Sweep_line_event<Traits_2, Self>               Event;
00064 
00065 protected:
00066 
00067   // Data members:
00068   Self        *m_above;     // A subcurve of an opposite color that lies above.
00069 
00070   union
00071   {
00072     const Face_red     *red;
00073     const Face_blue    *blue;
00074   }            m_top_face;  // If m_above is NULL, points the top face in
00075                             // the arrangement of the opposite color that
00076                             // contains the subcurve.
00077   
00078 public:
00079 
00081   Arr_overlay_subcurve () :
00082     Base(),
00083     m_above (NULL)
00084   {
00085     m_top_face.red = NULL;
00086   }
00087 
00089   Arr_overlay_subcurve (const X_monotone_curve_2 &curve) :
00090     Base(curve),
00091     m_above (NULL)
00092   {
00093     m_top_face.red = NULL;
00094   }
00095 
00097   Self* subcurve_above () const
00098   {
00099     return (m_above);
00100   }
00101 
00103   void set_subcurve_above (Self *sc)
00104   {
00105     m_above = sc;
00106     return;
00107   }
00108 
00110   Color color() const
00111   {
00112     return (this->m_lastCurve.color());
00113   }
00114 
00116   bool has_same_color (const Self *sc) const
00117   {
00118     return (this->m_lastCurve.color() == sc->color());
00119   }
00120 
00122   Halfedge_handle_red red_halfedge_handle() const
00123   {
00124     return (this->m_lastCurve.red_halfedge_handle());
00125   }
00126 
00128   Halfedge_handle_blue blue_halfedge_handle() const
00129   {
00130     return (this->m_lastCurve.blue_halfedge_handle());
00131   }
00132 
00134   const Face_handle_red red_top_face () const
00135   {
00136     return (Face_handle_red (m_top_face.red));
00137   }
00138 
00140   const Face_handle_blue blue_top_face () const
00141   {
00142     return (Face_handle_blue (m_top_face.blue));
00143   }
00144 
00146   void set_red_top_face (Face_handle_red fh)
00147   {
00148     m_top_face.red = &(*fh);
00149     return;
00150   }
00151 
00153   void set_blue_top_face (Face_handle_blue fh)
00154   {
00155     m_top_face.blue = &(*fh);
00156   }
00157 
00159   void set_top_face (const Self* sc)
00160   {
00161     CGAL_precondition (sc->m_above == NULL);
00162    
00163     // Mark there is no curve above and copy the face pointer.
00164     m_above = NULL;
00165     m_top_face.red = sc->m_top_face.red;
00166     return;
00167   }
00168 };
00169   
00170 CGAL_END_NAMESPACE
00171 
00172 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines