From 8f1118cb8cdb3a019f17770bda6daa30e2fa7680 Mon Sep 17 00:00:00 2001 From: Ophir Setter Date: Tue, 11 Sep 2007 09:46:18 +0000 Subject: [PATCH] Remove include/CGAL/Envelope_3/Arrangement_2_incremental_insert.h --- .../Arrangement_2_incremental_insert.h | 105 ------------------ .../Envelope_3/Envelope_element_visitor_3.h | 52 ++++++++- 2 files changed, 49 insertions(+), 108 deletions(-) delete mode 100644 Envelope_3/include/CGAL/Envelope_3/Arrangement_2_incremental_insert.h diff --git a/Envelope_3/include/CGAL/Envelope_3/Arrangement_2_incremental_insert.h b/Envelope_3/include/CGAL/Envelope_3/Arrangement_2_incremental_insert.h deleted file mode 100644 index d12eba2eb57..00000000000 --- a/Envelope_3/include/CGAL/Envelope_3/Arrangement_2_incremental_insert.h +++ /dev/null @@ -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 -// Baruch Zukerman - -#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 -#include -#include -#include -#include - -#include -#include - -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 -typename Arrangement_2::Vertex_handle -insert_point (Arrangement_2& arr, - const typename Traits::Point_2& p, - const PointLocation& pl, - Visitor& visitor) -{ - // Obtain an arrangement accessor. - typedef Arrangement_2 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 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(&obj)) - != NULL) - { - vh_for_p = visitor.found_point_in_face(p, arr.non_const_handle (*fh)); - } - else if ((hh = - object_cast(&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(&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 diff --git a/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h b/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h index 41553987e26..b0b62070ad4 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h +++ b/Envelope_3/include/CGAL/Envelope_3/Envelope_element_visitor_3.h @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -63,13 +62,17 @@ public: typedef typename Traits::Has_boundary_category Has_boundary_category; protected: + class Copied_face_zone_visitor; typedef Envelope_element_visitor_3 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_handle Halfedge_handle; 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_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_iterator Vertex_iterator; 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 // of the envelope of these surfaces over the edge - - void resolve(Halfedge_handle edge, Minimization_diagram_2& result) { const Xy_monotone_surface_3& surf1 = get_aux_surface(edge, 0); @@ -759,6 +760,44 @@ public: 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(&obj)) + != NULL) + { + vh_for_p = visitor.found_point_in_face(p, arr.non_const_handle (*fh)); + } + else if ((hh = object_cast(&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(&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 // the same answer for all points in face // 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; if (is_face_ok(face)) { + Arr_accessor arr_access (copied_arr); + arr_access.notify_before_global_change(); 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 CGAL_assertion(map_vertices.is_defined(vh_for_p)); @@ -2751,7 +2793,11 @@ protected: X_monotone_curve_2 sub_cv1, sub_cv2; Halfedge_handle split_he; copied_arr.traits()->split_2_object() (he->curve(), p, sub_cv1, sub_cv2); + + Arr_accessor arr_access (copied_arr); + arr_access.notify_before_global_change(); 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 // and this is taken care of in the after_split event