mirror of https://github.com/CGAL/cgal
Merge pull request #4052 from maxGimeno/Demo-Fixes-GF
Polyhedron_Demo: Fixes
This commit is contained in:
commit
81ff26797b
|
|
@ -195,8 +195,8 @@ namespace CGAL {
|
|||
if(size() > 1)
|
||||
return root_node()->bbox();
|
||||
else
|
||||
return AABB_traits().compute_bbox_object()(m_primitives.begin(),
|
||||
m_primitives.end());
|
||||
return traits().compute_bbox_object()(m_primitives.begin(),
|
||||
m_primitives.end());
|
||||
}
|
||||
|
||||
/// Returns the number of primitives in the tree.
|
||||
|
|
|
|||
|
|
@ -362,6 +362,11 @@ add_executable ( CGAL_Classification Classification.cpp )
|
|||
add_dependencies(CGAL_Classification Classification)
|
||||
target_link_libraries( CGAL_Classification PRIVATE polyhedron_demo )
|
||||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS CGAL_Classification )
|
||||
|
||||
add_executable ( CGAL_PMP PMP.cpp )
|
||||
add_dependencies(CGAL_PMP PMP)
|
||||
target_link_libraries( CGAL_PMP PRIVATE polyhedron_demo )
|
||||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS CGAL_PMP )
|
||||
#
|
||||
# Exporting
|
||||
#
|
||||
|
|
|
|||
|
|
@ -383,14 +383,38 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren
|
|||
connect(ui->menuOperations, SIGNAL(aboutToShow()), this, SLOT(filterOperations()));
|
||||
}
|
||||
|
||||
void addActionToMenu(QAction* action, QMenu* menu)
|
||||
{
|
||||
bool added = false;
|
||||
for(QAction* it : menu->actions())
|
||||
{
|
||||
QString atxt = action->text().remove("&"),
|
||||
btxt = it->text().remove("&");
|
||||
int i = 0;
|
||||
while(atxt[i] == btxt[i]
|
||||
&& i < atxt.size()
|
||||
&& i < btxt.size())
|
||||
++i;
|
||||
bool res = (atxt[i] < btxt[i]);
|
||||
if (res)
|
||||
{
|
||||
menu->insertAction(it, action);
|
||||
added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!added)
|
||||
menu->addAction(action);
|
||||
}
|
||||
|
||||
//Recursive function that do a pass over a menu and its sub-menus(etc.) and hide them when they are empty
|
||||
void filterMenuOperations(QMenu* menu, QString filter, bool keep_from_here)
|
||||
{
|
||||
QList<QAction*> buffer;
|
||||
Q_FOREACH(QAction* action, menu->actions())
|
||||
buffer.append(action);
|
||||
|
||||
while(!buffer.isEmpty()){
|
||||
|
||||
Q_FOREACH(QAction* action, buffer) {
|
||||
if(QMenu* submenu = action->menu())
|
||||
{
|
||||
|
|
@ -407,14 +431,17 @@ void filterMenuOperations(QMenu* menu, QString filter, bool keep_from_here)
|
|||
}
|
||||
else
|
||||
{
|
||||
menu->addAction(submenu->menuAction());
|
||||
//menu->addAction(submenu->menuAction());
|
||||
addActionToMenu(submenu->menuAction(), menu);
|
||||
}
|
||||
}
|
||||
filterMenuOperations(submenu, filter, keep);
|
||||
action->setVisible(!(submenu->isEmpty()));
|
||||
|
||||
}
|
||||
else if(action->text().contains(filter, Qt::CaseInsensitive)){
|
||||
menu->addAction(action);
|
||||
//menu->addAction(action);
|
||||
addActionToMenu(action, menu);
|
||||
}
|
||||
buffer.removeAll(action);
|
||||
}
|
||||
|
|
@ -432,14 +459,17 @@ void MainWindow::filterOperations()
|
|||
menu->removeAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
Q_FOREACH(QAction* action, action_menu_map.keys())
|
||||
{
|
||||
action_menu_map[action]->addAction(action);
|
||||
QMenu* menu = action_menu_map[action];
|
||||
addActionToMenu(action, menu);
|
||||
}
|
||||
|
||||
QString filter=operationSearchBar.text();
|
||||
Q_FOREACH(const PluginNamePair& p, plugins) {
|
||||
Q_FOREACH(QAction* action, p.first->actions()) {
|
||||
action->setVisible( p.first->applicable(action)
|
||||
action->setVisible( p.first->applicable(action)
|
||||
&& (action->text().contains(filter, Qt::CaseInsensitive)
|
||||
|| action->property("subMenuName")
|
||||
.toString().contains(filter, Qt::CaseInsensitive)));
|
||||
|
|
@ -447,6 +477,7 @@ void MainWindow::filterOperations()
|
|||
}
|
||||
// do a pass over all menus in Operations and their sub-menus(etc.) and hide them when they are empty
|
||||
filterMenuOperations(ui->menuOperations, filter, false);
|
||||
|
||||
operationSearchBar.setFocus();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
#include "Polyhedron_demo.h"
|
||||
#include <clocale>
|
||||
#include <CGAL/Qt/resources.h>
|
||||
#include <QSurfaceFormat>
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Defines the entry point of the demo.
|
||||
* Creates the application and sets a main window.
|
||||
*/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QSurfaceFormat fmt;
|
||||
|
||||
fmt.setVersion(4, 3);
|
||||
fmt.setRenderableType(QSurfaceFormat::OpenGL);
|
||||
fmt.setProfile(QSurfaceFormat::CoreProfile);
|
||||
fmt.setOption(QSurfaceFormat::DebugContext);
|
||||
QSurfaceFormat::setDefaultFormat(fmt);
|
||||
QStringList keywords;
|
||||
keywords << "PMP";
|
||||
Polyhedron_demo app(argc, argv,
|
||||
"PMP demo",
|
||||
"CGAL Polygon Mesh Processing Demo",
|
||||
keywords);
|
||||
//We set the locale to avoid any trouble with VTK
|
||||
std::setlocale(LC_ALL, "C");
|
||||
return app.try_exec();
|
||||
}
|
||||
|
|
@ -1073,7 +1073,7 @@ void Polyhedron_demo_cut_plugin::apply(Item* item, QMap< QObject*, Facets_tree*>
|
|||
traits.set_shared_data(mesh, pmap); //Mandatory for SMesh. If not provided, mesh and PPmap are taken default, saying NULL in tree.traversal().
|
||||
connect(item, SIGNAL(item_is_about_to_be_changed()),
|
||||
this, SLOT(deleteTree()));
|
||||
f_trees[item] = new Facets_tree(traits);
|
||||
Facets_tree* new_tree = new Facets_tree(traits);
|
||||
//filter facets to ignore degenerated ones
|
||||
|
||||
for(typename boost::graph_traits<Mesh>::face_iterator fit = faces(mesh).first,
|
||||
|
|
@ -1085,10 +1085,10 @@ void Polyhedron_demo_cut_plugin::apply(Item* item, QMap< QObject*, Facets_tree*>
|
|||
c(get(pmap, target(prev(halfedge(*fit, mesh), mesh), mesh)));
|
||||
|
||||
if(!CGAL::collinear(a,b,c))
|
||||
f_trees[item]->insert(typename Facets_tree::Primitive(fit, mesh, pmap));
|
||||
new_tree->insert(typename Facets_tree::Primitive(fit, mesh, pmap));
|
||||
}
|
||||
|
||||
Scene_aabb_item* aabb_item = new Scene_aabb_item(*f_trees[item]);
|
||||
Scene_aabb_item* aabb_item = new Scene_aabb_item(*new_tree);
|
||||
f_trees[item] = new_tree;
|
||||
aabb_item->setName(tr("AABB tree of %1").arg(item->name()));
|
||||
aabb_item->setRenderingMode(Wireframe);
|
||||
aabb_item->setColor(Qt::black);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ target_link_libraries(io_implicit_function_plugin PUBLIC scene_implicit_function
|
|||
polyhedron_demo_plugin(nef_io_plugin Nef_io_plugin KEYWORDS IO)
|
||||
target_link_libraries(nef_io_plugin PUBLIC scene_nef_polyhedron_item)
|
||||
|
||||
polyhedron_demo_plugin(off_plugin OFF_io_plugin KEYWORDS IO Mesh_3 PointSetProcessing Classification)
|
||||
polyhedron_demo_plugin(off_plugin OFF_io_plugin KEYWORDS IO Mesh_3 PointSetProcessing Classification PMP)
|
||||
target_link_libraries(off_plugin PUBLIC scene_polygon_soup_item scene_points_with_normal_item scene_surface_mesh_item)
|
||||
|
||||
polyhedron_demo_plugin(off_to_nef_plugin OFF_to_nef_io_plugin KEYWORDS IO)
|
||||
|
|
@ -19,11 +19,11 @@ target_link_libraries(off_to_nef_plugin PUBLIC scene_nef_polyhedron_item)
|
|||
polyhedron_demo_plugin(polylines_io_plugin Polylines_io_plugin KEYWORDS IO Mesh_3)
|
||||
target_link_libraries(polylines_io_plugin PUBLIC scene_polylines_item)
|
||||
|
||||
polyhedron_demo_plugin(stl_plugin STL_io_plugin KEYWORDS IO)
|
||||
polyhedron_demo_plugin(stl_plugin STL_io_plugin KEYWORDS IO PMP)
|
||||
target_link_libraries(stl_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item)
|
||||
|
||||
|
||||
polyhedron_demo_plugin(surf_io_plugin Surf_io_plugin KEYWORDS IO)
|
||||
polyhedron_demo_plugin(surf_io_plugin Surf_io_plugin KEYWORDS IO PMP)
|
||||
target_link_libraries(surf_io_plugin PUBLIC scene_surface_mesh_item)
|
||||
|
||||
polyhedron_demo_plugin(lcc_io_plugin lcc_io_plugin KEYWORDS IO)
|
||||
|
|
@ -65,7 +65,7 @@ if(has_cxx_rvalues LESS 0 OR has_cxx_variadic LESS 0)
|
|||
else()
|
||||
set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates)
|
||||
|
||||
polyhedron_demo_plugin(ply_plugin PLY_io_plugin KEYWORDS IO PointSetProcessing Classification)
|
||||
polyhedron_demo_plugin(ply_plugin PLY_io_plugin KEYWORDS IO PointSetProcessing Classification PMP)
|
||||
target_link_libraries(ply_plugin PUBLIC scene_points_with_normal_item scene_polygon_soup_item scene_surface_mesh_item scene_textured_item)
|
||||
target_compile_features(ply_plugin PRIVATE ${needed_cxx_features})
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ find_library(3MF_LIBRARIES NAMES 3MF DOC "Path to the lib3MF library")
|
|||
|
||||
if(3MF_LIBRARIES AND 3MF_INCLUDE_DIR)
|
||||
include_directories(${3MF_INCLUDE_DIR})
|
||||
polyhedron_demo_plugin(3mf_io_plugin 3mf_io_plugin KEYWORDS IO)
|
||||
polyhedron_demo_plugin(3mf_io_plugin 3mf_io_plugin KEYWORDS IO PMP)
|
||||
target_link_libraries(3mf_io_plugin PRIVATE scene_surface_mesh_item scene_points_with_normal_item scene_polylines_item ${3MF_LIBRARIES})
|
||||
else()
|
||||
message(STATUS "NOTICE : The 3mf_io_plugin requires the lib3MF library, and will not be compiled.")
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public :
|
|||
{
|
||||
menu->addAction(action);
|
||||
}
|
||||
dock_widget = new GeneratorWidget("Basic Objets", mw);
|
||||
dock_widget = new GeneratorWidget("Basic Objects", mw);
|
||||
dock_widget->setVisible(false); // do not show at the beginning
|
||||
addDockWidget(dock_widget);
|
||||
connect(dock_widget->generateButton, &QAbstractButton::clicked,
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@ if(EIGEN3_FOUND)
|
|||
if("${EIGEN3_VERSION}" VERSION_GREATER "3.1.90")
|
||||
|
||||
qt5_wrap_ui( hole_fillingUI_FILES Hole_filling_widget.ui)
|
||||
polyhedron_demo_plugin(hole_filling_plugin Hole_filling_plugin ${hole_fillingUI_FILES})
|
||||
polyhedron_demo_plugin(hole_filling_plugin Hole_filling_plugin ${hole_fillingUI_FILES} KEYWORDS PMP)
|
||||
target_link_libraries(hole_filling_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_selection_item)
|
||||
|
||||
qt5_wrap_ui( fairingUI_FILES Fairing_widget.ui)
|
||||
polyhedron_demo_plugin(fairing_plugin Fairing_plugin ${fairingUI_FILES})
|
||||
polyhedron_demo_plugin(fairing_plugin Fairing_plugin ${fairingUI_FILES} KEYWORDS PMP)
|
||||
target_link_libraries(fairing_plugin PUBLIC scene_selection_item)
|
||||
|
||||
polyhedron_demo_plugin(hole_filling_polyline_plugin Hole_filling_polyline_plugin)
|
||||
polyhedron_demo_plugin(hole_filling_polyline_plugin Hole_filling_polyline_plugin )
|
||||
target_link_libraries(hole_filling_polyline_plugin PUBLIC scene_surface_mesh_item scene_polylines_item)
|
||||
|
||||
qt5_wrap_ui( Mean_curvature_flow_skeleton_pluginUI_FILES Mean_curvature_flow_skeleton_plugin.ui)
|
||||
|
|
@ -39,14 +39,14 @@ else()
|
|||
endif()
|
||||
|
||||
qt5_wrap_ui( soupUI_FILES Repair_soup.ui )
|
||||
polyhedron_demo_plugin(orient_soup_plugin Orient_soup_plugin ${soupUI_FILES} KEYWORDS Classification )
|
||||
polyhedron_demo_plugin(orient_soup_plugin Orient_soup_plugin ${soupUI_FILES} KEYWORDS Classification PMP)
|
||||
target_link_libraries(orient_soup_plugin PUBLIC scene_polygon_soup_item scene_surface_mesh_item scene_polylines_item scene_points_with_normal_item)
|
||||
|
||||
|
||||
polyhedron_demo_plugin(inside_out_plugin Inside_out_plugin)
|
||||
polyhedron_demo_plugin(inside_out_plugin Inside_out_plugin KEYWORDS PMP)
|
||||
target_link_libraries(inside_out_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item)
|
||||
|
||||
polyhedron_demo_plugin(join_and_split_plugin Join_and_split_polyhedra_plugin)
|
||||
polyhedron_demo_plugin(join_and_split_plugin Join_and_split_polyhedra_plugin KEYWORDS PMP)
|
||||
target_link_libraries(join_and_split_plugin PUBLIC scene_surface_mesh_item scene_selection_item)
|
||||
|
||||
|
||||
|
|
@ -60,58 +60,59 @@ qt5_wrap_ui( polyhedron_slicerUI_FILES Polyhedron_slicer_widget.ui)
|
|||
polyhedron_demo_plugin(polyhedron_slicer_plugin Polyhedron_slicer_plugin ${polyhedron_slicerUI_FILES})
|
||||
target_link_libraries(polyhedron_slicer_plugin PUBLIC scene_surface_mesh_item scene_basic_objects scene_polylines_item)
|
||||
|
||||
polyhedron_demo_plugin(polyhedron_stitching_plugin Polyhedron_stitching_plugin)
|
||||
polyhedron_demo_plugin(polyhedron_stitching_plugin Polyhedron_stitching_plugin KEYWORDS PMP)
|
||||
target_link_libraries(polyhedron_stitching_plugin PUBLIC scene_surface_mesh_item scene_polylines_item)
|
||||
|
||||
qt5_wrap_ui( selectionUI_FILES Selection_widget.ui)
|
||||
polyhedron_demo_plugin(selection_plugin Selection_plugin ${selectionUI_FILES} KEYWORDS PolygonMesh IO Classification Mesh_3)
|
||||
polyhedron_demo_plugin(selection_plugin Selection_plugin ${selectionUI_FILES} KEYWORDS PMP IO Classification Mesh_3)
|
||||
target_link_libraries(selection_plugin PUBLIC scene_selection_item scene_points_with_normal_item scene_polylines_item)
|
||||
|
||||
polyhedron_demo_plugin(self_intersection_plugin Self_intersection_plugin)
|
||||
target_link_libraries(self_intersection_plugin PUBLIC scene_selection_item scene_surface_mesh_item)
|
||||
#to keep it simple to compile
|
||||
add_custom_target(self_intersection_plugin )
|
||||
add_dependencies(self_intersection_plugin selection_plugin)
|
||||
|
||||
polyhedron_demo_plugin(triangulate_facets_plugin Triangulate_facets_plugin)
|
||||
polyhedron_demo_plugin(triangulate_facets_plugin Triangulate_facets_plugin KEYWORDS PMP)
|
||||
target_link_libraries(triangulate_facets_plugin PUBLIC scene_surface_mesh_item)
|
||||
|
||||
polyhedron_demo_plugin(corefinement_plugin Corefinement_plugin)
|
||||
polyhedron_demo_plugin(corefinement_plugin Corefinement_plugin KEYWORDS PMP)
|
||||
target_link_libraries(corefinement_plugin PUBLIC scene_surface_mesh_item)
|
||||
|
||||
polyhedron_demo_plugin(surface_intersection_plugin Surface_intersection_plugin)
|
||||
polyhedron_demo_plugin(surface_intersection_plugin Surface_intersection_plugin KEYWORDS PMP)
|
||||
target_link_libraries(surface_intersection_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_points_with_normal_item)
|
||||
|
||||
polyhedron_demo_plugin(repair_polyhedron_plugin Repair_polyhedron_plugin)
|
||||
polyhedron_demo_plugin(repair_polyhedron_plugin Repair_polyhedron_plugin KEYWORDS PMP)
|
||||
target_link_libraries(repair_polyhedron_plugin PUBLIC scene_surface_mesh_item)
|
||||
|
||||
qt5_wrap_ui( isotropicRemeshingUI_FILES Isotropic_remeshing_dialog.ui)
|
||||
polyhedron_demo_plugin(isotropic_remeshing_plugin Isotropic_remeshing_plugin ${isotropicRemeshingUI_FILES})
|
||||
polyhedron_demo_plugin(isotropic_remeshing_plugin Isotropic_remeshing_plugin ${isotropicRemeshingUI_FILES} KEYWORDS PMP)
|
||||
target_link_libraries(isotropic_remeshing_plugin PUBLIC scene_surface_mesh_item scene_selection_item)
|
||||
|
||||
if(TBB_FOUND)
|
||||
CGAL_target_use_TBB(isotropic_remeshing_plugin)
|
||||
endif()
|
||||
|
||||
polyhedron_demo_plugin(distance_plugin Distance_plugin)
|
||||
polyhedron_demo_plugin(distance_plugin Distance_plugin KEYWORDS PMP)
|
||||
target_link_libraries(distance_plugin PUBLIC scene_surface_mesh_item scene_color_ramp)
|
||||
if(TBB_FOUND)
|
||||
CGAL_target_use_TBB(distance_plugin)
|
||||
endif()
|
||||
|
||||
|
||||
polyhedron_demo_plugin(detect_sharp_edges_plugin Detect_sharp_edges_plugin KEYWORDS IO Mesh_3)
|
||||
polyhedron_demo_plugin(detect_sharp_edges_plugin Detect_sharp_edges_plugin KEYWORDS IO Mesh_3 PMP)
|
||||
target_link_libraries(detect_sharp_edges_plugin PUBLIC scene_surface_mesh_item)
|
||||
|
||||
|
||||
|
||||
qt5_wrap_ui( randomPerturbationUI_FILES Random_perturbation_dialog.ui)
|
||||
polyhedron_demo_plugin(random_perturbation_plugin Random_perturbation_plugin ${randomPerturbationUI_FILES})
|
||||
polyhedron_demo_plugin(random_perturbation_plugin Random_perturbation_plugin ${randomPerturbationUI_FILES} KEYWORDS PMP)
|
||||
target_link_libraries(random_perturbation_plugin PUBLIC scene_surface_mesh_item scene_selection_item)
|
||||
|
||||
polyhedron_demo_plugin(degenerated_faces_plugin Degenerated_faces_plugin)
|
||||
polyhedron_demo_plugin(degenerated_faces_plugin Degenerated_faces_plugin KEYWORDS PMP)
|
||||
target_link_libraries(degenerated_faces_plugin PUBLIC scene_surface_mesh_item scene_selection_item)
|
||||
|
||||
qt5_wrap_ui( engravUI_FILES Engrave_dock_widget.ui )
|
||||
polyhedron_demo_plugin(engrave_text_plugin Engrave_text_plugin ${engravUI_FILES})
|
||||
target_link_libraries(engrave_text_plugin PUBLIC scene_surface_mesh_item scene_selection_item scene_polylines_item)
|
||||
|
||||
polyhedron_demo_plugin(extrude_plugin Extrude_plugin)
|
||||
polyhedron_demo_plugin(extrude_plugin Extrude_plugin KEYWORDS PMP)
|
||||
target_link_libraries(extrude_plugin PUBLIC scene_surface_mesh_item scene_selection_item)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class Polyhedron_demo_corefinement_sm_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "corefinement_plugin.json")
|
||||
|
||||
enum bool_op {CRF_UNION, CRF_INTER, CRF_MINUS, CRF_MINUS_OP};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Degenerated_faces_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "degenerated_faces_plugin.json")
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Polyhedron_demo_detect_sharp_edges_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "detect_sharp_edges_plugin.json")
|
||||
|
||||
public:
|
||||
void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*) {
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ class DistancePlugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "distance_plugin.json")
|
||||
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ class ExtrudePlugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "extrude_plugin.json")
|
||||
public:
|
||||
|
||||
bool applicable(QAction* action) const Q_DECL_OVERRIDE
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Polyhedron_demo_fairing_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "fairing_plugin.json")
|
||||
public:
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_facegraph_item*>(scene->item(scene->mainSelectionIndex()))
|
||||
|
|
|
|||
|
|
@ -164,9 +164,9 @@ void removeViewer(Viewer_interface *viewer)
|
|||
Scene_item_rendering_helper::removeViewer(viewer);
|
||||
}
|
||||
// filter events for selecting / activating holes with mouse input
|
||||
bool eventFilter(QObject* target, QEvent *event)
|
||||
bool eventFilter(QObject* , QEvent *event)
|
||||
{
|
||||
Viewer_interface* viewer = qobject_cast<Viewer_interface*>(target);
|
||||
Viewer_interface* viewer = CGAL::Three::Three::activeViewer();
|
||||
// This filter is both filtering events from 'viewer' and 'main window'
|
||||
Mouse_keyboard_state old_state = state;
|
||||
// key events
|
||||
|
|
@ -262,7 +262,7 @@ private:
|
|||
|
||||
Face_graph& poly = *poly_item->polyhedron();
|
||||
|
||||
CGAL::QGLViewer* viewer = Three::mainViewer();
|
||||
CGAL::QGLViewer* viewer = Three::currentViewer();
|
||||
CGAL::qglviewer::Camera* camera = viewer->camera();
|
||||
|
||||
Polyline_data_list::const_iterator min_it;
|
||||
|
|
@ -270,15 +270,6 @@ private:
|
|||
Kernel::Point_2 xy(x,y);
|
||||
for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it)
|
||||
{
|
||||
#if 0
|
||||
/* use center of polyline to measure distance - performance wise */
|
||||
const CGAL::qglviewer::Vec& pos_it = camera->projectedCoordinatesOf(it->position);
|
||||
float dist = std::pow(pos_it.x - x, 2) + std::pow(pos_it.y - y, 2);
|
||||
if(dist < min_dist) {
|
||||
min_dist = dist;
|
||||
min_it = it;
|
||||
}
|
||||
#else
|
||||
boost::property_map<Face_graph,CGAL::vertex_point_t>::type vpm = get(CGAL::vertex_point,poly);
|
||||
/* use polyline points to measure distance - might hurt performance for large holes */
|
||||
for(fg_halfedge_descriptor hf_around_facet : halfedges_around_face(it->halfedge,poly)){
|
||||
|
|
@ -287,14 +278,12 @@ private:
|
|||
const Point_3& p_2 = get(vpm,target(opposite(hf_around_facet,poly),poly));
|
||||
const CGAL::qglviewer::Vec& pos_it_2 = camera->projectedCoordinatesOf(CGAL::qglviewer::Vec(p_2.x(), p_2.y(), p_2.z()));
|
||||
Kernel::Segment_2 s(Kernel::Point_2(pos_it_1.x, pos_it_1.y), Kernel::Point_2(pos_it_2.x, pos_it_2.y));
|
||||
|
||||
double dist = CGAL::squared_distance(s, xy);
|
||||
if(dist < min_dist) {
|
||||
min_dist = dist;
|
||||
min_it = it;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if(min_it == active_hole) {
|
||||
|
|
@ -337,7 +326,7 @@ class Polyhedron_demo_hole_filling_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "hole_filling_plugin.json")
|
||||
public:
|
||||
bool applicable(QAction*) const { return qobject_cast<Scene_face_graph_item*>(scene->item(scene->mainSelectionIndex())) ||
|
||||
qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex())); }
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class Polyhedron_demo_inside_out_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "inside_out_plugin.json")
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ class Polyhedron_demo_isotropic_remeshing_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "isotropic_remeshing_plugin.json")
|
||||
|
||||
typedef boost::graph_traits<FaceGraph>::edge_descriptor edge_descriptor;
|
||||
typedef boost::graph_traits<FaceGraph>::halfedge_descriptor halfedge_descriptor;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Polyhedron_demo_join_and_split_polyhedra_plugin:
|
|||
public Polyhedron_demo_plugin_helper
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "join_and_split_polyhedra_plugin.json")
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
QAction* actionJoinPolyhedra, *actionSplitPolyhedra, *actionColorConnectedComponents;
|
||||
Messages_interface* msg_interface;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Polyhedron_demo_orient_soup_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "orient_soup_plugin.json")
|
||||
|
||||
public:
|
||||
void init(QMainWindow* mainWindow,
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Polyhedron_demo_polyhedron_stitching_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "polyhedron_stitching_plugin.json")
|
||||
|
||||
QAction* actionDetectBorders;
|
||||
QAction* actionStitchBorders;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Polyhedron_demo_random_perturbation_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "random_perturbation_plugin.json")
|
||||
|
||||
public:
|
||||
void init(QMainWindow* mainWindow,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Polyhedron_demo_repair_polyhedron_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "repair_polyhedron_plugin.json")
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
#include <CGAL/Polygon_mesh_processing/border.h>
|
||||
#include <CGAL/Polygon_mesh_processing/repair.h>
|
||||
#include <CGAL/Polygon_mesh_processing/shape_predicates.h>
|
||||
#include <CGAL/Polygon_mesh_processing/self_intersections.h>
|
||||
|
||||
#include <Scene.h>
|
||||
typedef Scene_surface_mesh_item Scene_face_graph_item;
|
||||
|
||||
|
|
@ -125,17 +127,32 @@ public:
|
|||
return res;
|
||||
}
|
||||
|
||||
bool applicable(QAction*) const override {
|
||||
return qobject_cast<Scene_face_graph_item*>(scene->item(scene->mainSelectionIndex()))
|
||||
|| qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
bool applicable(QAction* action) const override {
|
||||
if(action == actionSelfIntersection)
|
||||
return qobject_cast<Scene_face_graph_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
else if(action == actionSelection)
|
||||
return qobject_cast<Scene_face_graph_item*>(scene->item(scene->mainSelectionIndex()))
|
||||
|| qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
return false;
|
||||
}
|
||||
void print_message(QString message) { CGAL::Three::Three::information(message); }
|
||||
QList<QAction*> actions() const override { return QList<QAction*>() << actionSelection; }
|
||||
|
||||
QList<QAction*> actions() const override {
|
||||
return QList<QAction*>() << actionSelection
|
||||
<< actionSelfIntersection;
|
||||
}
|
||||
|
||||
using Polyhedron_demo_io_plugin_interface::init;
|
||||
virtual void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) override{
|
||||
mw = mainWindow;
|
||||
scene = scene_interface;
|
||||
messages = m;
|
||||
|
||||
actionSelfIntersection = new QAction(tr("Self-&Intersection Test"), mw);
|
||||
actionSelfIntersection->setObjectName("actionSelfIntersection");
|
||||
actionSelfIntersection->setProperty("subMenuName", "Polygon Mesh Processing");
|
||||
connect(actionSelfIntersection, SIGNAL(triggered()), this, SLOT(on_actionSelfIntersection_triggered()));
|
||||
|
||||
actionSelection = new QAction(
|
||||
QString("Surface Mesh Selection")
|
||||
, mw);
|
||||
|
|
@ -224,8 +241,10 @@ Q_SIGNALS:
|
|||
void save_handleType();
|
||||
void set_operation_mode(int);
|
||||
void set_highlighting(bool);
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
void on_actionSelfIntersection_triggered();
|
||||
|
||||
void connectItem(Scene_polyhedron_selection_item* new_item)
|
||||
{
|
||||
|
|
@ -1057,6 +1076,7 @@ void filter_operations()
|
|||
private:
|
||||
Messages_interface* messages;
|
||||
QAction* actionSelection;
|
||||
QAction *actionSelfIntersection;
|
||||
|
||||
QDockWidget* dock_widget;
|
||||
Ui::Selection ui_widget;
|
||||
|
|
@ -1068,6 +1088,102 @@ typedef boost::unordered_map<Scene_face_graph_item*, Scene_polyhedron_selection_
|
|||
bool from_plugin;
|
||||
}; // end Polyhedron_demo_selection_plugin
|
||||
|
||||
|
||||
template<class Mesh>
|
||||
bool selfIntersect(Mesh* mesh, std::vector<std::pair<typename boost::graph_traits<Mesh>::face_descriptor,typename boost::graph_traits<Mesh>::face_descriptor> > &faces)
|
||||
{
|
||||
if(!CGAL::is_triangle_mesh(*mesh))
|
||||
{
|
||||
CGAL::Three::Three::warning("%1 skipped because not triangulated.");
|
||||
return false;
|
||||
}
|
||||
// compute self-intersections
|
||||
CGAL::Polygon_mesh_processing::self_intersections
|
||||
(*mesh, std::back_inserter(faces),
|
||||
CGAL::Polygon_mesh_processing::parameters::vertex_point_map(get(CGAL::vertex_point, *mesh)));
|
||||
|
||||
std::cout << "ok (" << faces.size() << " triangle pair(s))" << std::endl;
|
||||
return !faces.empty();
|
||||
}
|
||||
|
||||
void Polyhedron_demo_selection_plugin::on_actionSelfIntersection_triggered()
|
||||
{
|
||||
typedef boost::graph_traits<Face_graph>::face_descriptor Face_descriptor;
|
||||
typedef boost::graph_traits<Face_graph>::halfedge_descriptor halfedge_descriptor;
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
bool found = false;
|
||||
std::vector<Scene_face_graph_item*> selected_polys;
|
||||
Q_FOREACH(Scene_interface::Item_id index, scene->selectionIndices())
|
||||
{
|
||||
Scene_face_graph_item* poly_item =
|
||||
qobject_cast<Scene_face_graph_item*>(scene->item(index));
|
||||
if(poly_item)
|
||||
{
|
||||
selected_polys.push_back(poly_item);
|
||||
}
|
||||
}
|
||||
Q_FOREACH(Scene_face_graph_item* poly_item, selected_polys)
|
||||
{
|
||||
Face_graph* mesh = poly_item->face_graph();
|
||||
std::vector<std::pair<Face_descriptor, Face_descriptor> > faces;
|
||||
// add intersecting triangles to a new Surface_mesh.
|
||||
if(selfIntersect(mesh, faces))
|
||||
{
|
||||
Scene_polyhedron_selection_item* selection_item = nullptr;
|
||||
bool should_add = true;
|
||||
if(selection_item_map.find(poly_item) != selection_item_map.end())
|
||||
{
|
||||
QApplication::restoreOverrideCursor();
|
||||
if(QMessageBox::question(mw, "Question", "Only one Selection Item can be associated to an item at once, "
|
||||
"and one already exists. Would you like to replace it ? (If not, this item will be skipped.)")
|
||||
== QMessageBox::Yes)
|
||||
{
|
||||
selection_item = selection_item_map.find(poly_item)->second;
|
||||
selection_item->clear();
|
||||
should_add = false;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
selection_item = new Scene_polyhedron_selection_item(poly_item, mw);
|
||||
}
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
//add the faces
|
||||
for(std::vector<std::pair<Face_descriptor, Face_descriptor> >::iterator fb = faces.begin();
|
||||
fb != faces.end(); ++fb) {
|
||||
selection_item->selected_facets.insert(fb->first);
|
||||
selection_item->selected_facets.insert(fb->second);
|
||||
|
||||
//add the edges
|
||||
for(halfedge_descriptor he_circ : halfedges_around_face( halfedge(fb->first, *mesh), *mesh))
|
||||
{
|
||||
selection_item->selected_edges.insert(edge(he_circ, *mesh));
|
||||
}
|
||||
for(halfedge_descriptor he_circ : halfedges_around_face( halfedge(fb->second, *mesh), *mesh))
|
||||
{
|
||||
selection_item->selected_edges.insert(edge(he_circ, *mesh));
|
||||
}
|
||||
}
|
||||
|
||||
selection_item->invalidateOpenGLBuffers();
|
||||
selection_item->setName(tr("%1 (selection) (intersecting triangles)").arg(poly_item->name()));
|
||||
if(should_add)
|
||||
connectItem(selection_item);
|
||||
poly_item->setRenderingMode(Wireframe);
|
||||
|
||||
scene->itemChanged(poly_item);
|
||||
|
||||
selection_item->set_highlighting(false);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
if(!found)
|
||||
QMessageBox::information(mw, tr("No self intersection"),
|
||||
tr("None of the selected surfaces self-intersect."));
|
||||
}
|
||||
//Q_EXPORT_PLUGIN2(Polyhedron_demo_selection_plugin, Polyhedron_demo_selection_plugin)
|
||||
|
||||
#include "Selection_plugin.moc"
|
||||
|
|
|
|||
|
|
@ -1,138 +0,0 @@
|
|||
#include <QApplication>
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QMainWindow>
|
||||
#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
|
||||
#include <CGAL/intersections.h>
|
||||
#include <CGAL/Bbox_3.h>
|
||||
#include <CGAL/box_intersection_d.h>
|
||||
|
||||
#include <CGAL/Polygon_mesh_processing/self_intersections.h>
|
||||
#include <CGAL/Make_triangle_soup.h>
|
||||
|
||||
|
||||
#include "Kernel_type.h"
|
||||
#include "Scene_polyhedron_selection_item.h"
|
||||
|
||||
#include "Scene_surface_mesh_item.h"
|
||||
typedef Scene_surface_mesh_item Scene_face_graph_item;
|
||||
|
||||
typedef Scene_face_graph_item::Face_graph Face_graph;
|
||||
typedef Kernel::Triangle_3 Triangle;
|
||||
using namespace CGAL::Three;
|
||||
class Polyhedron_demo_self_intersection_plugin :
|
||||
public QObject,
|
||||
public Polyhedron_demo_plugin_interface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
|
||||
public:
|
||||
|
||||
QList<QAction*> actions() const {
|
||||
return _actions;
|
||||
}
|
||||
|
||||
void init(QMainWindow* mainWindow,
|
||||
Scene_interface* scene_interface,
|
||||
Messages_interface*)
|
||||
{
|
||||
mw = mainWindow;
|
||||
scene = scene_interface;
|
||||
QAction *actionSelfIntersection = new QAction(tr("Self-&Intersection Test"), mw);
|
||||
actionSelfIntersection->setProperty("subMenuName", "Polygon Mesh Processing");
|
||||
connect(actionSelfIntersection, SIGNAL(triggered()), this, SLOT(on_actionSelfIntersection_triggered()));
|
||||
_actions <<actionSelfIntersection;
|
||||
|
||||
}
|
||||
|
||||
bool applicable(QAction*) const {
|
||||
return
|
||||
qobject_cast<Scene_face_graph_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void on_actionSelfIntersection_triggered();
|
||||
private:
|
||||
QList<QAction*> _actions;
|
||||
Scene_interface *scene;
|
||||
QMainWindow *mw;
|
||||
|
||||
}; // end Polyhedron_demo_self_intersection_plugin
|
||||
|
||||
//pretty useless for now but could allow a huge factorization when a selection_item is
|
||||
// available for SM_items
|
||||
template<class Mesh>
|
||||
bool selfIntersect(Mesh* mesh, std::vector<std::pair<typename boost::graph_traits<Mesh>::face_descriptor,typename boost::graph_traits<Mesh>::face_descriptor> > &faces)
|
||||
{
|
||||
if(!CGAL::is_triangle_mesh(*mesh))
|
||||
{
|
||||
CGAL::Three::Three::warning("%1 skipped because not triangulated.");
|
||||
return false;
|
||||
}
|
||||
// compute self-intersections
|
||||
CGAL::Polygon_mesh_processing::self_intersections
|
||||
(*mesh, std::back_inserter(faces),
|
||||
CGAL::Polygon_mesh_processing::parameters::vertex_point_map(get(CGAL::vertex_point, *mesh)));
|
||||
|
||||
std::cout << "ok (" << faces.size() << " triangle pair(s))" << std::endl;
|
||||
return !faces.empty();
|
||||
}
|
||||
|
||||
void Polyhedron_demo_self_intersection_plugin::on_actionSelfIntersection_triggered()
|
||||
{
|
||||
typedef boost::graph_traits<Face_graph>::face_descriptor Face_descriptor;
|
||||
typedef boost::graph_traits<Face_graph>::halfedge_descriptor halfedge_descriptor;
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
bool found = false;
|
||||
std::vector<Scene_face_graph_item*> selected_polys;
|
||||
Q_FOREACH(Scene_interface::Item_id index, scene->selectionIndices())
|
||||
{
|
||||
Scene_face_graph_item* poly_item =
|
||||
qobject_cast<Scene_face_graph_item*>(scene->item(index));
|
||||
if(poly_item)
|
||||
{
|
||||
selected_polys.push_back(poly_item);
|
||||
}
|
||||
}
|
||||
Q_FOREACH(Scene_face_graph_item* poly_item, selected_polys)
|
||||
{
|
||||
Face_graph* mesh = poly_item->face_graph();
|
||||
std::vector<std::pair<Face_descriptor, Face_descriptor> > faces;
|
||||
// add intersecting triangles to a new Surface_mesh.
|
||||
if(selfIntersect(mesh, faces))
|
||||
{
|
||||
//add the faces
|
||||
Scene_polyhedron_selection_item* selection_item = new Scene_polyhedron_selection_item(poly_item, mw);
|
||||
for(std::vector<std::pair<Face_descriptor, Face_descriptor> >::iterator fb = faces.begin();
|
||||
fb != faces.end(); ++fb) {
|
||||
selection_item->selected_facets.insert(fb->first);
|
||||
selection_item->selected_facets.insert(fb->second);
|
||||
|
||||
//add the edges
|
||||
for(halfedge_descriptor he_circ : halfedges_around_face( halfedge(fb->first, *mesh), *mesh))
|
||||
{
|
||||
selection_item->selected_edges.insert(edge(he_circ, *mesh));
|
||||
}
|
||||
for(halfedge_descriptor he_circ : halfedges_around_face( halfedge(fb->second, *mesh), *mesh))
|
||||
{
|
||||
selection_item->selected_edges.insert(edge(he_circ, *mesh));
|
||||
}
|
||||
}
|
||||
selection_item->invalidateOpenGLBuffers();
|
||||
selection_item->setName(tr("%1 (selection) (intersecting triangles)").arg(poly_item->name()));
|
||||
poly_item->setRenderingMode(Wireframe);
|
||||
scene->addItem(selection_item);
|
||||
scene->itemChanged(poly_item);
|
||||
scene->itemChanged(selection_item);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
if(!found)
|
||||
QMessageBox::information(mw, tr("No self intersection"),
|
||||
tr("None of the selected surfaces self-intersect."));
|
||||
}
|
||||
|
||||
#include "Self_intersection_plugin.moc"
|
||||
|
|
@ -32,7 +32,7 @@ class Polyhedron_demo_intersection_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "surface_intersection_plugin.json")
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class Polyhedron_demo_triangulate_facets_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "triangulate_facets_plugin.json")
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <CGAL/Three/Triangle_container.h>
|
||||
#include <CGAL/Three/Edge_container.h>
|
||||
#include <CGAL/Three/Point_container.h>
|
||||
#include <CGAL/Three/Three.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QApplication>
|
||||
|
|
@ -25,6 +26,8 @@
|
|||
#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
|
||||
#include <CGAL/Polygon_mesh_processing/orientation.h>
|
||||
#include <CGAL/Polygon_mesh_processing/repair.h>
|
||||
|
||||
#define CGAL_PMP_REPAIR_POLYGON_SOUP_VERBOSE 1
|
||||
#include <CGAL/Polygon_mesh_processing/repair_polygon_soup.h>
|
||||
|
||||
#include <CGAL/Polygon_2.h>
|
||||
|
|
@ -41,11 +44,14 @@
|
|||
#include <boost/accumulators/statistics/median.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <streambuf>
|
||||
|
||||
using namespace CGAL::Three;
|
||||
typedef Viewer_interface Vi;
|
||||
typedef Triangle_container Tc;
|
||||
typedef Edge_container Ec;
|
||||
typedef Point_container Pc;
|
||||
|
||||
struct Scene_polygon_soup_item_priv{
|
||||
|
||||
typedef Polygon_soup::Polygons::const_iterator Polygons_iterator;
|
||||
|
|
@ -858,6 +864,8 @@ void Scene_polygon_soup_item::repair(bool erase_dup, bool req_same_orientation)
|
|||
erase_all_duplicates(erase_dup)
|
||||
.require_same_orientation(req_same_orientation));
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
// CGAL::Three::Three::information(
|
||||
}
|
||||
|
||||
CGAL::Three::Scene_item::Header_data Scene_polygon_soup_item::header() const
|
||||
|
|
|
|||
|
|
@ -198,6 +198,10 @@ struct Scene_polyhedron_selection_item_priv{
|
|||
};
|
||||
QUndoStack stack;
|
||||
CGAL::Face_filtered_graph<SMesh> *filtered_graph;
|
||||
|
||||
std::size_t num_faces;
|
||||
std::size_t num_vertices;
|
||||
std::size_t num_edges;
|
||||
};
|
||||
typedef Scene_polyhedron_selection_item_priv Priv;
|
||||
|
||||
|
|
@ -1121,6 +1125,7 @@ bool Scene_polyhedron_selection_item:: treat_selection(const std::set<fg_edge_de
|
|||
halfedge(v2, *mesh),
|
||||
*mesh);
|
||||
}, this));
|
||||
CGAL::Euler::join_face(halfedge(ed, *mesh), *mesh);
|
||||
compute_normal_maps();
|
||||
poly_item->invalidateOpenGLBuffers();
|
||||
}
|
||||
|
|
@ -2121,6 +2126,9 @@ void Scene_polyhedron_selection_item::init(Scene_face_graph_item* poly_item, QMa
|
|||
{
|
||||
this->poly_item = poly_item;
|
||||
d->poly =poly_item->polyhedron();
|
||||
d->num_faces = num_faces(*poly_item->polyhedron());
|
||||
d->num_vertices = num_vertices(*poly_item->polyhedron());
|
||||
d->num_edges = num_edges(*poly_item->polyhedron());
|
||||
connect(poly_item, SIGNAL(item_is_about_to_be_changed()), this, SLOT(poly_item_changed()));
|
||||
//parameters type must be of the same name here and there, so they must be hardcoded.
|
||||
connect(&k_ring_selector, SIGNAL(selected(const std::set<fg_vertex_descriptor>&)), this,
|
||||
|
|
@ -2148,6 +2156,29 @@ void Scene_polyhedron_selection_item::init(Scene_face_graph_item* poly_item, QMa
|
|||
connect(&k_ring_selector,SIGNAL(isCurrentlySelected(Scene_facegraph_item_k_ring_selection*)), this, SIGNAL(isCurrentlySelected(Scene_facegraph_item_k_ring_selection*)));
|
||||
k_ring_selector.init(poly_item, mw, Active_handle::VERTEX, -1);
|
||||
connect(&k_ring_selector, SIGNAL(resetIsTreated()), this, SLOT(resetIsTreated()));
|
||||
connect(poly_item, &Scene_surface_mesh_item::itemChanged, this, [this](){
|
||||
std::size_t new_num_faces = num_faces(*this->poly_item->face_graph());
|
||||
std::size_t new_num_vertices = num_vertices(*this->poly_item->face_graph());
|
||||
std::size_t new_num_edges = num_edges(*this->poly_item->face_graph());
|
||||
|
||||
if(new_num_faces != d->num_faces)
|
||||
{
|
||||
selected_facets.clear();
|
||||
d->num_faces = new_num_faces ;
|
||||
}
|
||||
if(new_num_vertices!= d->num_vertices)
|
||||
{
|
||||
selected_vertices.clear();
|
||||
d->num_vertices = new_num_vertices ;
|
||||
}
|
||||
if(new_num_edges!= d->num_edges)
|
||||
{
|
||||
selected_edges.clear();
|
||||
d->num_edges = new_num_edges ;
|
||||
}
|
||||
invalidateOpenGLBuffers();
|
||||
redraw();
|
||||
});
|
||||
d->manipulated_frame = new ManipulatedFrame();
|
||||
Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool())
|
||||
v->installEventFilter(this);
|
||||
|
|
|
|||
|
|
@ -2259,6 +2259,7 @@ void Scene_surface_mesh_item::computeElements()const
|
|||
{
|
||||
d->compute_elements(ALL);
|
||||
setBuffersFilled(true);
|
||||
const_cast<Scene_surface_mesh_item*>(this)->itemChanged();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Reference in New Issue