Remove include/CGAL/Envelope_3/Arrangement_2_incremental_insert.h

This commit is contained in:
Ophir Setter 2007-09-11 09:46:18 +00:00
parent 97190dbc75
commit 8f1118cb8c
2 changed files with 49 additions and 108 deletions

View File

@ -1,105 +0,0 @@
// Copyright (c) 2005 Tel-Aviv University (Israel).
// 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) : Michal Meyerovitch <gorgymic@post.tau.ac.il>
// Baruch Zukerman <baruchzu@post.tau.ac.il>
#ifndef CGAL_ARRANGEMENT_2_INCREMENTAL_INSERT_H
#define CGAL_ARRANGEMENT_2_INCREMENTAL_INSERT_H
/*! \file
* Global incremental insertion function for the Arrangement_2 class
* with Zone Visitor parameter.
*/
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <CGAL/Arr_accessor.h>
#include <CGAL/Arrangement_zone_2.h>
#include <CGAL/Arr_topology_traits/Arr_planar_inc_insertion_zone_visitor.h>
#include <list>
#include <map>
CGAL_BEGIN_NAMESPACE
//-----------------------------------------------------------------------------
// Insert a vertex that corresponds to a given point into the arrangement.
// The inserted point may lie on any existing arrangement feature.
// Use the given visitor to actually change the arrangement.
// The visitor's methods should return the Vertex_handle of the new vertex,
// if one was created, or an invalid handle, if a vertex wasn't created.
//
template <class Traits, class Dcel, class PointLocation, class Visitor>
typename Arrangement_2<Traits,Dcel>::Vertex_handle
insert_point (Arrangement_2<Traits,Dcel>& arr,
const typename Traits::Point_2& p,
const PointLocation& pl,
Visitor& visitor)
{
// Obtain an arrangement accessor.
typedef Arrangement_2<Traits,Dcel> Arrangement_2;
// Act according to the type of arrangement feature that contains the point.
const typename Arrangement_2::Face_const_handle *fh;
const typename Arrangement_2::Halfedge_const_handle *hh;
const typename Arrangement_2::Vertex_const_handle *vh;
typename Arrangement_2::Vertex_handle vh_for_p;
Arr_accessor<Arrangement_2> arr_access (arr);
// Locate the given point in the arrangement.
CGAL::Object obj = pl.locate (p);
// Notify the arrangement observers that a global operation is about to
// take place.
arr_access.notify_before_global_change();
visitor.init(&arr);
if ((fh = object_cast<typename Arrangement_2::Face_const_handle>(&obj))
!= NULL)
{
vh_for_p = visitor.found_point_in_face(p, arr.non_const_handle (*fh));
}
else if ((hh =
object_cast<typename Arrangement_2::Halfedge_const_handle>(&obj))
!= NULL)
{
vh_for_p = visitor.found_point_on_edge(p , arr.non_const_handle (*hh));
}
else
{
// In this case p lies on an existing vertex, so we just update this
// vertex.
vh = object_cast<typename Arrangement_2::Vertex_const_handle>(&obj);
CGAL_assertion (vh != NULL);
vh_for_p = visitor.found_point_on_vertex(p, arr.non_const_handle (*vh));
}
// Notify the arrangement observers that the global operation has been
// completed.
arr_access.notify_after_global_change();
// Return a handle for the vertex associated with p.
return (vh_for_p);
}
CGAL_END_NAMESPACE
#endif

View File

@ -27,7 +27,6 @@
#include <CGAL/Arr_accessor.h> #include <CGAL/Arr_accessor.h>
#include <CGAL/Arr_walk_along_line_point_location.h> #include <CGAL/Arr_walk_along_line_point_location.h>
#include <CGAL/Arr_naive_point_location.h> #include <CGAL/Arr_naive_point_location.h>
#include <CGAL/Envelope_3/Arrangement_2_incremental_insert.h>
#include <CGAL/utility.h> #include <CGAL/utility.h>
#include <CGAL/functions_on_enums.h> #include <CGAL/functions_on_enums.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h> #include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
@ -63,13 +62,17 @@ public:
typedef typename Traits::Has_boundary_category Has_boundary_category; typedef typename Traits::Has_boundary_category Has_boundary_category;
protected: protected:
class Copied_face_zone_visitor;
typedef Envelope_element_visitor_3<Traits, Minimization_diagram_2> Self; typedef Envelope_element_visitor_3<Traits, Minimization_diagram_2> Self;
typedef typename Minimization_diagram_2::Halfedge_const_handle Halfedge_const_handle;
typedef typename Minimization_diagram_2::Halfedge_const_iterator Halfedge_const_iterator; typedef typename Minimization_diagram_2::Halfedge_const_iterator Halfedge_const_iterator;
typedef typename Minimization_diagram_2::Halfedge_handle Halfedge_handle; typedef typename Minimization_diagram_2::Halfedge_handle Halfedge_handle;
typedef typename Minimization_diagram_2::Halfedge_iterator Halfedge_iterator; typedef typename Minimization_diagram_2::Halfedge_iterator Halfedge_iterator;
typedef typename Minimization_diagram_2::Face_const_handle Face_const_handle;
typedef typename Minimization_diagram_2::Face_handle Face_handle; typedef typename Minimization_diagram_2::Face_handle Face_handle;
typedef typename Minimization_diagram_2::Face_iterator Face_iterator; typedef typename Minimization_diagram_2::Face_iterator Face_iterator;
typedef typename Minimization_diagram_2::Vertex_const_handle Vertex_const_handle;
typedef typename Minimization_diagram_2::Vertex_handle Vertex_handle; typedef typename Minimization_diagram_2::Vertex_handle Vertex_handle;
typedef typename Minimization_diagram_2::Vertex_iterator Vertex_iterator; typedef typename Minimization_diagram_2::Vertex_iterator Vertex_iterator;
typedef typename Minimization_diagram_2::Ccb_halfedge_circulator Ccb_halfedge_circulator; typedef typename Minimization_diagram_2::Ccb_halfedge_circulator Ccb_halfedge_circulator;
@ -454,8 +457,6 @@ public:
// get an edge with 2 surfaces defined over it, and split it to get the shape // get an edge with 2 surfaces defined over it, and split it to get the shape
// of the envelope of these surfaces over the edge // of the envelope of these surfaces over the edge
void resolve(Halfedge_handle edge, Minimization_diagram_2& result) void resolve(Halfedge_handle edge, Minimization_diagram_2& result)
{ {
const Xy_monotone_surface_3& surf1 = get_aux_surface(edge, 0); const Xy_monotone_surface_3& surf1 = get_aux_surface(edge, 0);
@ -759,6 +760,44 @@ public:
protected: protected:
// The function locate p in arr, and calls the appropriate function in
// visitor.
Vertex_handle insert_point (Minimization_diagram_2& arr, const Point_2& p,
const Md_point_location& pl,
Copied_face_zone_visitor& visitor)
{
const Face_const_handle *fh;
const Halfedge_const_handle *hh;
const Vertex_const_handle *vh;
Vertex_handle vh_for_p;
CGAL::Object obj = pl.locate (p);
visitor.init(&arr);
if ((fh = object_cast<Face_const_handle>(&obj))
!= NULL)
{
vh_for_p = visitor.found_point_in_face(p, arr.non_const_handle (*fh));
}
else if ((hh = object_cast<Halfedge_const_handle>(&obj)) != NULL)
{
vh_for_p = visitor.found_point_on_edge(p , arr.non_const_handle (*hh));
}
else
{
// In this case p lies on an existing vertex, so we just update this
// vertex.
vh = object_cast<Vertex_const_handle>(&obj);
CGAL_assertion (vh != NULL);
vh_for_p = visitor.found_point_on_vertex(p, arr.non_const_handle (*vh));
}
// Return a handle for the vertex associated with p.
return (vh_for_p);
}
// compute Comparison_result of surfaces over the face, assuming they get // compute Comparison_result of surfaces over the face, assuming they get
// the same answer for all points in face // the same answer for all points in face
// if we get a halfedge, it is assumed to be on the outer boundary of the // if we get a halfedge, it is assumed to be on the outer boundary of the
@ -2722,7 +2761,10 @@ protected:
Vertex_handle vh_for_p; Vertex_handle vh_for_p;
if (is_face_ok(face)) if (is_face_ok(face))
{ {
Arr_accessor<Minimization_diagram_2> arr_access (copied_arr);
arr_access.notify_before_global_change();
vh_for_p = copied_arr.insert_in_face_interior(p, face); vh_for_p = copied_arr.insert_in_face_interior(p, face);
arr_access.notify_after_global_change();
// now should set the is_equal and has_equal flags // now should set the is_equal and has_equal flags
CGAL_assertion(map_vertices.is_defined(vh_for_p)); CGAL_assertion(map_vertices.is_defined(vh_for_p));
@ -2751,7 +2793,11 @@ protected:
X_monotone_curve_2 sub_cv1, sub_cv2; X_monotone_curve_2 sub_cv1, sub_cv2;
Halfedge_handle split_he; Halfedge_handle split_he;
copied_arr.traits()->split_2_object() (he->curve(), p, sub_cv1, sub_cv2); copied_arr.traits()->split_2_object() (he->curve(), p, sub_cv1, sub_cv2);
Arr_accessor<Minimization_diagram_2> arr_access (copied_arr);
arr_access.notify_before_global_change();
split_he = copied_arr.split_edge (he, sub_cv1, sub_cv2); split_he = copied_arr.split_edge (he, sub_cv1, sub_cv2);
arr_access.notify_after_global_change();
// if the edge is a boundary edge, then the new vertex is a special vertex // if the edge is a boundary edge, then the new vertex is a special vertex
// and this is taken care of in the after_split event // and this is taken care of in the after_split event