mirror of https://github.com/CGAL/cgal
Merge branch 'Polyhedron_demo-Menu_organization-GF'
This commit is contained in:
commit
9b8b98c4d0
|
|
@ -339,6 +339,18 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
connect(ui->menuOperations, SIGNAL(aboutToShow()), this, SLOT(filterOperations()));
|
||||
}
|
||||
|
||||
//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)
|
||||
{
|
||||
Q_FOREACH(QAction* action, menu->actions()) {
|
||||
if(QMenu* menu = action->menu()) {
|
||||
filterMenuOperations(menu);
|
||||
action->setVisible(!(menu->isEmpty()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::filterOperations()
|
||||
{
|
||||
Q_FOREACH(const PluginNamePair& p, plugins) {
|
||||
|
|
@ -347,15 +359,9 @@ void MainWindow::filterOperations()
|
|||
}
|
||||
}
|
||||
|
||||
// do a pass over all menus in Operations and hide them when they are empty
|
||||
Q_FOREACH(QAction* action, ui->menuOperations->actions()) {
|
||||
if(QMenu* menu = action->menu()) {
|
||||
action->setVisible(!(menu->isEmpty()));
|
||||
}
|
||||
}
|
||||
// do a pass over all menus in Operations and their sub-menus(etc.) and hide them when they are empty
|
||||
filterMenuOperations(ui->menuOperations);
|
||||
}
|
||||
|
||||
|
||||
#ifdef QT_SCRIPT_LIB
|
||||
void MainWindow::evaluate_script(QString script,
|
||||
const QString& filename,
|
||||
|
|
@ -409,6 +415,75 @@ bool actionsByName(QAction* x, QAction* y) {
|
|||
}
|
||||
}
|
||||
|
||||
//Recursively creates all subMenus containing an action.
|
||||
void MainWindow::setMenus(QString name, QString parentName, QAction* a )
|
||||
{
|
||||
|
||||
bool hasSub = false;
|
||||
QString menuName, subMenuName;
|
||||
if (!name.isNull())
|
||||
{
|
||||
//Get the menu and submenu names
|
||||
for(int i=0; i<name.size(); i++)
|
||||
{
|
||||
if(name.at(i)=='/')
|
||||
hasSub = true;
|
||||
}
|
||||
|
||||
if(!hasSub)
|
||||
menuName= name;
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for(i = 0; name.at(i)!='/'; i++)
|
||||
menuName.append(name.at(i));
|
||||
i++;
|
||||
for(int j = i; j<name.size(); j++)
|
||||
subMenuName.append(name.at(j));
|
||||
setMenus(subMenuName, menuName, a);
|
||||
}
|
||||
|
||||
//Create the menu and sub menu
|
||||
QMenu* menu = 0;
|
||||
QMenu* parentMenu = 0;
|
||||
//If the menu already exists, don't create a new one.
|
||||
Q_FOREACH(QAction* action, findChildren<QAction*>()) {
|
||||
if(!action->menu()) continue;
|
||||
QString menuText = action->menu()->title();
|
||||
//If the menu title does not correspond to the name of the menu or submenu we want,
|
||||
//go to the next one.
|
||||
if(menuText != menuName) continue;
|
||||
menu = action->menu();
|
||||
}
|
||||
|
||||
bool hasAction = false;
|
||||
if(menu == 0)
|
||||
menu = new QMenu(menuName, this);
|
||||
else //checks the action is not already in the menu
|
||||
if(a->property("added").toBool())
|
||||
hasAction = true;
|
||||
if(!hasAction)
|
||||
menu->addAction(a);
|
||||
a->setProperty("added", true);
|
||||
//If the parent menu already exists, don't create a new one.
|
||||
Q_FOREACH(QAction* action, findChildren<QAction*>()) {
|
||||
if(!action->menu()) continue;
|
||||
QString menuText = action->menu()->title();
|
||||
//If the menu title does not correspond to the name of the menu or submenu we want,
|
||||
//go to the next one.
|
||||
if(menuText != parentName) continue;
|
||||
parentMenu = action->menu();
|
||||
}
|
||||
|
||||
if(parentMenu == 0)
|
||||
parentMenu = new QMenu(parentName, this);
|
||||
parentMenu->addMenu(menu);
|
||||
ui->menuOperations->removeAction(a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::loadPlugins()
|
||||
{
|
||||
Q_FOREACH(QObject *obj, QPluginLoader::staticInstances())
|
||||
|
|
@ -463,13 +538,112 @@ void MainWindow::loadPlugins()
|
|||
}
|
||||
}
|
||||
|
||||
// sort the operations menu by name
|
||||
QList<QAction*> actions = ui->menuOperations->actions();
|
||||
qSort(actions.begin(), actions.end(), actionsByName);
|
||||
ui->menuOperations->clear();
|
||||
ui->menuOperations->addActions(actions);
|
||||
}
|
||||
//Creates sub-Menus for operations.
|
||||
//!TODO : Make it recursive to allow sub-menus of sub-menus.
|
||||
//!The argument should be the menuPath and it should recurse until hasSub stays false.
|
||||
QList<QAction*> as = ui->menuOperations->actions();
|
||||
Q_FOREACH(QAction* a, as)
|
||||
{
|
||||
QString menuPath = a->property("subMenuName").toString();
|
||||
setMenus(menuPath, ui->menuOperations->title(), a);
|
||||
|
||||
//QList<QAction*> actions;
|
||||
/* QList<QMenu*> menus;
|
||||
Q_FOREACH(QMenu* menu, ui->menuOperations->findChildren<QMenu*>()) {
|
||||
menus.append(menu);
|
||||
}
|
||||
Q_FOREACH(QMenu* menu, menus) {
|
||||
if(menu)
|
||||
{
|
||||
actions = menu->actions();
|
||||
Q_FOREACH(QAction* a, actions)
|
||||
{
|
||||
QString subMenuName = a->property("subMenuName").toString();
|
||||
if(!subMenuName.isNull())
|
||||
{
|
||||
|
||||
QMenu* subMenu = new QMenu(subMenuName, this);
|
||||
subMenu->addMenu(menu);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
// actions = ui->menuOperations->actions();
|
||||
/*Q_FOREACH(QAction* a, actions)
|
||||
{
|
||||
QString menuPath = a->property("subMenuName").toString();
|
||||
bool hasSub = false;
|
||||
QString menuName, subMenuName;
|
||||
if (!menuPath.isNull())
|
||||
{
|
||||
//Get the menu and submenu names
|
||||
for(int i=0; i<menuPath.size(); i++)
|
||||
{
|
||||
if(menuPath.at(i)=='/')
|
||||
hasSub = true;
|
||||
}
|
||||
|
||||
if(hasSub)
|
||||
{
|
||||
int i=0;
|
||||
for(i; menuPath.at(i)!='/'; i++)
|
||||
menuName.append(menuPath.at(i));
|
||||
i++;
|
||||
for(i; i<menuPath.size(); i++)
|
||||
subMenuName.append(menuPath.at(i));
|
||||
}
|
||||
else
|
||||
menuName= menuPath;
|
||||
//Create the menu and sub menu
|
||||
QMenu* menu = 0;
|
||||
QMenu* subMenu = 0;
|
||||
//If the menu already exists, don't create a new one.
|
||||
Q_FOREACH(QAction* action, findChildren<QAction*>()) {
|
||||
if(!action->menu()) continue;
|
||||
QString menuText = action->menu()->title();
|
||||
//If the menu title does not correspond to the name of the menu or submenu we want,
|
||||
//go to the next one.
|
||||
if(menuText != menuName && menuText != subMenuName) continue;
|
||||
menu = action->menu();
|
||||
if(hasSub)
|
||||
{
|
||||
if(menuText != subMenuName) continue;
|
||||
subMenu = action->menu();
|
||||
//find the parent menu of the submenu
|
||||
Q_FOREACH(QMenu* parentmenu, findChildren<QMenu*>())
|
||||
{
|
||||
if(parentmenu->title() != menuName) continue;
|
||||
menu = parentmenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(menu == 0)
|
||||
{
|
||||
menu = new QMenu(menuName, this);
|
||||
}
|
||||
if(hasSub)
|
||||
{
|
||||
if(subMenu == 0)
|
||||
subMenu = new QMenu(subMenuName, this);
|
||||
subMenu->addAction(a);
|
||||
menu->addMenu(subMenu);
|
||||
}
|
||||
else
|
||||
menu->addAction(a);
|
||||
|
||||
ui->menuOperations->addMenu(menu);
|
||||
ui->menuOperations->removeAction(a);
|
||||
}
|
||||
}*/
|
||||
// sort the operations menu by name
|
||||
as = ui->menuOperations->actions();
|
||||
qSort(as.begin(), as.end(), actionsByName);
|
||||
ui->menuOperations->clear();
|
||||
ui->menuOperations->addActions(as);
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::hasPlugin(const QString& pluginName) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -151,6 +151,13 @@ protected Q_SLOTS:
|
|||
|
||||
void on_actionRecenterScene_triggered();
|
||||
protected:
|
||||
QList<QAction*> createSubMenus(QList<QAction*>);
|
||||
/*! For each objects in the sceneView, loads the associated plugins.
|
||||
* Gets the property "submenuName" of all the actions and creates submenus.
|
||||
* Sorts the Operations menu by name.
|
||||
* @see initPlugin(QObject*);
|
||||
* @see initIOPlugin(QObject*);
|
||||
*/
|
||||
void loadPlugins();
|
||||
bool initPlugin(QObject*);
|
||||
bool initIOPlugin(QObject*);
|
||||
|
|
@ -163,7 +170,7 @@ protected:
|
|||
|
||||
private:
|
||||
QString strippedName(const QString &fullFileName);
|
||||
|
||||
void setMenus(QString, QString, QAction *a);
|
||||
/// plugin black-list
|
||||
QSet<QString> plugin_blacklist;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>978</width>
|
||||
<height>21</height>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
@ -69,14 +69,6 @@
|
|||
<property name="title">
|
||||
<string>&Operations</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuSubdivision">
|
||||
<property name="title">
|
||||
<string>&Subdivision</string>
|
||||
</property>
|
||||
<addaction name="actionLoop"/>
|
||||
<addaction name="actionCatmullClark"/>
|
||||
<addaction name="actionSqrt3"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Boolean_operations">
|
||||
<property name="title">
|
||||
<string>&Boolean operations</string>
|
||||
|
|
@ -89,32 +81,15 @@
|
|||
<addaction name="separator"/>
|
||||
<addaction name="actionMinkowskiSum"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuParameterization">
|
||||
<property name="title">
|
||||
<string>Parameterization</string>
|
||||
</property>
|
||||
<addaction name="actionMVC"/>
|
||||
<addaction name="actionDCP"/>
|
||||
<addaction name="actionLSC"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuPCA">
|
||||
<property name="title">
|
||||
<string>PCA</string>
|
||||
</property>
|
||||
<addaction name="actionFitLine"/>
|
||||
<addaction name="actionFitPlane"/>
|
||||
</widget>
|
||||
<addaction name="menuPCA"/>
|
||||
|
||||
<addaction name="actionEstimateCurvature"/>
|
||||
<addaction name="actionSelfIntersection"/>
|
||||
<addaction name="actionConvexHull"/>
|
||||
<addaction name="actionKernel"/>
|
||||
<addaction name="menuSubdivision"/>
|
||||
<addaction name="actionSimplify"/>
|
||||
<addaction name="actionRemeshing"/>
|
||||
<addaction name="actionConvexDecomposition"/>
|
||||
<addaction name="menu_Boolean_operations"/>
|
||||
<addaction name="menuParameterization"/>
|
||||
<addaction name="actionInsideOut"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
|
|
@ -296,8 +271,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>534</width>
|
||||
<height>174</height>
|
||||
<width>541</width>
|
||||
<height>175</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
|
|
|
|||
|
|
@ -23,8 +23,18 @@ class Polyhedron_demo_convex_hull_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
|
||||
public:
|
||||
void init(QMainWindow* mainWindow,
|
||||
Scene_interface* scene_interface)
|
||||
{
|
||||
mw = mainWindow;
|
||||
scene = scene_interface;
|
||||
actions_map["actionConvexHull"] = getActionFromMainWindow(mw, "actionConvexHull");
|
||||
actions_map["actionConvexHull"]->setProperty("subMenuName", "Object creation");
|
||||
autoConnectActions();
|
||||
|
||||
}
|
||||
|
||||
// used by Polyhedron_demo_plugin_helper
|
||||
QStringList actionsNames() const {
|
||||
return QStringList() << "actionConvexHull";
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public:
|
|||
this->scene = scene_interface;
|
||||
this->mw = mainWindow;
|
||||
actionPolyhedronCorefinement_3 = new QAction("Polyhedra corefinement (A/B)", mw);
|
||||
actionPolyhedronCorefinement_3->setProperty("subMenuName", "Operation on multiple polyhedra");
|
||||
if(actionPolyhedronCorefinement_3) {
|
||||
connect(actionPolyhedronCorefinement_3, SIGNAL(triggered()),
|
||||
this, SLOT(corefinement()));
|
||||
|
|
|
|||
|
|
@ -377,6 +377,7 @@ void Polyhedron_demo_cut_plugin::init(QMainWindow* mainWindow,
|
|||
scene = scene_interface;
|
||||
messages = m;
|
||||
actionCreateCutPlane = new QAction(tr("Create cutting plane"), mainWindow);
|
||||
actionCreateCutPlane->setProperty("subMenuName","Operations with plane");
|
||||
connect(actionCreateCutPlane, SIGNAL(triggered()),
|
||||
this, SLOT(createCutPlane()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, Scene
|
|||
scene = scene_interface;
|
||||
|
||||
actionDeformation = new QAction("Surface Mesh Deformation", mw);
|
||||
actionDeformation->setProperty("subMenuName", "Action on mesh");
|
||||
|
||||
actionDeformation->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
|
||||
connect(actionDeformation, SIGNAL(triggered()), this, SLOT(on_actionDeformation_triggered()));
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ public:
|
|||
scene = scene_interface;
|
||||
messages = m;
|
||||
actionFairing = new QAction(tr("Fairing"), mw);
|
||||
actionFairing->setProperty("subMenuName", "Action on mesh");
|
||||
|
||||
connect(actionFairing, SIGNAL(triggered()), this, SLOT(fairing_action()));
|
||||
|
||||
dock_widget = new QDockWidget("Fairing", mw);
|
||||
|
|
|
|||
|
|
@ -396,6 +396,7 @@ void Polyhedron_demo_hole_filling_plugin::init(QMainWindow* mainWindow,
|
|||
messages = m;
|
||||
|
||||
actionHoleFilling = new QAction(tr("Hole Filling"), mw);
|
||||
actionHoleFilling->setProperty("subMenuName", "Action on mesh");
|
||||
connect(actionHoleFilling, SIGNAL(triggered()), this, SLOT(hole_filling_action()));
|
||||
|
||||
dock_widget = new QDockWidget("Hole Filling", mw);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,16 @@ public:
|
|||
return QStringList() << "actionInsideOut";
|
||||
}
|
||||
|
||||
void init(QMainWindow* mainWindow,
|
||||
Scene_interface* scene_interface)
|
||||
{
|
||||
mw = mainWindow;
|
||||
scene = scene_interface;
|
||||
actions_map["actionInsideOut"] = getActionFromMainWindow(mw, "actionInsideOut");
|
||||
actions_map["actionInsideOut"]->setProperty("subMenuName", "Action on normals");
|
||||
autoConnectActions();
|
||||
|
||||
}
|
||||
bool applicable(QAction*) const {
|
||||
const Scene_interface::Item_id index = scene->mainSelectionIndex();
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(index))
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public:
|
|||
this->scene = scene_interface;
|
||||
this->mw = mainWindow;
|
||||
actionPolyhedronIntersection_3 = new QAction("Intersect polyhedra (A/B)", mw);
|
||||
actionPolyhedronIntersection_3->setProperty("subMenuName", "Operation on multiple polyhedra");
|
||||
if(actionPolyhedronIntersection_3) {
|
||||
connect(actionPolyhedronIntersection_3, SIGNAL(triggered()),
|
||||
this, SLOT(intersection()));
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@ public:
|
|||
QStringList actionsNames() const {
|
||||
return QStringList() << "actionEstimateCurvature";
|
||||
}
|
||||
void init(QMainWindow* mainWindow,
|
||||
Scene_interface* scene_interface)
|
||||
{
|
||||
mw = mainWindow;
|
||||
scene = scene_interface;
|
||||
actions_map["actionEstimateCurvature"] = getActionFromMainWindow(mw, "actionEstimateCurvature");
|
||||
actions_map["actionEstimateCurvature"]->setProperty("subMenuName", "Object creation");
|
||||
autoConnectActions();
|
||||
|
||||
}
|
||||
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
|
|
|
|||
|
|
@ -32,10 +32,13 @@ public:
|
|||
{
|
||||
msg_interface = m;
|
||||
actionJoinPolyhedra= new QAction(tr("Join selected polyhedra"), mainWindow);
|
||||
actionJoinPolyhedra->setProperty("subMenuName", "Operation on multiple polyhedra");
|
||||
actionJoinPolyhedra->setObjectName("actionJoinPolyhedra");
|
||||
actionSplitPolyhedra= new QAction(tr("Split selected polyhedra"), mainWindow);
|
||||
actionSplitPolyhedra->setProperty("subMenuName", "Operation on multiple polyhedra");
|
||||
actionSplitPolyhedra->setObjectName("actionSplitPolyhedra");
|
||||
actionColorConnectedComponents = new QAction(tr("Color each connected component of selected polyhedra"), mainWindow);
|
||||
actionColorConnectedComponents ->setProperty("subMenuName", "Color alteration");
|
||||
actionColorConnectedComponents->setObjectName("actionColorConnectedComponents");
|
||||
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,9 +119,12 @@ public:
|
|||
ui = NULL;
|
||||
|
||||
actionMCFSkeleton = new QAction(tr("Mean Curvature Skeleton (Advanced)"), mainWindow);
|
||||
actionMCFSkeleton->setProperty("subMenuName", "Object creation");
|
||||
actionMCFSkeleton->setObjectName("actionMCFSkeleton");
|
||||
|
||||
actionConvert_to_medial_skeleton = new QAction(tr("Extract Medial Skeleton"), mainWindow);
|
||||
actionConvert_to_medial_skeleton->setProperty("subMenuName", "Object creation");
|
||||
|
||||
actionConvert_to_medial_skeleton->setObjectName("actionConvert_to_medial_skeleton");
|
||||
|
||||
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public:
|
|||
this->mw = mainWindow;
|
||||
actionMesh_3 = new QAction("Create a tetrahedral mesh", mw);
|
||||
if(actionMesh_3) {
|
||||
actionMesh_3->setProperty("subMenuName", "Operations with plane");
|
||||
connect(actionMesh_3, SIGNAL(triggered()),
|
||||
this, SLOT(mesh_3()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public:
|
|||
this->scene = scene_interface;
|
||||
this->mw = mainWindow;
|
||||
actionSegmentation = new QAction("Mesh Segmentation", mw);
|
||||
actionSegmentation->setProperty("subMenuName", "Color alteration");
|
||||
connect(actionSegmentation, SIGNAL(triggered()),this, SLOT(on_actionSegmentation_triggered()));
|
||||
|
||||
// adding slot for itemAboutToBeDestroyed signal, aim is removing item from item-functor map.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <QMainWindow>
|
||||
#include <QInputDialog>
|
||||
#include <QTime>
|
||||
#include <QAction>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h>
|
||||
#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
|
||||
|
|
@ -27,6 +28,16 @@ public:
|
|||
return QStringList() << "actionSimplify";
|
||||
}
|
||||
|
||||
void init(QMainWindow* mainWindow,
|
||||
Scene_interface* scene_interface)
|
||||
{
|
||||
mw = mainWindow;
|
||||
scene = scene_interface;
|
||||
actions_map["actionSimplify"] = getActionFromMainWindow(mw, "actionSimplify");
|
||||
actions_map["actionSimplify"]->setProperty("subMenuName", "Action on mesh");
|
||||
autoConnectActions();
|
||||
|
||||
}
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,24 @@ public:
|
|||
<< "actionMinkowskiSum";
|
||||
}
|
||||
|
||||
void init(QMainWindow* mainWindow,
|
||||
Scene_interface* scene_interface)
|
||||
{
|
||||
mw = mainWindow;
|
||||
scene = scene_interface;
|
||||
actions_map["actionConvexDecomposition"] = getActionFromMainWindow(mw, "actionConvexDecomposition");
|
||||
actions_map["actionConvexDecomposition"]->setProperty("subMenuName", "Object creation");
|
||||
|
||||
actions_map["actionToNef"] = getActionFromMainWindow(mw, "actionToNef");
|
||||
actions_map["actionToPoly"] = getActionFromMainWindow(mw, "actionToPoly");
|
||||
actions_map["actionUnion"] = getActionFromMainWindow(mw, "actionUnion");
|
||||
actions_map["actionIntersection"] = getActionFromMainWindow(mw, "actionIntersection");
|
||||
actions_map["actionDifference"] = getActionFromMainWindow(mw, "actionDifference");
|
||||
actions_map["actionMinkowskiSum"] = getActionFromMainWindow(mw, "actionMinkowskiSum");
|
||||
autoConnectActions();
|
||||
|
||||
}
|
||||
|
||||
bool applicable(QAction*) const {
|
||||
const int indexA = scene->selectionAindex();
|
||||
const int indexB = scene->selectionBindex();
|
||||
|
|
|
|||
|
|
@ -62,15 +62,18 @@ void Polyhedron_demo_orient_soup_plugin::init(QMainWindow* mainWindow,
|
|||
messages = m;
|
||||
actionOrient = new QAction(tr("&Orient polygon soup"), mainWindow);
|
||||
actionOrient->setObjectName("actionOrient");
|
||||
actionOrient->setProperty("subMenuName", "Action on normals");
|
||||
connect(actionOrient, SIGNAL(triggered()),
|
||||
this, SLOT(orient()));
|
||||
|
||||
actionShuffle = new QAction(tr("&Shuffle polygon soup"), mainWindow);
|
||||
actionShuffle->setProperty("subMenuName", "Action on normals");
|
||||
connect(actionShuffle, SIGNAL(triggered()),
|
||||
this, SLOT(shuffle()));
|
||||
|
||||
actionDisplayNonManifoldEdges = new QAction(tr("Display non manifold edges"),
|
||||
mainWindow);
|
||||
actionDisplayNonManifoldEdges->setProperty("subMenuName", "Detection");
|
||||
connect(actionDisplayNonManifoldEdges, SIGNAL(triggered()),
|
||||
this, SLOT(displayNonManifoldEdges()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <QApplication>
|
||||
#include <QAction>
|
||||
#include <QMainWindow>
|
||||
#include <QStringList>
|
||||
|
||||
#include "Scene_polyhedron_item.h"
|
||||
|
|
@ -40,6 +41,24 @@ public:
|
|||
<< "actionLSC";
|
||||
}
|
||||
|
||||
void init(QMainWindow* mainWindow,
|
||||
Scene_interface* scene_interface)
|
||||
{
|
||||
mw = mainWindow;
|
||||
scene = scene_interface;
|
||||
actions_map["actionMVC"] = new QAction("MVC", mw);
|
||||
actions_map["actionMVC"]->setProperty("subMenuName", "Color alteration/Parametrization");
|
||||
|
||||
actions_map["actionDCP"] = new QAction ("DCP", mw);
|
||||
actions_map["actionDCP"]->setProperty("subMenuName", "Color alteration/Parametrization");
|
||||
|
||||
connect(actions_map["actionMVC"], SIGNAL(triggered()),
|
||||
this, SLOT(on_actionMVC_triggered()));
|
||||
connect(actions_map["actionDCP"], SIGNAL(triggered()),
|
||||
this, SLOT(on_actionDCP_triggered()));
|
||||
|
||||
}
|
||||
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#include <QApplication>
|
||||
#include <QAction>
|
||||
#include <QMainWindow>
|
||||
#include "Scene_polyhedron_item.h"
|
||||
#include "Scene_plane_item.h"
|
||||
#include "Polyhedron_type.h"
|
||||
|
|
@ -39,6 +41,25 @@ public:
|
|||
<< "actionFitLine";
|
||||
}
|
||||
|
||||
void init(QMainWindow* mainWindow,
|
||||
Scene_interface* scene_interface)
|
||||
{
|
||||
mw = mainWindow;
|
||||
scene = scene_interface;
|
||||
actions_map["actionFitPlane"] = new QAction("Fit Plane", mw);
|
||||
actions_map["actionFitPlane"]->setProperty("subMenuName", "Object creation/PCA");
|
||||
|
||||
actions_map["actionFitLine"] = new QAction("Fit Line", mw);
|
||||
actions_map["actionFitLine"]->setProperty("subMenuName", "Object creation/PCA");
|
||||
|
||||
connect(actions_map["actionFitPlane"], SIGNAL(triggered()),
|
||||
this, SLOT(on_actionFitPlane_triggered()));
|
||||
connect(actions_map["actionFitLine"], SIGNAL(triggered()),
|
||||
this, SLOT(on_actionFitLine_triggered()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <QVector>
|
||||
#include <QSet>
|
||||
#include <QDockWidget>
|
||||
#include "MainWindow.h"
|
||||
|
||||
QAction*
|
||||
Polyhedron_demo_plugin_helper::
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ public:
|
|||
messages = m;
|
||||
|
||||
actionPointInsidePolyhedron = new QAction(tr("Point Inside Polyhedron"), mw);
|
||||
actionPointInsidePolyhedron->setProperty("subMenuName", "Object creation");
|
||||
connect(actionPointInsidePolyhedron, SIGNAL(triggered()), this, SLOT(point_inside_polyhedron_action()));
|
||||
|
||||
dock_widget = new QDockWidget("Point Inside Polyhedron", mw);
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ void Polyhedron_demo_polyhedron_slicer_plugin::init(QMainWindow* mainWindow,
|
|||
plane_item = NULL;
|
||||
|
||||
actionSlicerWidget = new QAction(tr("Polyhedron Slicer"), mw);
|
||||
actionSlicerWidget->setProperty("subMenuName", "Operations with plane");
|
||||
connect(actionSlicerWidget, SIGNAL(triggered()), this, SLOT(slicer_widget_action()));
|
||||
|
||||
dock_widget = new QDockWidget("Polyhedron Slicer", mw);
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ public:
|
|||
actionStitchBorders= new QAction(tr("Stitch polyhedron duplicated boundaries"), mainWindow);
|
||||
actionDetectBorders->setObjectName("actionDetectBorders");
|
||||
actionStitchBorders->setObjectName("actionStitchBorders");
|
||||
actionDetectBorders->setProperty("subMenuName", "Detection operations");
|
||||
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ public:
|
|||
this->scene = scene_interface;
|
||||
this->mw = mainWindow;
|
||||
actionRemeshing = this->getActionFromMainWindow(mw, "actionRemeshing");
|
||||
actionRemeshing->setProperty("subMenuName", "Action on mesh");
|
||||
if(actionRemeshing) {
|
||||
connect(actionRemeshing, SIGNAL(triggered()),
|
||||
this, SLOT(remesh()));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <QApplication>
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QMainWindow>
|
||||
#include "opengl_tools.h"
|
||||
|
|
@ -33,6 +34,17 @@ public:
|
|||
return QStringList() << "actionSelfIntersection";
|
||||
}
|
||||
|
||||
void init(QMainWindow* mainWindow,
|
||||
Scene_interface* scene_interface)
|
||||
{
|
||||
mw = mainWindow;
|
||||
scene = scene_interface;
|
||||
actions_map["actionSelfIntersection"] = getActionFromMainWindow(mw, "actionSelfIntersection");
|
||||
actions_map["actionSelfIntersection"]->setProperty("subMenuName", "Detection operations");
|
||||
autoConnectActions();
|
||||
|
||||
}
|
||||
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ public:
|
|||
this->m_messages = messages;
|
||||
|
||||
dock_widget = new QDockWidget("Shortest path", mw);
|
||||
|
||||
dock_widget->setVisible(false);
|
||||
|
||||
ui_widget.setupUi(dock_widget);
|
||||
|
|
@ -88,6 +89,7 @@ public:
|
|||
connect(ui_widget.Primitives_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Primitives_type_combo_box_changed(int)));
|
||||
|
||||
actionMakeShortestPaths = new QAction("Make Shortest Path", this->mw);
|
||||
actionMakeShortestPaths->setProperty("subMenuName", "Object creation");
|
||||
|
||||
connect(actionMakeShortestPaths, SIGNAL(triggered()), this, SLOT(on_actionMakeShortestPaths_triggered()));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include <QTime>
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <QAction>
|
||||
|
||||
#include "Polyhedron_demo_plugin_helper.h"
|
||||
#include "Polyhedron_demo_plugin_interface.h"
|
||||
|
|
@ -23,6 +25,32 @@ public:
|
|||
<< "actionSqrt3";
|
||||
}
|
||||
|
||||
void init(QMainWindow* mainWindow,
|
||||
Scene_interface* scene_interface)
|
||||
{
|
||||
mw = mainWindow;
|
||||
scene = scene_interface;
|
||||
actions_map["actionLoop"] = new QAction("Loop", mw);
|
||||
actions_map["actionLoop"]->setProperty("subMenuName", "Action on mesh/Subdivisions");
|
||||
|
||||
actions_map["actionCatmullClark"] = new QAction("Catmull Clark", mw);
|
||||
actions_map["actionCatmullClark"]->setProperty("subMenuName", "Action on mesh/Subdivisions");
|
||||
|
||||
actions_map["actionSqrt3"] = new QAction("Sqrt3", mw);
|
||||
actions_map["actionSqrt3"]->setProperty("subMenuName", "Action on mesh/Subdivisions");
|
||||
|
||||
//autoConnectActions();
|
||||
connect(actions_map["actionLoop"], SIGNAL(triggered()),
|
||||
this, SLOT(on_actionLoop_triggered()));
|
||||
|
||||
connect(actions_map["actionCatmullClark"], SIGNAL(triggered()),
|
||||
this, SLOT(on_actionCatmullClark_triggered()));
|
||||
|
||||
connect(actions_map["actionSqrt3"], SIGNAL(triggered()),
|
||||
this, SLOT(on_actionSqrt3_triggered()));
|
||||
|
||||
}
|
||||
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,11 +29,13 @@ public:
|
|||
this->mw = mainWindow;
|
||||
this->messages = m;
|
||||
actionTriangulateFacets = new QAction("Triangulate facets", mw);
|
||||
actionTriangulateFacets->setProperty("subMenuName","Action on mesh");
|
||||
if(actionTriangulateFacets) {
|
||||
connect(actionTriangulateFacets, SIGNAL(triggered()),
|
||||
this, SLOT(triangulate()));
|
||||
}
|
||||
actionUnTriangulateFacets = new QAction("Untriangulate facets", mw);
|
||||
actionUnTriangulateFacets->setProperty("subMenuName","Action on mesh");
|
||||
if(actionUnTriangulateFacets) {
|
||||
connect(actionUnTriangulateFacets, SIGNAL(triggered()),
|
||||
this, SLOT(untriangulate()));
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ void Polyhedron_demo_trivial_plugin::init(QMainWindow* mainWindow, Scene_interfa
|
|||
{
|
||||
scene = scene_interface;
|
||||
actionBbox = new QAction(tr("Create bbox"), mainWindow);
|
||||
actionBbox->setProperty("subMenuName", "Object creation");
|
||||
connect(actionBbox, SIGNAL(triggered()),
|
||||
this, SLOT(bbox()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue