mirror of https://github.com/CGAL/cgal
applicable now depends on the action
This commit is contained in:
parent
632a37317d
commit
b9fbda6c0c
|
|
@ -54,7 +54,7 @@ public:
|
|||
Io_implicit_function_plugin();
|
||||
virtual ~Io_implicit_function_plugin() {}
|
||||
|
||||
bool applicable() const { return true; }
|
||||
bool applicable(QAction*) const { return true; }
|
||||
|
||||
QString name() const { return "implicit functions"; }
|
||||
// QString nameFilters() const { return ""; }
|
||||
|
|
|
|||
|
|
@ -340,14 +340,8 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
void MainWindow::filterOperations()
|
||||
{
|
||||
Q_FOREACH(const PluginNamePair& p, plugins) {
|
||||
if(p.first->applicable()) {
|
||||
Q_FOREACH(QAction* action, p.first->actions()) {
|
||||
action->setVisible(true);
|
||||
}
|
||||
} else {
|
||||
Q_FOREACH(QAction* action, p.first->actions()) {
|
||||
action->setVisible(false);
|
||||
}
|
||||
Q_FOREACH(QAction* action, p.first->actions()) {
|
||||
action->setVisible( p.first->applicable(action) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
bool canSave(const Scene_item*) { return false; }
|
||||
bool save(const Scene_item*, QFileInfo ) {return false; }
|
||||
bool applicable() const {return false;}
|
||||
bool applicable(QAction*) const {return false;}
|
||||
private:
|
||||
Camera_positions_list* cpl;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
return QStringList() << "actionConvexHull";
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return
|
||||
qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())) ||
|
||||
qobject_cast<Scene_polylines_item*>(scene->item(scene->mainSelectionIndex())) ||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class Polyhedron_demo_corefinement_plugin :
|
|||
|
||||
public:
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ public:
|
|||
|
||||
virtual ~Polyhedron_demo_cut_plugin();
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
// returns true if one polyhedron is in the entries
|
||||
for (int i=0; i< scene->numberOfEntries(); ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
void init(QMainWindow* mainWindow, Scene_interface* scene_interface);
|
||||
QList<QAction*> actions() const;
|
||||
bool applicable() const;
|
||||
bool applicable(QAction*) const;
|
||||
|
||||
public slots:
|
||||
void on_actionDeformation_triggered();
|
||||
|
|
@ -69,7 +69,7 @@ private:
|
|||
QList<QAction*> Polyhedron_demo_edit_polyhedron_plugin::actions() const {
|
||||
return QList<QAction*>() << actionDeformation;
|
||||
}
|
||||
bool Polyhedron_demo_edit_polyhedron_plugin::applicable() const {
|
||||
bool Polyhedron_demo_edit_polyhedron_plugin::applicable(QAction*) const {
|
||||
Q_FOREACH(Scene_interface::Item_id i, scene->selectionIndices())
|
||||
{
|
||||
if(qobject_cast<Scene_polyhedron_item*>(scene->item(i))
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public:
|
|||
return QStringList() << "actionInsideOut";
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
const Scene_interface::Item_id index = scene->mainSelectionIndex();
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(index))
|
||||
|| qobject_cast<Scene_polygon_soup_item*>(scene->item(index));
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Polyhedron_demo_intersection_plugin :
|
|||
|
||||
public:
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public:
|
|||
return QStringList() << "actionEstimateCurvature";
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public:
|
|||
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
Q_FOREACH(int index, scene->selectionIndices())
|
||||
{
|
||||
if ( qobject_cast<Scene_polyhedron_item*>(scene->item(index)) )
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public:
|
|||
return QStringList() << "actionKernel";
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
return QList<QAction*>() << actionMesh_3;
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
public slots:
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public:
|
|||
return QList<QAction*>() << actionSegmentation;
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return
|
||||
qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
return QStringList() << "actionSimplify";
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
public slots:
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
<< "actionMinkowskiSum";
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
const int indexA = scene->selectionAindex();
|
||||
const int indexB = scene->selectionBindex();
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public:
|
|||
return QList<QAction*>() << actionNormalEstimation << actionNormalInversion;
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
#if CGAL_DISABLE_NORMAL_ESTIMATION_PLUGIN
|
||||
return false;
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -23,10 +23,14 @@ public:
|
|||
Scene_interface* scene_interface,
|
||||
Messages_interface* m);
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction* action) const {
|
||||
Q_FOREACH(Scene_interface::Item_id index, scene->selectionIndices()) {
|
||||
if(qobject_cast<Scene_polygon_soup_item*>(scene->item(index)))
|
||||
return true;
|
||||
else
|
||||
if (action==actionShuffle &&
|
||||
qobject_cast<Scene_polyhedron_item*>(scene->item(index)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public:
|
|||
<< "actionDCP";
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public:
|
|||
<< "actionFitLine";
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public:
|
|||
//!
|
||||
//! @returns \c true, if the plugin is applicable, \c false
|
||||
//! otherwise
|
||||
virtual bool applicable() const = 0;
|
||||
virtual bool applicable(QAction*) const = 0;
|
||||
virtual QList<QAction*> actions() const = 0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Polyhedron_demo_point_inside_polyhedron_plugin :
|
|||
Q_INTERFACES(Polyhedron_demo_plugin_interface)
|
||||
|
||||
public:
|
||||
bool applicable() const
|
||||
bool applicable(QAction*) const
|
||||
{
|
||||
bool poly_item_exists = false;
|
||||
bool point_item_exists = false;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
//! Applicable if the currently selected item is a
|
||||
//! points_with_normal_item.
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public:
|
|||
}
|
||||
|
||||
//! Applicate for Point_sets with normals.
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public:
|
|||
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public:
|
|||
return QList<QAction*>() << actionJetSmoothing;
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public:
|
|||
}
|
||||
|
||||
//! Applicate for Point_sets with normals.
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
Scene_points_with_normal_item* item =
|
||||
qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
return item && item->has_normals();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Polyhedron_demo_polyhedron_slicer_plugin :
|
|||
Q_INTERFACES(Polyhedron_demo_plugin_interface)
|
||||
|
||||
public:
|
||||
bool applicable() const { return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())); }
|
||||
bool applicable(QAction*) const { return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())); }
|
||||
void print_message(QString message) { messages->information(message);}
|
||||
|
||||
void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface* m);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public:
|
|||
Polyhedron_demo_plugin_helper::init(mainWindow, scene_interface);
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
Q_FOREACH(int index, scene->selectionIndices())
|
||||
{
|
||||
if ( qobject_cast<Scene_polyhedron_item*>(scene->item(index)) )
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public:
|
|||
}
|
||||
|
||||
//! Applicate for Point_sets with normals.
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Polyhedron_demo_selection_plugin :
|
|||
Q_INTERFACES(Polyhedron_demo_plugin_interface)
|
||||
|
||||
public:
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
|
||||
|| qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
return QStringList() << "actionSelfIntersection";
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public:
|
|||
<< "actionSqrt3";
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
public slots:
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
return QList<QAction*>() << actionTransformPolyhedron;
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex())) ||
|
||||
qobject_cast<Scene_polyhedron_transform_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
<< actionUnTriangulateFacets;
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
Q_FOREACH(Scene_interface::Item_id index, scene->selectionIndices()) {
|
||||
Scene_polyhedron_item* item = qobject_cast<Scene_polyhedron_item*>(scene->item(index));
|
||||
if(!item) return false;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ public:
|
|||
return QList<QAction*>() << actionBbox;
|
||||
}
|
||||
|
||||
bool applicable() const {
|
||||
bool applicable(QAction*) const {
|
||||
return true;
|
||||
}
|
||||
public slots:
|
||||
|
|
|
|||
Loading…
Reference in New Issue