BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Arr_tracing_traits_2.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/Arr_tracing_traits_2.h $
00015 // $Id: Arr_tracing_traits_2.h 50366 2009-07-05 12:56:48Z efif $
00016 //
00017 // Author(s)     : Efi Fogel    <efif@post.tau.ac.il>
00018 
00019 #ifndef CGAL_ARR_TRACING_TRAITS_H
00020 #define CGAL_ARR_TRACING_TRAITS_H
00021 
00029 #include <iostream>
00030 #include <list>
00031 
00032 #include <CGAL/basic.h>
00033 #include <CGAL/Arr_enums.h>
00034 
00035 CGAL_BEGIN_NAMESPACE
00036 
00040 template <typename Base_traits>
00041 class Arr_tracing_traits_2 : public Base_traits {
00042 public:
00043   enum Operation_id {
00044     COMPARE_X_OP = 0,
00045     COMPARE_XY_OP,
00046     CONSTRUCT_MIN_VERTEX_OP,
00047     CONSTRUCT_MAX_VERTEX_OP,
00048     IS_VERTICAL_OP,
00049     COMPARE_Y_AT_X_OP,
00050     EQUAL_POINTS_OP,
00051     EQUAL_CURVES_OP,
00052     COMPARE_Y_AT_X_LEFT_OP,
00053     COMPARE_Y_AT_X_RIGHT_OP,
00054 
00055     MAKE_X_MONOTONE_OP,
00056     SPLIT_OP,
00057     INTERSECT_OP,
00058 
00059     ARE_MERGEABLE_OP,
00060     MERGE_OP,
00061 
00062     CONSTRUCT_OPPOSITE_OP,
00063     COMPARE_ENDPOINTS_XY_OP,
00064 
00065     PARAMETER_SPACE_IN_X_OP,
00066     COMPARE_Y_NEAR_BOUNDARY_OP,
00067     COMPARE_Y_ON_BOUNDARY_OP,
00068     IS_ON_X_IDENTIFICATION_OP,    
00069     
00070     PARAMETER_SPACE_IN_Y_OP,
00071     COMPARE_X_NEAR_BOUNDARY_OP,
00072     COMPARE_X_ON_BOUNDARY_OP,
00073     IS_ON_Y_IDENTIFICATION_OP,
00074     
00075     NUMBER_OF_OPERATIONS
00076   };
00077 
00078 private:
00079   typedef Base_traits                           Base;
00080   typedef Arr_tracing_traits_2<Base>            Self;
00081 
00083   unsigned int m_flags;
00084   
00085   bool compare_x_op() const
00086   { return m_flags & (0x1 << COMPARE_X_OP); }
00087 
00088   bool compare_xy_op() const
00089   { return m_flags & (0x1 << COMPARE_XY_OP); }
00090   
00091   bool construct_min_vertex_op() const
00092   { return m_flags & (0x1 << CONSTRUCT_MIN_VERTEX_OP); }
00093   
00094   bool construct_max_vertex_op() const
00095   { return m_flags & (0x1 << CONSTRUCT_MAX_VERTEX_OP); }
00096   
00097   bool is_vertical_op() const
00098   { return m_flags & (0x1 << IS_VERTICAL_OP); }
00099   
00100   bool compare_y_at_x_op() const
00101   { return m_flags & (0x1 << COMPARE_Y_AT_X_OP); }
00102   
00103   bool equal_points_op() const
00104   { return m_flags & (0x1 << EQUAL_POINTS_OP); }
00105   
00106   bool equal_curves_op() const
00107   { return m_flags & (0x1 << EQUAL_CURVES_OP); }
00108   
00109   bool compare_y_at_x_left_op() const
00110   { return m_flags & (0x1 << COMPARE_Y_AT_X_LEFT_OP); }
00111   
00112   bool compare_y_at_x_right_op() const
00113   { return m_flags & (0x1 << COMPARE_Y_AT_X_RIGHT_OP); }
00114   
00115   bool make_x_monotone_op() const
00116   { return m_flags & (0x1 << MAKE_X_MONOTONE_OP); }
00117   
00118   bool split_op() const
00119   { return m_flags & (0x1 << SPLIT_OP); }
00120   
00121   bool intersect_op() const
00122   { return m_flags & (0x1 << INTERSECT_OP); }
00123   
00124   bool are_mergeable_op() const
00125   { return m_flags & (0x1 << ARE_MERGEABLE_OP); }
00126   
00127   bool merge_op() const
00128   { return m_flags & (0x1 << MERGE_OP); }
00129   
00130   bool construct_opposite_op() const
00131   { return m_flags & (0x1 << CONSTRUCT_OPPOSITE_OP); }
00132   
00133   bool compare_endpoints_xy_op() const
00134   { return m_flags & (0x1 << COMPARE_ENDPOINTS_XY_OP); }
00135 
00136   bool parameter_space_in_x_op() const
00137   { return m_flags & (0x1 << PARAMETER_SPACE_IN_X_OP); }
00138   
00139   bool compare_y_near_boundary_op() const
00140   { return m_flags & (0x1 << COMPARE_Y_NEAR_BOUNDARY_OP); }
00141 
00142   bool compare_y_on_boundary_op() const
00143   { return m_flags & (0x1 << COMPARE_Y_ON_BOUNDARY_OP); }  
00144 
00145   bool is_on_x_identification_op() const 
00146   { return m_flags & (0x1 << IS_ON_X_IDENTIFICATION_OP); }  
00147   
00148   bool parameter_space_in_y_op() const
00149   { return m_flags & (0x1 << PARAMETER_SPACE_IN_Y_OP); }
00150 
00151   bool compare_x_near_boundary_op() const
00152   { return m_flags & (0x1 << COMPARE_X_NEAR_BOUNDARY_OP); }
00153 
00154   bool compare_x_on_boundary_op() const
00155   { return m_flags & (0x1 << COMPARE_X_ON_BOUNDARY_OP); }  
00156 
00157   bool is_on_y_identification_op() const 
00158   { return m_flags & (0x1 << IS_ON_Y_IDENTIFICATION_OP); }  
00159   
00160 public:
00162   Arr_tracing_traits_2() :
00163     Base()
00164   {
00165     enable_all_traces();
00166   }
00167 
00171   void enable_trace(Operation_id id) { m_flags |= 0x1 << id; }
00172 
00176   void enable_all_traces() { m_flags = 0xffffffff; }
00177   
00181   void disable_trace(Operation_id id) { m_flags &= ~(0x1 << id); }
00182 
00186   void disable_all_traces() { m_flags = 0x0; }
00187   
00189 
00190 
00191   // Traits types:
00192   typedef typename Base::Has_left_category      Has_left_category;
00193   typedef typename Base::Has_merge_category     Has_merge_category;
00194 
00195   typedef typename CGALi::Arr_complete_left_side_tag< Base >::Tag
00196                                                 Arr_left_side_tag;
00197   typedef typename CGALi::Arr_complete_bottom_side_tag< Base >::Tag
00198                                                 Arr_bottom_side_tag;
00199   typedef typename CGALi::Arr_complete_top_side_tag< Base >::Tag
00200                                                 Arr_top_side_tag;
00201   typedef typename CGALi::Arr_complete_right_side_tag< Base >::Tag
00202                                                 Arr_right_side_tag;
00203   
00204   typedef typename Base::Point_2                Point_2;
00205   typedef typename Base::X_monotone_curve_2     X_monotone_curve_2;
00206   typedef typename Base::Curve_2                Curve_2;
00207 
00209   class Compare_x_2 {
00210   private:
00211     typename Base::Compare_x_2 m_object;
00212     bool m_enabled;
00213     
00214   public:
00216     Compare_x_2(const Base * base, bool enabled = true) :
00217       m_object(base->compare_x_2_object()), m_enabled(enabled) {}
00218 
00224     Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const
00225     {
00226       if (!m_enabled) return m_object(p1, p2);
00227       std::cout << "compare_x" << std::endl
00228                 << "  p1: " << p1 << std::endl
00229                 << "  p2: " << p2 << std::endl;
00230       Comparison_result cr = m_object(p1, p2);
00231       std::cout << "  result: " << cr << std::endl;
00232       return cr;
00233     }
00234   };
00235 
00237   class Compare_xy_2 {
00238   private:
00239     typename Base::Compare_xy_2 m_object;
00240     bool m_enabled;
00241 
00242   public:
00244     Compare_xy_2(const Base * base, bool enabled = true) :
00245       m_object(base->compare_xy_2_object()), m_enabled(enabled) {}
00246 
00252     Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const
00253     {
00254       if (!m_enabled) return m_object(p1, p2);
00255       std::cout << "compare_xy" << std::endl
00256                 << "  p1: " << p1 << std::endl
00257                 << "  p2: " << p2 << std::endl;
00258       Comparison_result cr = m_object(p1, p2);
00259       std::cout << "  result: " << cr << std::endl;
00260       return cr;
00261     }
00262   };
00263 
00265   class Construct_min_vertex_2 {
00266   private:
00267     typename Base::Construct_min_vertex_2 m_object;
00268     bool m_enabled;
00269 
00270   public:
00272     Construct_min_vertex_2(const Base * base, bool enabled = true) :
00273       m_object(base->construct_min_vertex_2_object()), m_enabled(enabled) {}
00274 
00279     const Point_2 operator()(const X_monotone_curve_2 & xcv) const
00280     {
00281       if (!m_enabled) return m_object(xcv);
00282       std::cout << "construct_min_vertex" << std::endl
00283                 << "  xcv: " << xcv << std::endl;
00284       Point_2 p = m_object(xcv);
00285       std::cout << "  result: " << p << std::endl;
00286       return p;
00287     }
00288   };
00289 
00291   class Construct_max_vertex_2 {
00292   private:
00293     typename Base::Construct_max_vertex_2 m_object;
00294     bool m_enabled;
00295 
00296   public:
00298     Construct_max_vertex_2(const Base * base, bool enabled = true) :
00299       m_object(base->construct_max_vertex_2_object()), m_enabled(enabled) {}
00300 
00305     const Point_2 operator()(const X_monotone_curve_2 & xcv) const
00306     {
00307       if (!m_enabled) return m_object(xcv);
00308       std::cout << "construct_max_vertex" << std::endl
00309                 << "  xcv: " << xcv << std::endl;
00310       Point_2 p = m_object(xcv);
00311       std::cout << "  result: " << p << std::endl;      
00312       return p;
00313     }
00314   };
00315   
00317   class Is_vertical_2 {
00318   private:
00319     typename Base::Is_vertical_2 m_object;
00320     bool m_enabled;
00321 
00322   public:
00324     Is_vertical_2(const Base * base, bool enabled = true) :
00325       m_object(base->is_vertical_2_object()), m_enabled(enabled) {}
00326     
00331     bool operator()(const X_monotone_curve_2 & xcv) const
00332     {
00333       if (!m_enabled) return m_object(xcv);
00334       std::cout << "is_vertical" << std::endl
00335                 << "  xcv: " << xcv << std::endl;
00336       bool is_vertical = m_object(xcv);
00337       std::cout << "  result: " << is_vertical << std::endl;
00338       return is_vertical;
00339     }
00340   };
00341   
00345   class Compare_y_at_x_2 {
00346   private:
00347     typename Base::Compare_y_at_x_2 m_object;
00348     bool m_enabled;
00349 
00350   public:
00352     Compare_y_at_x_2(const Base * base, bool enabled = true) :
00353       m_object(base->compare_y_at_x_2_object()), m_enabled(enabled) {}
00354 
00360     Comparison_result operator()(const Point_2 & p,
00361                                  const X_monotone_curve_2 & xcv) const
00362     {
00363       if (!m_enabled) return m_object(p, xcv);
00364       std::cout << "compare_y_at_x" << std::endl
00365                 << "  p: " << p << std::endl
00366                 << "  xcv: " << xcv << std::endl;
00367       Comparison_result cr = m_object(p, xcv);
00368       std::cout << "  result: " << cr << std::endl;
00369       return cr;
00370     }
00371   };
00372   
00376   class Equal_2 {
00377   private:
00378     typename Base::Equal_2 m_object;
00379     bool m_enabled_point;
00380     bool m_enabled_curve;
00381 
00382   public:
00384     Equal_2(const Base * base,
00385             bool enabled_point = true, bool enabled_curve = true) :
00386       m_object(base->equal_2_object()),
00387       m_enabled_point(enabled_point),
00388       m_enabled_curve(enabled_curve)
00389     {}
00390 
00396     bool operator()(const X_monotone_curve_2 & xcv1,
00397                     const X_monotone_curve_2 & xcv2) const
00398     {
00399       if (!m_enabled_curve) return m_object(xcv1, xcv2);
00400       std::cout << "equal 1" << std::endl
00401                 << "  xcv1: " << xcv1 << std::endl
00402                 << "  xcv1: " << xcv1 << std::endl;
00403       bool equal = m_object(xcv1, xcv2);
00404       std::cout << "  result: " << equal << std::endl;
00405       return equal;
00406     }
00407 
00413     bool operator()(const Point_2 & p1, const Point_2 & p2) const
00414     {
00415       if (!m_enabled_point) return m_object(p1, p2);
00416       std::cout << "equal 2" << std::endl
00417                 << "  p1: " << p1 << std::endl
00418                 << "  p2: " << p2 << std::endl;
00419       bool equal = m_object(p1, p2);
00420       std::cout << "  result: " << equal << std::endl;
00421       return equal;
00422     }    
00423   };
00424 
00428   class Compare_y_at_x_left_2 {
00429   private:
00430     typename Base::Compare_y_at_x_left_2 m_object;
00431     bool m_enabled;
00432 
00433   public:
00435     Compare_y_at_x_left_2(const Base * base, bool enabled = true) :
00436       m_object(base->compare_y_at_x_left_2_object()), m_enabled(enabled) {}
00437 
00444     Comparison_result operator()(const X_monotone_curve_2 & xcv1,
00445                                  const X_monotone_curve_2 & xcv2,
00446                                  const Point_2 & p) const
00447     {
00448       if (!m_enabled) return m_object(xcv1, xcv2, p);
00449       std::cout << "compare_y_at_x_left" << std::endl
00450                 << "  p: " << p << std::endl
00451                 << "  xcv1: " << xcv1 << std::endl
00452                 << "  xcv2: " << xcv2 << std::endl;
00453       Comparison_result cr = m_object(xcv1, xcv2, p);
00454       std::cout << "  result:" << cr << std::endl;
00455       return cr;
00456     }
00457   };
00458 
00462   class Compare_y_at_x_right_2 {
00463   private:
00464     typename Base::Compare_y_at_x_right_2 m_object;
00465     bool m_enabled;
00466 
00467   public:
00469     Compare_y_at_x_right_2(const Base * base, bool enabled = true) :
00470       m_object(base->compare_y_at_x_right_2_object()), m_enabled(enabled) {}
00471 
00478     Comparison_result operator()(const X_monotone_curve_2 & xcv1,
00479                                  const X_monotone_curve_2 & xcv2,
00480                                  const Point_2 & p) const
00481     {
00482       if (!m_enabled) return m_object(xcv1, xcv2, p);
00483       std::cout << "compare_y_at_x_right" << std::endl
00484                 << "  p: " << p << std::endl
00485                 << "  xcv1: " << xcv1 << std::endl
00486                 << "  xcv2: " << xcv2 << std::endl;
00487       Comparison_result cr = m_object(xcv1, xcv2, p);
00488       std::cout << "  result: " << cr << std::endl;
00489       return cr;
00490     }
00491   };
00492   
00494   class Make_x_monotone_2 {
00495   private:
00496     typename Base::Make_x_monotone_2 m_object;
00497     bool m_enabled;
00498 
00499   public:
00501     Make_x_monotone_2(const Base * base, bool enabled = true) :
00502       m_object(base->make_x_monotone_2_object()), m_enabled(enabled) {}
00503 
00510     template<typename OutputIterator>
00511     OutputIterator operator()(const Curve_2 & cv, OutputIterator oi) const
00512     {
00513       if (!m_enabled) return m_object(cv, oi);
00514       std::cout << "make_x_monotone" << std::endl
00515                 << "  cv: " << cv << std::endl;        
00516       std::list<CGAL::Object> container;
00517       m_object(cv, std::back_inserter(container));
00518       if (container.empty()) return oi;
00519 
00520       std::list<CGAL::Object>::iterator it;
00521       unsigned int i = 0;
00522       for (it = container.begin(); it != container.end(); ++it) {
00523         X_monotone_curve_2 xcv;
00524         if (assign (xcv, *it)) {
00525           std::cout << "  result[" << i++ << "]: xcv: " << xcv << std::endl;
00526           continue;
00527         }
00528 
00529         Point_2 p;
00530         if (assign (p, *it)) {
00531           std::cout << "  result[" << i++ << "]: p: " << p << std::endl;
00532           continue;
00533         }
00534       }
00535       
00536       for (it = container.begin(); it != container.end(); ++it) *oi++ = *it;
00537       container.clear();
00538       return oi;
00539     }
00540   };
00541 
00543   class Split_2 {
00544   private:
00545     typename Base::Split_2 m_object;
00546     bool m_enabled;
00547 
00548   public:
00550     Split_2(const Base * base, bool enabled = true) :
00551       m_object(base->split_2_object()), m_enabled(enabled) {}
00552 
00559     void operator()(const X_monotone_curve_2 & xcv, const Point_2 & p,
00560                     X_monotone_curve_2 & xcv1, X_monotone_curve_2 & xcv2) const
00561     {
00562       if (!m_enabled) {
00563         m_object(xcv, p, xcv1, xcv2);
00564         return;
00565       }
00566       std::cout << "split: " << std::endl
00567                 << "  xcv: " << xcv << std::endl
00568                 << "  p: " << p << std::endl;
00569       m_object(xcv, p, xcv1, xcv2);
00570       std::cout << "  result xcv1: " << xcv1 << std::endl
00571                 << "         xcv2: " << xcv2 << std::endl;
00572     }
00573   };
00574 
00576   class Intersect_2 {
00577   private:
00578     typename Base::Intersect_2 m_object;
00579     bool m_enabled;
00580 
00581   public:
00583     Intersect_2(const Base * base, bool enabled = true) :
00584       m_object(base->intersect_2_object()), m_enabled(enabled) {}
00585 
00595     template<typename OutputIterator>
00596     OutputIterator operator()(const X_monotone_curve_2 & xcv1,
00597                               const X_monotone_curve_2 & xcv2,
00598                               OutputIterator oi) const
00599     {
00600       if (!m_enabled) return m_object(xcv1, xcv2, oi);
00601       std::cout << "intersect" << std::endl
00602                 << "  xcv1: " << xcv1 << std::endl
00603                 << "  xcv2: " << xcv2 << std::endl;
00604       std::list<CGAL::Object> container;
00605       m_object(xcv1, xcv2, std::back_inserter(container));
00606       if (container.empty()) return oi;
00607 
00608       std::list<CGAL::Object>::iterator it;
00609       unsigned int i = 0;
00610       for (it = container.begin(); it != container.end(); ++it) {
00611         X_monotone_curve_2 xcv;
00612         if (assign (xcv, *it)) {
00613           std::cout << "  result[" << i++ << "]: xcv: " << xcv << std::endl;
00614           continue;
00615         }
00616 
00617         std::pair<Point_2,unsigned int> point_pair;
00618         if (assign (point_pair, *it)) {
00619           std::cout << "  result[" << i++ << "]: p: " << point_pair.first
00620                     << ", multiplicity: " << point_pair.second << std::endl;
00621           continue;
00622         }
00623       }
00624       
00625       for (it = container.begin(); it != container.end(); ++it) *oi++ = *it;
00626       container.clear();
00627       return oi;
00628     }
00629   };
00630 
00632   class Are_mergeable_2 {
00633   private:
00634     typename Base::Are_mergeable_2 m_object;
00635     bool m_enabled;
00636 
00637   public:
00639     Are_mergeable_2(const Base * base, bool enabled = true) :
00640       m_object(base->are_mergeable_2_object()), m_enabled(enabled) {}
00641 
00649     bool operator()(const X_monotone_curve_2 & xcv1,
00650                     const X_monotone_curve_2 & xcv2) const
00651     {
00652       if (!m_enabled) return m_object(xcv1, xcv2);
00653       std::cout << "are_mergeable" << std::endl
00654                 << "  xcv1: " << xcv1 << std::endl
00655                 << "  xcv2: " << xcv2 << std::endl;
00656       bool are_mergeable = m_object(xcv1, xcv2);
00657       std::cout << "  result: " << are_mergeable << std::endl;
00658       return are_mergeable;
00659     }
00660   };
00661 
00663   class Merge_2 {
00664   private:
00665     typename Base::Merge_2 m_object;
00666     bool m_enabled;
00667 
00668   public:
00670     Merge_2(const Base * base, bool enabled = true) :
00671       m_object(base->merge_2_object()), m_enabled(enabled) {}
00672 
00678     void operator()(const X_monotone_curve_2 & xcv1,
00679                     const X_monotone_curve_2 & xcv2,
00680                     X_monotone_curve_2 & xcv) const
00681     {
00682       std::cout << "merge" << std::endl
00683                 << "  xcv1: " << xcv1 << std::endl
00684                 << "  xcv2: " << xcv2 << std::endl;
00685       return m_object(xcv1, xcv2, xcv);
00686       std::cout << "  result: " << xcv << std::endl;
00687     }
00688   };
00689 
00691   class Construct_opposite_2 {
00692   private:
00693     typename Base::Construct_opposite_2 m_object;
00694     bool m_enabled;
00695 
00696   public:
00698     Construct_opposite_2(const Base * base, bool enabled = true) :
00699       m_object(base->construct_opposite_2_object()), m_enabled(enabled) {}
00700 
00705     X_monotone_curve_2 operator()(const X_monotone_curve_2 & xcv)
00706     {
00707       if (!m_enabled) return m_object(xcv);
00708       std::cout << "construct_opposite" << std::endl
00709                 << "  xcv: " << xcv << std::endl;
00710       X_monotone_curve_2 xcv_out = m_object(xcv);
00711       std::cout << "  result: " << xcv_out << std::endl;
00712       return xcv;
00713     }
00714   };
00715 
00719   class Compare_endpoints_xy_2 {
00720   private:
00721     typename Base::Compare_endpoints_xy_2 m_object;
00722     bool m_enabled;
00723 
00724   public:
00726     Compare_endpoints_xy_2(const Base * base, bool enabled = true) :
00727       m_object(base->compare_endpoints_xy_2_object()), m_enabled(enabled) {}
00728 
00733     Comparison_result operator()(const X_monotone_curve_2 & xcv)
00734     {
00735       if (!m_enabled) return m_object(xcv);
00736       std::cout << "compare_endpoints_xy" << std::endl
00737                 << "  xcv: " << xcv << std::endl;
00738       Comparison_result cr = m_object(xcv);
00739       std::cout << "  result: " << cr << std::endl;
00740       return cr;
00741     }
00742   };
00743 
00747   class Parameter_space_in_x_2 {
00748   private:
00749     typename Base::Parameter_space_in_x_2 m_object;
00750     bool m_enabled;
00751 
00752   public:
00754     Parameter_space_in_x_2(const Base * base, bool enabled = true) :
00755       m_object(base->parameter_space_in_x_2_object()), m_enabled(enabled)
00756     {}
00757     
00763     Arr_parameter_space operator()(const X_monotone_curve_2 & xcv,
00764                              Arr_curve_end ce) const
00765     {
00766       if (!m_enabled) return m_object(xcv, ce);
00767       std::cout << "parameter_space_in_x" << std::endl
00768                 << "  ce: " << ce << ", xcv: " << xcv << std::endl;
00769       Arr_parameter_space bt = m_object(xcv, ce);
00770       std::cout << "  result: " << bt << std::endl;
00771       return bt;
00772     }
00773   };
00774 
00778   class Parameter_space_in_y_2 {
00779   private:
00780     typename Base::Parameter_space_in_y_2 m_object;
00781     bool m_enabled;
00782 
00783   public:
00785     Parameter_space_in_y_2(const Base * base, bool enabled = true) :
00786       m_object(base->parameter_space_in_y_2_object()), m_enabled(enabled) {}
00787     
00793     Arr_parameter_space operator()(const X_monotone_curve_2 & xcv,
00794                              Arr_curve_end ce) const
00795     {
00796       if (!m_enabled) return m_object(xcv, ce);
00797         std::cout << "parameter_space_in_y" << std::endl
00798                   << "  ce: " << ce << ", xcv: " << xcv << std::endl;
00799       Arr_parameter_space bt = m_object(xcv, ce);
00800       std::cout << "  result: " << bt << std::endl;
00801       return bt;
00802     }
00803 
00808     Arr_parameter_space operator()(const Point_2 & p) const
00809     {
00810       if (!m_enabled) return m_object(p);
00811         std::cout << "parameter_space_in_y" << std::endl
00812                   << "  point: " << p << std::endl;
00813       Arr_parameter_space bt = m_object(p);
00814       std::cout << "  result: " << bt << std::endl;
00815       return bt;
00816     }
00817   };
00818 
00822   class Compare_x_near_boundary_2 {
00823   private:
00824     typename Base::Compare_x_near_boundary_2 m_object;
00825     bool m_enabled;
00826     
00827   public:
00829     Compare_x_near_boundary_2(const Base * base, bool enabled = true) :
00830       m_object(base->compare_x_near_boundary_2_object()), m_enabled(enabled) {}
00831 
00838     Comparison_result operator()(const Point_2 & p,
00839                                  const X_monotone_curve_2 & xcv,
00840                                  Arr_curve_end ce) const
00841     {
00842       if (!m_enabled) return m_object(p, xcv, ce);
00843       std::cout << "compare_x_near_boundary 1" << std::endl
00844                 << "  p: " << p << std::endl
00845                 << "  ce: " << ce << ", xcv: " << xcv << std::endl;
00846       Comparison_result cr = m_object(p, xcv, ce);
00847       std::cout << "  result: " << std::endl;
00848       return cr;
00849     }
00850 
00858     Comparison_result operator()(const X_monotone_curve_2 & xcv1,
00859                                  Arr_curve_end ce1,
00860                                  const X_monotone_curve_2 & xcv2,
00861                                  Arr_curve_end ce2) const
00862     {
00863       if (!m_enabled) return m_object(xcv1, ce1, xcv2, ce2);
00864       std::cout << "compare_x_near_boundary 2" << std::endl
00865                 << "  ce1: " << ce1 << ", xcv1: " << xcv1 << std::endl
00866                 << "  ce2: " << ce2 << ", xcv2: " << xcv2 << std::endl;
00867       Comparison_result cr = m_object(xcv1, ce1, xcv2, ce2);
00868       std::cout << "  result: " << cr << std::endl;
00869       return cr;
00870     }
00871   };
00872 
00876   class Compare_y_near_boundary_2 {
00877   private:
00878     typename Base::Compare_y_near_boundary_2 m_object;
00879     bool m_enabled;
00880     
00881   public:
00883     Compare_y_near_boundary_2(const Base * base, bool enabled = true) :
00884       m_object(base->compare_y_near_boundary_2_object()), m_enabled(enabled) {}
00885 
00892     Comparison_result operator()(const X_monotone_curve_2 & xcv1,
00893                                  const X_monotone_curve_2 & xcv2, 
00894                                  Arr_curve_end ce) const
00895     {
00896       if (!m_enabled) return m_object(xcv1, xcv2, ce);
00897       std::cout << "compare_y_near_boundary" << std::endl
00898                 << "  ce: " << ce << std::endl
00899                 << "  xcv1: " << xcv1 << std::endl
00900                 << "  xcv2: " << xcv2 << std::endl;
00901       Comparison_result cr = m_object(xcv1, xcv2, ce);
00902       std::cout << "  result: " << cr << std::endl;
00903       return cr;
00904     }
00905   };
00906 
00910   class Compare_x_on_boundary_2 {
00911   private:
00912     typename Base::Compare_x_on_boundary_2 m_object;
00913     bool m_enabled;
00914     
00915   public:
00917     Compare_x_on_boundary_2(const Base * base, bool enabled = true) :
00918       m_object(base->compare_x_on_boundary_2_object()), m_enabled(enabled) {}
00923     Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const
00924     {
00925       if (!m_enabled) return m_object(p1, p2);
00926       std::cout << "compare_x_on_boundary" << std::endl
00927                 << "  p1: " << p1 << std::endl
00928                 << "  p2: " << p2 << std::endl;
00929       Comparison_result cr = m_object(p1, p2);
00930       std::cout << "  result: " << cr << std::endl;
00931       return cr;
00932     }
00933   };
00934   
00938   class Compare_y_on_boundary_2 {
00939   private:
00940     typename Base::Compare_y_on_boundary_2 m_object;
00941     bool m_enabled;
00942     
00943   public:
00945     Compare_y_on_boundary_2(const Base * base, bool enabled = true) :
00946       m_object(base->compare_y_on_boundary_2_object()),
00947       m_enabled(enabled)
00948     {}
00949 
00954     Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const
00955     {
00956       if (!m_enabled) return m_object(p1, p2);
00957       std::cout << "compare_y_on_boundary" << std::endl
00958                 << "  p1: " << p1 << std::endl
00959                 << "  p2: " << p2 << std::endl;
00960       Comparison_result cr = m_object(p1, p2);
00961       std::cout << "  result: " << cr << std::endl;
00962       return cr;
00963     }
00964   };
00965 
00969   class Is_on_x_identification_2 {
00970   private:
00971     typename Base::Is_on_x_identification_2 m_object;
00972     bool m_enabled;
00973     
00974   public:
00976     Is_on_x_identification_2(const Base * base, bool enabled = true) :
00977       m_object(base->is_on_x_identification_2_object()), m_enabled(enabled) {}
00981     Comparison_result operator()(const Point_2 & p) const
00982     {
00983       if (!m_enabled) return m_object(p);
00984       std::cout << "is_on_x_identification" << std::endl
00985                 << "  p: " << p << std::endl;
00986       Comparison_result cr = m_object(p);
00987       std::cout << "  result: " << cr << std::endl;
00988       return cr;
00989     }
00990 
00994     Comparison_result operator()(const X_monotone_curve_2 & xcv) const
00995     {
00996       if (!m_enabled) return m_object(xcv);
00997       std::cout << "is_on_x_identification" << std::endl
00998                 << "  xcv: " << xcv << std::endl;
00999       Comparison_result cr = m_object(xcv);
01000       std::cout << "  result: " << cr << std::endl;
01001       return cr;
01002     }
01003   };
01004 
01008   class Is_on_y_identification_2 {
01009   private:
01010     typename Base::Is_on_y_identification_2 m_object;
01011     bool m_enabled;
01012     
01013   public:
01015     Is_on_y_identification_2(const Base * base, bool enabled = true) :
01016       m_object(base->is_on_y_identification_2_object()), m_enabled(enabled) {}
01020     Comparison_result operator()(const Point_2 & p) const
01021     {
01022       if (!m_enabled) return m_object(p);
01023       std::cout << "is_on_y_identification" << std::endl
01024                 << "  p: " << p << std::endl;
01025       Comparison_result cr = m_object(p);
01026       std::cout << "  result: " << cr << std::endl;
01027       return cr;
01028     }
01029 
01033     Comparison_result operator()(const X_monotone_curve_2 & xcv) const
01034     {
01035       if (!m_enabled) return m_object(xcv);
01036       std::cout << "is_on_y_identification" << std::endl
01037                 << "  xcv: " << xcv << std::endl;
01038       Comparison_result cr = m_object(xcv);
01039       std::cout << "  result: " << cr << std::endl;
01040       return cr;
01041     }
01042   };
01043   
01045 
01047 
01048   Compare_x_2 compare_x_2_object() const
01049   { return Compare_x_2(this, compare_x_op()); }
01050   
01051   Compare_xy_2 compare_xy_2_object() const
01052   { return Compare_xy_2(this, compare_xy_op()); }
01053 
01054   Construct_min_vertex_2 construct_min_vertex_2_object() const
01055   { return Construct_min_vertex_2(this, construct_min_vertex_op()); }
01056 
01057   Construct_max_vertex_2 construct_max_vertex_2_object() const
01058   { return Construct_max_vertex_2(this, construct_max_vertex_op()); }
01059 
01060   Is_vertical_2 is_vertical_2_object() const
01061   { return Is_vertical_2(this, is_vertical_op()); }
01062   
01063   Compare_y_at_x_2 compare_y_at_x_2_object() const
01064   { return Compare_y_at_x_2(this, compare_y_at_x_op()); }
01065   
01066   Equal_2 equal_2_object() const
01067   { return Equal_2(this, equal_points_op(), equal_curves_op()); }
01068 
01069   Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const
01070   { return Compare_y_at_x_left_2(this, compare_y_at_x_left_op()); }
01071 
01072   Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const
01073   { return Compare_y_at_x_right_2(this, compare_y_at_x_right_op()); }
01074   
01075   Make_x_monotone_2 make_x_monotone_2_object() const
01076   { return Make_x_monotone_2(this, make_x_monotone_op()); }
01077 
01078   Split_2 split_2_object() const
01079   { return Split_2(this, split_op()); }
01080 
01081   Intersect_2 intersect_2_object() const
01082   { return Intersect_2(this, intersect_op()); }
01083 
01084   Are_mergeable_2 are_mergeable_2_object() const
01085   { return Are_mergeable_2(this, are_mergeable_op()); }
01086 
01087   Merge_2 merge_2_object() const
01088   { return Merge_2(this, merge_op()); }
01089 
01090   Construct_opposite_2 construct_opposite_2_object() const
01091   { return Construct_opposite_2(this, construct_opposite_op()); }
01092 
01093   Compare_endpoints_xy_2 compare_endpoints_xy_2_object() const
01094   { return Compare_endpoints_xy_2(this, compare_endpoints_xy_op()); }
01095 
01096   Parameter_space_in_x_2 parameter_space_in_x_2_object() const
01097   { return Parameter_space_in_x_2(this, parameter_space_in_x_op()); }
01098 
01099   Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const
01100   { return Compare_y_near_boundary_2(this, compare_y_near_boundary_op()); }
01101 
01102   Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const
01103   {
01104     return Compare_y_on_boundary_2(this, compare_y_on_boundary_op());
01105   }
01106   
01107   Is_on_x_identification_2 is_on_x_identification_2_object() const 
01108   { return Is_on_x_identification_2(this, is_on_x_identification_op()); }
01109   
01110   Parameter_space_in_y_2 parameter_space_in_y_2_object() const
01111   { return Parameter_space_in_y_2(this, parameter_space_in_y_op()); }
01112   
01113   Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const
01114   { return Compare_x_near_boundary_2(this, compare_x_near_boundary_op()); }
01115 
01116   Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const
01117   {
01118     return Compare_x_on_boundary_2(this, compare_x_on_boundary_op());
01119   }
01120   
01121   Is_on_y_identification_2 is_on_y_identification_2_object() const 
01122   { return Is_on_y_identification_2(this, is_on_y_identification_op()); }
01123 
01125 };
01126 
01127 template <class OutputStream>
01128 OutputStream & operator<<(OutputStream & os, Comparison_result cr)
01129 {
01130   os << ((cr == SMALLER) ? "SMALLER" : (cr == EQUAL) ? "EQUAL" : "LARGER");
01131   return os;
01132 }
01133 
01134 CGAL_END_NAMESPACE
01135 
01136 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines