diff --git a/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp b/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp index e3fca6eef0b..f0eb9086215 100644 --- a/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp @@ -929,8 +929,7 @@ private: SMesh& smesh = *item->face_graph(); - const auto vnm = smesh.property_map("v:normal_before_perturbation").value(); - const bool vnm_exists = smesh.property_map("v:normal_before_perturbation").has_value(); + auto vnm = smesh.property_map("v:normal_before_perturbation"); // compute once and store the value per vertex bool non_init; @@ -938,21 +937,21 @@ private: std::tie(mu_i_map, non_init) = smesh.add_property_map(tied_string, 0); if(non_init || expand_radius_updated) { - if(vnm_exists) + if(vnm.has_value()) { if(mu_index == MEAN_CURVATURE) { PMP::interpolated_corrected_curvatures(smesh, CGAL::parameters::vertex_mean_curvature_map(mu_i_map) .ball_radius(expand_radius) - .vertex_normal_map(vnm)); + .vertex_normal_map(vnm.value())); } else { PMP::interpolated_corrected_curvatures(smesh, CGAL::parameters::vertex_Gaussian_curvature_map(mu_i_map) .ball_radius(expand_radius) - .vertex_normal_map(vnm)); + .vertex_normal_map(vnm.value())); } } else diff --git a/Lab/demo/Lab/Scene_surface_mesh_item.cpp b/Lab/demo/Lab/Scene_surface_mesh_item.cpp index 99ff4d4f96c..5c021784cd1 100644 --- a/Lab/demo/Lab/Scene_surface_mesh_item.cpp +++ b/Lab/demo/Lab/Scene_surface_mesh_item.cpp @@ -436,11 +436,12 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: SMesh::Property_map positions = smesh_->points(); - SMesh::Property_map vcolors = - smesh_->property_map("v:color").value(); + auto vcolors = smesh_->property_map("v:color"); - SMesh::Property_map fcolors = - smesh_->property_map("f:color").value(); + auto fcolors = smesh_->property_map("f:color"); + + has_fcolors = fcolors.has_value(); + has_vcolors = vcolors.has_value(); boost::property_map< SMesh, boost::vertex_index_t >::type im = get(boost::vertex_index, *smesh_); @@ -499,10 +500,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: if(name.testFlag(Scene_item_rendering_helper::COLORS)) { - has_fpatch_id = smesh_->property_map("f:patch_id").has_value(); - has_fcolors = smesh_->property_map("f:color").has_value(); - has_vcolors = smesh_->property_map("v:color").has_value(); } if(name.testFlag(Scene_item_rendering_helper::GEOMETRY)) { @@ -562,7 +560,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: } else if(has_fcolors) { - CGAL::IO::Color c = fcolors[fd]; + CGAL::IO::Color c = fcolors.value()[fd]; CPF::add_color_in_buffer(c, f_colors); } } @@ -589,7 +587,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: c = new CGAL::IO::Color(color.red(),color.green(),color.blue()); } else if(has_fcolors) - c= &fcolors[fd]; + c= &(fcolors.value()[fd]); else c = nullptr; addFlatData(p,n,c, name); @@ -628,11 +626,11 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: } else if(is_convex) { - triangulate_convex_facet(fd, &fnormals, &fcolors, nullptr, name, false); + triangulate_convex_facet(fd, &fnormals, &fcolors.value(), nullptr, name, false); } else { - triangulate_facet(fd, &fnormals, &fcolors, nullptr, name, false); + triangulate_facet(fd, &fnormals, &fcolors.value(), nullptr, name, false); } } } @@ -641,7 +639,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: { for(vertex_descriptor vd : vertices(*smesh_)) { - CGAL::IO::Color c = vcolors[vd]; + CGAL::IO::Color c = vcolors.value()[vd]; v_colors.push_back(static_cast(c.red())/255); v_colors.push_back(static_cast(c.green())/255); v_colors.push_back(static_cast(c.blue())/255); @@ -2530,7 +2528,7 @@ void Scene_surface_mesh_item::fill_flat_vertex_map() return; SMesh::Property_map fnormals = - face_graph()->property_map("f:normal").value(); + face_graph()->add_property_map("f:normal").first; d->flat_vertices_map.clear(); d->flat_vertices_map.resize(face_graph()->number_of_vertices());