|
BWAPI
|
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/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_merge.h $ 00015 // $Id: Gps_merge.h 50368 2009-07-05 13:14:14Z efif $ $Date: 2009-07-05 15:14:14 +0200 (Sun, 05 Jul 2009) $ 00016 // 00017 // 00018 // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> 00019 00020 #ifndef CGAL_GPS_MERGE_H 00021 #define CGAL_GPS_MERGE_H 00022 00023 #include <CGAL/Boolean_set_operations_2/Gps_agg_op.h> 00024 #include <CGAL/Boolean_set_operations_2/Gps_bfs_join_visitor.h> 00025 #include <CGAL/Boolean_set_operations_2/Gps_bfs_xor_visitor.h> 00026 #include <CGAL/Boolean_set_operations_2/Gps_bfs_intersection_visitor.h> 00027 #include <vector> 00028 00029 CGAL_BEGIN_NAMESPACE 00030 00041 00042 00046 template <class Arrangement_, class Visitor_> 00047 class Base_merge 00048 { 00049 typedef Arrangement_ Arrangement_2; 00050 typedef Visitor_ Visitor; 00051 typedef typename Arrangement_2::Vertex_handle Vertex_handle; 00052 typedef std::pair<Arrangement_2 *, 00053 std::vector<Vertex_handle> *> Arr_entry; 00054 00055 public: 00056 void operator()(unsigned int i, 00057 unsigned int j, 00058 unsigned int jump, 00059 std::vector<Arr_entry>& arr_vec) 00060 { 00061 if(i==j) 00062 return; 00063 00064 const typename Arrangement_2::Geometry_traits_2 * tr = 00065 arr_vec[i].first->geometry_traits(); 00066 Arrangement_2 *res = new Arrangement_2(tr); 00067 std::vector<Vertex_handle> *verts = new std::vector<Vertex_handle>; 00068 00069 Gps_agg_op<Arrangement_2, Visitor> 00070 agg_op(*res, *verts, *(res->traits_adaptor())); 00071 agg_op.sweep_arrangements(i, j, jump, arr_vec); 00072 00073 for(unsigned int count=i; count<=j; count+=jump) 00074 { 00075 delete (arr_vec[count].first); 00076 delete (arr_vec[count].second); 00077 } 00078 00079 arr_vec[i].first = res; 00080 arr_vec[i].second = verts; 00081 } 00082 00083 }; 00084 00086 00089 template <class Arrangement_> 00090 class Join_merge : public Base_merge<Arrangement_, 00091 Gps_bfs_join_visitor<Arrangement_> > 00092 {}; 00093 00094 00096 00099 template <class Arrangement_> 00100 class Intersection_merge : public Base_merge<Arrangement_, 00101 Gps_bfs_intersection_visitor<Arrangement_> > 00102 {}; 00103 00105 00108 template <class Arrangement_> 00109 class Xor_merge : public Base_merge<Arrangement_, 00110 Gps_bfs_xor_visitor<Arrangement_> > 00111 { 00112 }; 00113 00114 CGAL_END_NAMESPACE 00115 00116 #endif
1.7.6.1