Using Aos_2 insert function

This commit is contained in:
Ophir Setter 2007-09-11 07:51:44 +00:00
parent 3ba205339e
commit e22e676d42
2 changed files with 4 additions and 91 deletions

View File

@ -37,95 +37,6 @@
CGAL_BEGIN_NAMESPACE
//-----------------------------------------------------------------------------
// Insert a curve into the arrangement (incremental insertion).
// The inserted x-monotone curve may intersect the existing arrangement.
// Use the given zone visitor.
//
template <class Traits, class Dcel, class PointLocation, class ZoneVisitor>
void insert_x_monotone_curve (Arrangement_2<Traits,Dcel>& arr,
const typename Traits::X_monotone_curve_2& c,
const PointLocation& pl,
ZoneVisitor& visitor)
{
// Obtain an arrangement accessor.
typedef Arrangement_2<Traits,Dcel> Arrangement_2;
Arr_accessor<Arrangement_2> arr_access (arr);
Arrangement_zone_2<Arrangement_2, ZoneVisitor> arr_zone (arr, &visitor);
arr_zone.init (c, pl);
// Notify the arrangement observers that a global operation is about to
// take place.
arr_access.notify_before_global_change();
// Insert the current x-monotone curve into the arrangement.
arr_zone.compute_zone();
// Notify the arrangement observers that the global operation has been
// completed.
arr_access.notify_after_global_change();
//// Break the input curve into x-monotone subcurves and isolated points.
//typedef Arr_traits_adaptor_2<Traits> Traits_wrapper_2;
//Traits_wrapper_2 *traits =
// static_cast<Traits_wrapper_2*>(arr.get_traits());
//std::list<Object> x_objects;
//std::list<Object>::const_iterator obj_iter;
//typename Traits::X_monotone_curve_2 x_curve;
//typename Traits::Point_2 iso_p;
//Object obj;
//bool assign_success;
/* traits->make_x_monotone_2_object() (c,
std::back_inserter (x_objects));*/
//// Insert each x-monotone curve into the arrangement.
//for (obj_iter = x_objects.begin(); obj_iter != x_objects.end(); ++obj_iter)
//{
// // Act according to the type of the current object.
// if (assign (x_curve, *obj_iter))
// {
// // Inserting an x-monotone curve:
// // Initialize the zone-computation object with the given curve.
// arr_zone.init (x_curve, pl);
// // Notify the arrangement observers that a global operation is about to
// // take place.
// arr_access.notify_before_global_change();
// // Insert the current x-monotone curve into the arrangement.
// arr_zone.compute_zone();
// // Notify the arrangement observers that the global operation has been
// // completed.
// arr_access.notify_after_global_change();
// }
// else
// {
// assign_success = assign (iso_p, *obj_iter);
// CGAL_assertion (assign_success);
// if (! assign_success)
// continue;
// // Inserting a point into the arrangement:
// //insert_vertex (arr, iso_p, pl);
// // we use the version with the visitor
// insert_point(arr, iso_p, pl, visitor);
//
// }
//}
return;
}
//-----------------------------------------------------------------------------
// Insert a vertex that corresponds to a given point into the arrangement.
// The inserted point may lie on any existing arrangement feature.

View File

@ -284,7 +284,7 @@ public:
else if (assign(curve, cur_obj))
{
zone_visitor.set_current_intersection_type(curve.second);
insert_x_monotone_curve(copied_face_arr, curve.first, pl, zone_visitor);
insert (copied_face_arr, curve.first, pl, zone_visitor);
}
else
CGAL_assertion_msg(false, "wrong projected intersection type");
@ -2443,8 +2443,10 @@ protected:
// the zone visitor functions
/*! Initialize the visitor with an arrangement object. */
void init (Minimization_diagram_2 *arr)
void init (typename Minimization_diagram_2::Base *base_arr)
{
Minimization_diagram_2 *arr =
dynamic_cast<Minimization_diagram_2*>(base_arr);
CGAL_assertion(&copied_arr == arr);
insert_visitor.init(arr);
}