diff --git a/Segment_Delaunay_graph_2/changes.txt b/Segment_Delaunay_graph_2/changes.txt index ff9e0d6f778..f80c9b56e6b 100644 --- a/Segment_Delaunay_graph_2/changes.txt +++ b/Segment_Delaunay_graph_2/changes.txt @@ -1,5 +1,10 @@ 1 August 2006: Menelaos Karavelas - changed some file names to match the names of the classes they contain +- removed Point_container.h and Simple_container_wrapper.h; these + files are either unused or no longer needed +- modified storage traits to define const_Point_handle as well; + modified Segment_Delaunay_graph_2 class to take all point handles + from storage traits 31 July 2006: Menelaos Karavelas - renamed storage traits related file names and classes; modified test diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h index 0bcf771f1e5..95b5bbcbf07 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2.h @@ -44,7 +44,6 @@ #include #include -#include /* @@ -185,6 +184,8 @@ public: typedef typename DS::Vertex Vertex; typedef typename DS::Face Face; + typedef typename DS::size_type size_type; + typedef typename DS::Vertex_circulator Vertex_circulator; typedef typename DS::Edge_circulator Edge_circulator; typedef typename DS::Face_circulator Face_circulator; @@ -197,30 +198,29 @@ public: typedef typename DG::Finite_vertices_iterator Finite_vertices_iterator; typedef typename DG::Finite_edges_iterator Finite_edges_iterator; + typedef typename Storage_traits::Point_container Point_container; + typedef typename Storage_traits::Point_handle Point_handle; + typedef typename Storage_traits::const_Point_handle const_Point_handle; + protected: typedef typename Geom_traits::Arrangement_type_2 AT2; typedef typename AT2::Arrangement_type Arrangement_type; - typedef typename Storage_traits::Point_container PC; - typedef typename Storage_traits::Point_handle PH; - - // these containers should have point handles and should replace the // point container... - typedef boost::tuples::tuple Site_rep_2; - // typedef Triple Site_rep_2; + typedef boost::tuples::tuple Site_rep_2; struct Site_rep_less_than { // less than for site reps bool operator()(const Site_rep_2& x, const Site_rep_2& y) const { - PH x1 = boost::tuples::get<0>(x); - PH y1 = boost::tuples::get<0>(y); + Point_handle x1 = boost::tuples::get<0>(x); + Point_handle y1 = boost::tuples::get<0>(y); if ( &(*x1) < &(*y1) ) { return true; } if ( &(*y1) < &(*x1) ) { return false; } - PH x2 = boost::tuples::get<1>(x); - PH y2 = boost::tuples::get<1>(y); + Point_handle x2 = boost::tuples::get<1>(x); + Point_handle y2 = boost::tuples::get<1>(y); return &(*x2) < &(*y2); } @@ -235,18 +235,9 @@ protected: Project_input_to_site_2 Proj_input_to_site; -public: - typedef Simple_container_wrapper Point_container; - typedef typename Point_container::iterator Point_handle; - - typedef typename DS::size_type size_type; - -protected: typedef CGAL_SEGMENT_DELAUNAY_GRAPH_2_NS::Internal::Project_site_2 Proj_site; - typedef typename Point_container::const_iterator const_Point_handle; - struct Point_handle_less_than { // less than bool operator()(const const_Point_handle& x, @@ -810,7 +801,7 @@ protected: typename Input_sites_container::iterator it = isc_.find(rep); CGAL_assertion( it != isc_.end() ); - pc_.remove(h); + pc_.erase(h); isc_.erase(it); } @@ -837,7 +828,7 @@ protected: inline Point_handle register_input_site(const Point_2& p) { - std::pair it = pc_.insert(p); + std::pair it = pc_.insert(p); Site_rep_2 rep(it.first, it.first, true); isc_.insert( rep ); return it.first; @@ -846,8 +837,8 @@ protected: inline Point_handle_pair register_input_site(const Point_2& p0, const Point_2& p1) { - std::pair it1 = pc_.insert(p0); - std::pair it2 = pc_.insert(p1); + std::pair it1 = pc_.insert(p0); + std::pair it2 = pc_.insert(p1); Site_rep_2 rep(it1.first, it2.first, false); isc_.insert( rep ); return Point_handle_pair(it1.first, it2.first); diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Point_container.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Point_container.h deleted file mode 100644 index d6fca5214dc..00000000000 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Point_container.h +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2003,2004,2005,2006 INRIA Sophia-Antipolis (France) and -// Notre Dame University (U.S.A.). All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Menelaos Karavelas - - -#ifndef CGAL_SEGMENT_DELAUNAY_GRAPH_2_POINT_CONTAINER_H -#define CGAL_SEGMENT_DELAUNAY_GRAPH_2_POINT_CONTAINER_H - -#include -#include -#include - -CGAL_BEGIN_NAMESPACE - -template > -class Point_container -{ -public: - typedef C Container; - typedef P Point_2; - typedef typename Container::iterator Point_handle; - typedef typename Container::size_type size_type; - -private: - typedef Point_container Self; - -public: - Point_container() {} - - Point_handle insert(const Point_2& p) - { - c.push_back(p); - return --c.end(); - } - - void remove(Point_handle handle) - { - c.erase(handle); - } - - void swap(const Self& other) - { - c.swap(other.c); - } - - void clear() { - c.clear(); - } - - size_type size() const { return c.size(); } - -private: - Container c; -}; - -#if 1 -template -class Array_point_container -{ -public: - // typedef C Container; - typedef P Point_2; - enum { Size = S }; - typedef Point_2* Point_handle; - typedef unsigned long size_type; - - Array_point_container() { - last = 0; - c = new Point_2[Size]; - } - - Point_handle insert(const Point_2& p) - { - CGAL_precondition( last < Size ); - - c[last] = p; - Point_handle h = &c[last]; - last++; - return h; - } - - std::size_t size() const { return c.size(); } - - void clear() { - last = 0; - } - -private: - unsigned long last; - Point_2* c; -}; -#endif - -CGAL_END_NAMESPACE - -#endif // CGAL_SEGMENT_DELAUNAY_GRAPH_2_POINT_CONTAINER_H diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Simple_container_wrapper.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Simple_container_wrapper.h deleted file mode 100644 index 77fb0941b86..00000000000 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Simple_container_wrapper.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2003,2004,2005,2006 INRIA Sophia-Antipolis (France) and -// Notre Dame University (U.S.A.). All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Menelaos Karavelas - - -#ifndef CGAL_SEGMENT_DELAUNAY_GRAPH_2_SIMPLE_CONTAINER_WRAPPER_H -#define CGAL_SEGMENT_DELAUNAY_GRAPH_2_SIMPLE_CONTAINER_WRAPPER_H - -#include -#include - - -CGAL_BEGIN_NAMESPACE - -template -class Simple_container_wrapper -{ -public: - typedef C Container; - typedef typename Container::value_type value_type; - typedef typename Container::iterator iterator; - typedef typename Container::const_iterator const_iterator; - typedef typename Container::size_type size_type; - -private: - typedef Simple_container_wrapper Self; - -public: - Simple_container_wrapper(const Container& c = Container()) - : c(c) {} - - iterator begin() { return c.begin(); } - iterator end() { return c.end(); } - - const_iterator begin() const { return c.begin(); } - const_iterator end() const { return c.end(); } - - std::pair insert(const value_type& t) - { - // std::pair it_b = c.insert(t); - // return it_b.first; -#if 1 - return c.insert(t); -#else - c.push_back(t); - return std::pair(--c.end(), true); -#endif - } - - const_iterator find(const value_type& t) const { - return c.find(t); - } - - bool remove(const value_type& t) - { - iterator it = c.find(t); - if ( it == c.end() ) { return false; } - c.erase(it); - return true; - } - - void remove(iterator it) - { - c.erase(it); - } - - void swap(Self& other) - { - c.swap(other.c); - } - - void clear() { - c.clear(); - } - - size_type size() const { return c.size(); } - -private: - Container c; -}; - - -CGAL_END_NAMESPACE - -#endif // CGAL_SEGMENT_DELAUNAY_GRAPH_2_SIMPLE_CONTAINER_WRAPPER_H diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_storage_traits_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_storage_traits_2.h index 8bba8aa6e36..0f8ae30dafe 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_storage_traits_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_storage_traits_2.h @@ -77,6 +77,7 @@ public: typedef typename Geom_traits::Site_2 Site_2; typedef std::set Point_container; typedef typename Point_container::iterator Point_handle; + typedef typename Point_container::const_iterator const_Point_handle; private: typedef Segment_Delaunay_graph_storage_traits_2 Self;