diff --git a/Partition_2/demo/Partition_2/partition_2.cpp b/Partition_2/demo/Partition_2/partition_2.cpp index 433b3a77b2d..387bf93fc2c 100644 --- a/Partition_2/demo/Partition_2/partition_2.cpp +++ b/Partition_2/demo/Partition_2/partition_2.cpp @@ -157,10 +157,9 @@ private slots: void get_new_object(CGAL::Object obj) { - Cgal_Polygon poly; - if (CGAL::assign(poly, obj)) + if (const Cgal_Polygon *poly = CGAL::object_cast(&obj)) { - polygon = poly; + polygon = *poly; something_changed(); } widget->redraw(); diff --git a/Polygon/demo/Polygon/polygon_2.cpp b/Polygon/demo/Polygon/polygon_2.cpp index 89adf417041..0c4575e64be 100644 --- a/Polygon/demo/Polygon/polygon_2.cpp +++ b/Polygon/demo/Polygon/polygon_2.cpp @@ -191,14 +191,12 @@ private slots: void get_new_object(CGAL::Object obj) { - Cgal_Polygon poly; - Point_2 p; - if(CGAL::assign(poly, obj)) { - polygon = poly; + if(const Cgal_Polygon *poly = CGAL::object_cast(&obj)) { + polygon = *poly; something_changed(); show_info(); - } else if(CGAL::assign(p, obj)) { - point = p; + } else if(const Point_2 *p = CGAL::object_cast(&obj)) { + point = *p; is_point_visible = true; show_pinfo(); something_changed();