mirror of https://github.com/CGAL/cgal
Update interface version
This commit is contained in:
parent
1fba61107d
commit
e717987f64
|
|
@ -342,41 +342,6 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren
|
|||
this, &MainWindow::filterOperations);
|
||||
loadPlugins();
|
||||
|
||||
//If 3mf plugin is present, add action to save scene
|
||||
Polyhedron_demo_io_plugin_interface* io_3mf_plugin = nullptr;
|
||||
for(Polyhedron_demo_io_plugin_interface* plugin : io_plugins)
|
||||
{
|
||||
if(plugin->name() == "3mf_io_plugin")
|
||||
{
|
||||
io_3mf_plugin = plugin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(io_3mf_plugin )
|
||||
{
|
||||
QAction* actionSaveSceneTo3mf = new QAction("Save the Scene as a 3mf File...");
|
||||
QString dir = QString("%1/scene").arg(def_save_dir);
|
||||
connect(actionSaveSceneTo3mf, &QAction::triggered, this,
|
||||
[this, dir, io_3mf_plugin](){
|
||||
|
||||
QString filename =
|
||||
QFileDialog::getSaveFileName(this,
|
||||
tr("Save Scene to File..."),
|
||||
dir,
|
||||
"*.3mf");
|
||||
|
||||
if(filename.isEmpty())
|
||||
return;
|
||||
if(!filename.endsWith(".3mf"))
|
||||
filename.append(".3mf");
|
||||
QList<Scene_item*> all_items;
|
||||
for(int i = 0; i< scene->numberOfEntries(); ++i)
|
||||
all_items.push_back(scene->item(i));
|
||||
io_3mf_plugin->save(filename, all_items);
|
||||
});
|
||||
ui->menuFile->insertAction(ui->actionSa_ve_Scene_as_Script, actionSaveSceneTo3mf);
|
||||
}
|
||||
|
||||
// Setup the submenu of the View menu that can toggle the dockwidgets
|
||||
Q_FOREACH(QDockWidget* widget, findChildren<QDockWidget*>()) {
|
||||
ui->menuDockWindows->addAction(widget->toggleViewAction());
|
||||
|
|
@ -824,6 +789,7 @@ bool MainWindow::initIOPlugin(QObject* obj)
|
|||
CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin =
|
||||
qobject_cast<CGAL::Three::Polyhedron_demo_io_plugin_interface*>(obj);
|
||||
if(plugin) {
|
||||
plugin->init();
|
||||
io_plugins << plugin;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class Polyhedron_demo_camera_positions_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90")
|
||||
|
||||
public:
|
||||
void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface* );
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Io_3mf_plugin:
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "3mf_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "3mf_io_plugin.json")
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
typedef std::vector<Kernel::Point_3> PointRange;
|
||||
|
|
@ -33,6 +33,31 @@ class Io_3mf_plugin:
|
|||
typedef std::vector<Polygon> PolygonRange;
|
||||
typedef std::list<PointRange> PolylineRange;
|
||||
typedef std::vector<CGAL::Color> ColorRange;
|
||||
void init() Q_DECL_OVERRIDE
|
||||
{
|
||||
QMenu* menuFile = CGAL::Three::Three::mainWindow()->findChild<QMenu*>("menuFile");
|
||||
|
||||
QAction* actionSaveSceneTo3mf = new QAction("Save the Scene as a 3mf File...");
|
||||
connect(actionSaveSceneTo3mf, &QAction::triggered, this,
|
||||
[this](){
|
||||
|
||||
QString filename =
|
||||
QFileDialog::getSaveFileName(CGAL::Three::Three::mainWindow(),
|
||||
tr("Save Scene to File..."),
|
||||
QString(),
|
||||
"*.3mf");
|
||||
|
||||
if(filename.isEmpty())
|
||||
return;
|
||||
if(!filename.endsWith(".3mf"))
|
||||
filename.append(".3mf");
|
||||
QList<Scene_item*> all_items;
|
||||
for(int i = 0; i< CGAL::Three::Three::scene()->numberOfEntries(); ++i)
|
||||
all_items.push_back(CGAL::Three::Three::scene()->item(i));
|
||||
save(filename, all_items);
|
||||
});
|
||||
menuFile->insertAction(CGAL::Three::Three::mainWindow()->findChild<QAction*>("actionSa_ve_Scene_as_Script"), actionSaveSceneTo3mf);
|
||||
}
|
||||
QString name() const { return "3mf_io_plugin"; }
|
||||
|
||||
|
||||
|
|
@ -40,10 +65,10 @@ class Io_3mf_plugin:
|
|||
"3mf files (*.3mf)"; }
|
||||
|
||||
|
||||
bool canLoad(QFileInfo) const { return true; }
|
||||
bool canLoad(QFileInfo) const Q_DECL_OVERRIDE { return true; }
|
||||
|
||||
|
||||
QList<CGAL::Three::Scene_item*> load(QFileInfo fileinfo, bool& ok, bool add_to_scene=true){
|
||||
QList<CGAL::Three::Scene_item*> load(QFileInfo fileinfo, bool& ok, bool add_to_scene=true) Q_DECL_OVERRIDE {
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
// Open file
|
||||
ok = true;
|
||||
|
|
@ -151,10 +176,10 @@ class Io_3mf_plugin:
|
|||
}
|
||||
|
||||
|
||||
bool canSave(const CGAL::Three::Scene_item*){return false;}
|
||||
bool canSave(const CGAL::Three::Scene_item*) Q_DECL_OVERRIDE {return false;}
|
||||
|
||||
|
||||
bool save(QFileInfo fi, QList<CGAL::Three::Scene_item*>& items){
|
||||
bool save(QFileInfo fi, QList<CGAL::Three::Scene_item*>& items) Q_DECL_OVERRIDE {
|
||||
|
||||
QList<CGAL::Three::Scene_item*> to_return;
|
||||
std::vector<Scene_surface_mesh_item*> sm_items;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Polyhedron_demo_gocad_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "gocad_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" )
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" )
|
||||
|
||||
public:
|
||||
void init(QMainWindow* mainWindow,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class Polyhedron_demo_las_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "las_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "las_io_plugin.json")
|
||||
|
||||
public:
|
||||
QString name() const { return "las_plugin"; }
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Polyhedron_demo_off_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "off_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "off_io_plugin.json")
|
||||
|
||||
public:
|
||||
bool isDefaultLoader(const Scene_item *item) const
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class Polyhedron_demo_off_to_nef_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "off_to_nef_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "off_to_nef_io_plugin.json")
|
||||
|
||||
public:
|
||||
QString name() const { return "off_to_nef_plugin"; }
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class Polyhedron_demo_ply_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "ply_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "ply_io_plugin.json")
|
||||
|
||||
public:
|
||||
bool isDefaultLoader(const CGAL::Three::Scene_item *item) const
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class Polyhedron_demo_polylines_io_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "polylines_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90")
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class Polyhedron_demo_stl_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "stl_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90")
|
||||
|
||||
public:
|
||||
void init(QMainWindow* mainWindow,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Surf_io_plugin:
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "surf_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90")
|
||||
|
||||
public:
|
||||
void init(QMainWindow* mainWindow,
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ class Polyhedron_demo_vtk_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "vtk_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "vtk_io_plugin.json")
|
||||
|
||||
public:
|
||||
typedef boost::graph_traits<FaceGraph>::vertex_descriptor vertex_descriptor;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class Polyhedron_demo_xyz_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "xyz_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "xyz_io_plugin.json")
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class LCC_io_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "lcc_io_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "lcc_io_plugin.json")
|
||||
|
||||
public:
|
||||
bool isDefaultLoader(const CGAL::Three::Scene_item *item) const
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ class Io_image_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0" FILE "io_image_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "io_image_plugin.json")
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class Polyhedron_demo_selection_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "selection_plugin.json")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90")
|
||||
public:
|
||||
QString nameFilters() const { return "Selection files(*.selection.txt)"; }
|
||||
QString name() const { return "selection_sm_plugin"; }
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class Polyhedron_demo_features_detection_plugin :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
|
||||
QAction* actionDetectFeatures;
|
||||
public:
|
||||
QList<QAction*> actions() const { return QList<QAction*>() << actionDetectFeatures; }
|
||||
|
|
|
|||
|
|
@ -28,16 +28,23 @@
|
|||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
#include <QtPlugin>
|
||||
|
||||
class QMainWindow;
|
||||
class Messages_interface;
|
||||
namespace CGAL{
|
||||
namespace Three {
|
||||
class Scene_item;
|
||||
class Scene_interface;
|
||||
/*!
|
||||
* This class provides a base for creating a new IO plugin.
|
||||
*/
|
||||
class Polyhedron_demo_io_plugin_interface
|
||||
{
|
||||
public:
|
||||
//! \brief Initializes the plugin
|
||||
//! This function is called in the constructor of the MainWindow.
|
||||
//! Whatever initialization the plugin needs can be done here. Default
|
||||
//! behavior is to do nothing.
|
||||
virtual void init(){}
|
||||
//!Returns the name of the plugin
|
||||
//!It is used by the loading system.
|
||||
virtual QString name() const = 0;
|
||||
|
|
@ -89,6 +96,6 @@ public:
|
|||
}
|
||||
}
|
||||
Q_DECLARE_INTERFACE(CGAL::Three::Polyhedron_demo_io_plugin_interface,
|
||||
"com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
|
||||
"com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90")
|
||||
|
||||
#endif // POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue