BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Sweep_line_empty_visitor.h
Go to the documentation of this file.
00001 // Copyright (c) 2005  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_empty_visitor.h $
00015 // $Id: Sweep_line_empty_visitor.h 50366 2009-07-05 12:56:48Z efif $
00016 // 
00017 //
00018 // Author(s)     : Baruch Zukerman <baruchzu@post.tau.ac.il>
00019 
00020 #ifndef CGAL_SWEEP_LINE_EMPTY_VISITOR_H
00021 #define CGAL_SWEEP_LINE_EMPTY_VISITOR_H
00022 
00027 #include <CGAL/Basic_sweep_line_2.h>
00028 #include <CGAL/Sweep_line_2/Sweep_line_event.h>
00029 #include <CGAL/Sweep_line_2/Sweep_line_subcurve.h>
00030 
00031 CGAL_BEGIN_NAMESPACE
00032 
00037 template <class Traits_,
00038           class Subcurve_  =  Sweep_line_subcurve<Traits_>,
00039           typename Event_  =  Sweep_line_event<Traits_, Subcurve_>,
00040           class Allocator_ =  CGAL_ALLOCATOR(int)>
00041 class Sweep_line_empty_visitor
00042 {
00043 public:
00044 
00045   typedef Traits_                                    Traits_2;
00046   typedef Subcurve_                                  Subcurve;
00047   typedef Event_                                     Event;
00048   typedef Allocator_                                 Allocator;
00049 
00050   typedef typename Traits_2::X_monotone_curve_2      X_monotone_curve_2;
00051   typedef typename Traits_2::Point_2                 Point_2; 
00052 
00053   typedef Sweep_line_empty_visitor<Traits_2,
00054                                    Subcurve,
00055                                    Event,
00056                                    Allocator>        Self;
00057 
00058 private:
00059 
00060   // we want to hide the Sweep_line type
00061   typedef Basic_sweep_line_2<Traits_2,
00062                              Self,
00063                              Subcurve,
00064                              Event,
00065                              Allocator>              Sweep_line;
00066   
00067   typedef typename Sweep_line::Status_line_iterator  Base_status_line_iter;
00068 
00069 public:
00070   
00074   class Status_line_iterator : public Base_status_line_iter
00075   {
00076   public:
00077 
00078     typedef Subcurve*                                        value_type;
00079     typedef value_type&                                      reference;
00080     typedef value_type*                                      pointer;
00081     typedef typename Base_status_line_iter::difference_type  difference_type;
00082     typedef typename Base_status_line_iter::iterator_category
00083                                                              iterator_category;
00085     Status_line_iterator()
00086     {}
00087 
00089     Status_line_iterator (Base_status_line_iter iter) :
00090       Base_status_line_iter (iter)
00091     {}
00092     
00093     // Overriden operator*
00094     reference operator* ()
00095     {
00096       return (reinterpret_cast<reference>
00097               (((Base_status_line_iter*)this)->operator*()));
00098     }
00099 
00100     // Overriden operator->
00101     pointer operator-> ()
00102     {
00103       return (reinterpret_cast<pointer>
00104               (Base_status_line_iter::operator->()));
00105     }
00106   };
00107 
00108 
00109   typedef typename Event::Subcurve_iterator          Event_subcurve_iterator;
00110   typedef typename Event::Subcurve_reverse_iterator
00111     Event_subcurve_reverse_iterator;
00112 
00113 protected:
00114 
00115   // Data members:
00116   void*    m_sweep_line;           // The sweep-line object.
00117 
00118 public:
00119 
00121   Sweep_line_empty_visitor () :
00122     m_sweep_line (NULL)
00123   {}
00124 
00126   void attach (void* sl)
00127   {
00128     m_sweep_line = sl;
00129   }
00130 
00132   virtual ~Sweep_line_empty_visitor()
00133   {}
00134 
00139   void before_handle_event (Event* /* event */)
00140   {}
00141 
00146   bool after_handle_event (Event* /* event */,
00147                            Status_line_iterator /* iter */,
00148                            bool /* flag */)
00149   {
00150     return (true);
00151   }
00152 
00154   void add_subcurve (X_monotone_curve_2 /* cv */,
00155                      Subcurve* /* sc */)
00156   {}
00157 
00159   void before_sweep()
00160   {}
00161 
00163   void after_sweep()
00164   {}
00165 
00167   void update_event (Event* /* e */,
00168                      const Point_2& /* end_point */,
00169                      const X_monotone_curve_2& /* cv */,
00170                      Arr_curve_end /* cv_end */,
00171                      bool /* is_new */)
00172   {}
00173 
00175   void update_event (Event* /* e */,
00176                      const X_monotone_curve_2& /* cv */,
00177                      Arr_curve_end /* cv_end */,
00178                      bool /* is_new */)
00179   {}
00180 
00182   void update_event (Event* /* e */,
00183                      Subcurve* /* sc1 */,
00184                      Subcurve* /* sc2 */,
00185                      bool /* is_new */)
00186   {}
00187 
00189   void update_event (Event* /* e */,
00190                      Subcurve* /* sc1 */)
00191   {}
00192 
00194   void update_event (Event* /* e */,
00195                      const Point_2& /* pt */,
00196                      bool /* is_new */)
00197   {}
00198 
00199   /* Found overlap */
00200   void found_overlap (Subcurve* /* sc1 */,
00201                       Subcurve* /* sc2 */,
00202                       Subcurve* /* ov_sc */)
00203   {}
00204 
00206   Status_line_iterator status_line_begin()
00207   {
00208     return (_sweep_line()->status_line_begin());
00209   }
00210 
00212   Status_line_iterator status_line_end()
00213   {
00214     return (_sweep_line()->status_line_end());
00215   }
00216 
00218   Status_line_iterator status_line_position (Subcurve *sc)
00219   {
00220     return (sc->hint());
00221   }
00222 
00224   unsigned status_line_size() const
00225   {
00226     return (_sweep_line()->status_line_size());
00227   }
00228 
00230   bool is_status_line_empty() const
00231   {
00232     return (_sweep_line()->is_status_line_empty());
00233   }
00234 
00236   void deallocate_event (Event* e)
00237   {
00238     _sweep_line()->deallocate_event(e);
00239   }
00240 
00242   void stop_sweep()
00243   {
00244     _sweep_line()->stop_sweep();
00245   }
00246 
00248   void* sweep_line ()
00249   {
00250     return (m_sweep_line);
00251   }
00252 
00254   Event* current_event()
00255   {
00256     return (_sweep_line()->current_event());
00257   }
00258 
00260   const Traits_2 * traits ()
00261   {
00262     return (_sweep_line()->traits());
00263   }
00264 
00265 private:
00266 
00268   Sweep_line* _sweep_line ()
00269   {
00270     return (reinterpret_cast<Sweep_line*>(m_sweep_line));
00271   }
00272 };
00273 
00274 CGAL_END_NAMESPACE
00275 
00276 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines