mirror of https://github.com/CGAL/cgal
Mesh_3 demonstration working.
This commit is contained in:
parent
ff94f3bf39
commit
b460fa3596
|
|
@ -95,6 +95,7 @@ if((QT4 OR QT5) AND OPENGL_FOUND AND QGLVIEWER_FOUND AND Boost_FOUND)
|
|||
qt_wrap_ui( funcUI_FILES ui_files/Function_dialog.ui)
|
||||
qt_wrap_ui( imgUI_FILES ui_files/Image_res_dialog.ui)
|
||||
|
||||
|
||||
include(AddFileDependencies)
|
||||
|
||||
# Shared demo files directory
|
||||
|
|
@ -232,14 +233,24 @@ if(QT4)
|
|||
|
||||
add_definitions(-DUSE_FORWARD_DECL)
|
||||
add_definitions(-DQT_STATICPLUGIN)
|
||||
add_executable ( Mesh_3 MainWindow.cpp
|
||||
|
||||
if(QT4)
|
||||
add_executable ( Mesh_3 MainWindow.cpp
|
||||
Mesh_3.cpp
|
||||
${DEMO_SRC_DIR}/Scene.cpp
|
||||
MainWindow_moc.cpp
|
||||
Scene_moc.cpp
|
||||
${UI_FILES} ${RESOURCE_FILES} )
|
||||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Mesh_3 )
|
||||
|
||||
endif(QT4)
|
||||
if(QT5)
|
||||
add_executable ( Mesh_3 MainWindow.cpp
|
||||
Mesh_3.cpp
|
||||
${DEMO_SRC_DIR}/Scene.cpp
|
||||
Scene_moc.cpp
|
||||
${UI_FILES} ${RESOURCE_FILES} )
|
||||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Mesh_3 )
|
||||
endif(QT5)
|
||||
# Link with Qt libraries
|
||||
target_link_libraries( Mesh_3 ${QT_LIBRARIES} )
|
||||
|
||||
|
|
@ -275,12 +286,8 @@ if(QT4)
|
|||
qt_generate_moc( "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" ${plugin_implementation_base_name}.moc )
|
||||
add_file_dependencies( ${plugin_implementation_base_name}.moc "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" )
|
||||
|
||||
if(QT5)
|
||||
add_library(${plugin_name} MODULE ${option} ${plugin_implementation_base_name}.cpp)
|
||||
endif()
|
||||
if(QT4)
|
||||
add_library(${plugin_name} MODULE ${option} ${plugin_implementation_base_name}.moc ${plugin_implementation_base_name}.cpp ${other_sources})
|
||||
endif()
|
||||
add_library(${plugin_name} MODULE ${option} ${plugin_implementation_base_name}.moc ${plugin_implementation_base_name}.cpp ${other_sources})
|
||||
|
||||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${plugin_name} )
|
||||
# Link with Qt
|
||||
target_link_libraries( ${plugin_name} ${QT_LIBRARIES} )
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <CGAL_demo/Io_plugin_interface.h>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
class Io_c3t3_plugin :
|
||||
public QObject,
|
||||
public Io_plugin_interface
|
||||
|
|
@ -10,6 +11,10 @@ class Io_c3t3_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(Io_plugin_interface)
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")//New for Qt5 version !
|
||||
#endif
|
||||
|
||||
public:
|
||||
virtual QStringList nameFilters() const;
|
||||
|
||||
|
|
@ -20,7 +25,6 @@ public:
|
|||
virtual bool save(const Scene_item*, QFileInfo fileinfo);
|
||||
};
|
||||
|
||||
|
||||
QStringList
|
||||
Io_c3t3_plugin::nameFilters() const
|
||||
{
|
||||
|
|
@ -51,7 +55,8 @@ Io_c3t3_plugin::save(const Scene_item* item, QFileInfo fileInfo)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QtPlugin>
|
||||
Q_EXPORT_PLUGIN2(Io_c3t3_plugin, Io_c3t3_plugin)
|
||||
#endif
|
||||
#include "Io_c3t3_plugin.moc"
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@ class Io_image_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(Io_plugin_interface)
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")//New for Qt5 version !
|
||||
#endif
|
||||
|
||||
public:
|
||||
Io_image_plugin() {
|
||||
#ifdef SCENE_SEGMENTED_IMAGE_GL_BUFFERS_AVAILABLE
|
||||
|
|
@ -30,6 +34,7 @@ public:
|
|||
bool save(const Scene_item*, QFileInfo) { return false; }
|
||||
};
|
||||
|
||||
|
||||
QStringList Io_image_plugin::nameFilters() const {
|
||||
return QStringList() << "Inrimage files (*.inr *.inr.gz)"
|
||||
<< "Analyze files (*.hdr *.img *img.gz)"
|
||||
|
|
@ -87,6 +92,8 @@ bool Io_image_plugin::canSave(const Scene_item*)
|
|||
return false;
|
||||
}
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QtPlugin>
|
||||
Q_EXPORT_PLUGIN2(Io_image_plugin, Io_image_plugin)
|
||||
#endif
|
||||
#include "Io_image_plugin.moc"
|
||||
|
|
|
|||
|
|
@ -39,13 +39,17 @@
|
|||
#include <QList>
|
||||
#include <QLibrary>
|
||||
|
||||
|
||||
class Io_implicit_function_plugin :
|
||||
public QObject,
|
||||
protected Plugin_helper
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Plugin_interface)
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")//New for Qt5 version !
|
||||
#endif
|
||||
public:
|
||||
Io_implicit_function_plugin();
|
||||
virtual ~Io_implicit_function_plugin() {}
|
||||
|
|
@ -196,7 +200,8 @@ load_function_plugins()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QtPlugin>
|
||||
Q_EXPORT_PLUGIN2(Io_implicit_function_plugin, Io_implicit_function_plugin)
|
||||
#endif
|
||||
#include "Io_implicit_function_plugin.moc"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <CGAL_demo/Io_plugin_interface.h>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
class Io_off_plugin :
|
||||
public QObject,
|
||||
public Io_plugin_interface
|
||||
|
|
@ -12,6 +13,9 @@ class Io_off_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(Io_plugin_interface)
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")//New for Qt5 version !
|
||||
#endif
|
||||
public:
|
||||
QStringList nameFilters() const;
|
||||
bool canLoad() const;
|
||||
|
|
@ -85,7 +89,8 @@ bool Io_off_plugin::save(const Scene_item* item, QFileInfo fileinfo)
|
|||
return (poly_item && poly_item->save(out)) ||
|
||||
(soup_item && soup_item->save(out));
|
||||
}
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QtPlugin>
|
||||
Q_EXPORT_PLUGIN2(Io_off_plugin, Io_off_plugin)
|
||||
#endif
|
||||
#include "Io_off_plugin.moc"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
#include <CGAL/Mesh_optimization_return_code.h>
|
||||
#include <CGAL/Mesh_3/parameters_defaults.h> // to get default values
|
||||
|
||||
|
||||
// declare the CGAL function
|
||||
Optimizer_thread* cgal_code_odt_mesh_3(Scene_c3t3_item& c3t3_item,
|
||||
const double time_limit,
|
||||
|
|
@ -60,6 +59,7 @@ Optimizer_thread* cgal_code_exude_mesh_3(Scene_c3t3_item& c3t3_item,
|
|||
|
||||
QString translate(CGAL::Mesh_optimization_return_code rc);
|
||||
|
||||
|
||||
// Mesh_3_optimization_plugin class
|
||||
class Mesh_3_optimization_plugin :
|
||||
public QObject,
|
||||
|
|
@ -68,6 +68,10 @@ class Mesh_3_optimization_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(Plugin_interface)
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")//New for Qt5 version !
|
||||
#endif
|
||||
|
||||
typedef Plugin_helper Base;
|
||||
public:
|
||||
Mesh_3_optimization_plugin();
|
||||
|
|
@ -104,7 +108,6 @@ private:
|
|||
Scene_c3t3_item* source_item_;
|
||||
}; // end class Mesh_3_optimization_plugin
|
||||
|
||||
|
||||
Mesh_3_optimization_plugin::
|
||||
Mesh_3_optimization_plugin()
|
||||
: actionOdt(NULL)
|
||||
|
|
@ -584,7 +587,9 @@ translate(CGAL::Mesh_optimization_return_code rc)
|
|||
}
|
||||
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
Q_EXPORT_PLUGIN2(Mesh_3_optimization_plugin, Mesh_3_optimization_plugin)
|
||||
#endif
|
||||
|
||||
#include "Mesh_3_optimization_plugin.moc"
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include <fstream>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
// Constants
|
||||
const QColor default_mesh_color(45,169,70);
|
||||
|
||||
|
|
@ -62,14 +63,17 @@ Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface*,
|
|||
double get_approximate(double d, int precision, int& decimals);
|
||||
|
||||
|
||||
|
||||
class Mesh_3_plugin :
|
||||
public QObject,
|
||||
protected Plugin_helper
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Plugin_interface)
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")//New for Qt5 version !
|
||||
#endif
|
||||
|
||||
typedef Plugin_helper Base;
|
||||
public:
|
||||
Mesh_3_plugin();
|
||||
|
|
@ -112,6 +116,7 @@ private:
|
|||
|
||||
}; // end class Mesh_3_plugin
|
||||
|
||||
|
||||
Mesh_3_plugin::
|
||||
Mesh_3_plugin()
|
||||
: actionMesh_3(NULL)
|
||||
|
|
@ -404,7 +409,8 @@ get_approximate(double d, int precision, int& decimals)
|
|||
return std::floor(d)*std::pow(10.,decimals);
|
||||
}
|
||||
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
Q_EXPORT_PLUGIN2(Mesh_3_plugin, Mesh_3_plugin)
|
||||
#endif
|
||||
|
||||
#include "Mesh_3_plugin.moc"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,11 @@ class Klein_implicit_function :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Implicit_function_interface)
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.Mesh3Demo.Implicit_function_interface/1.0")//New for Qt5 version !
|
||||
#endif
|
||||
|
||||
public:
|
||||
virtual QString name() const { return "Klein function"; }
|
||||
|
||||
|
|
@ -50,6 +54,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QtPlugin>
|
||||
Q_EXPORT_PLUGIN2(Klein_implicit_function, Klein_implicit_function)
|
||||
#endif
|
||||
|
||||
#include "Klein_implicit_function.moc"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include <QObject>
|
||||
#include "Implicit_function_interface.h"
|
||||
|
||||
|
||||
const double radius = 1.;
|
||||
|
||||
class Sphere_implicit_function :
|
||||
|
|
@ -34,7 +33,11 @@ class Sphere_implicit_function :
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Implicit_function_interface)
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.Mesh3Demo.Implicit_function_interface/1.0")//New for Qt5 version !
|
||||
#endif
|
||||
|
||||
public:
|
||||
virtual QString name() const { return "Sphere function"; }
|
||||
|
||||
|
|
@ -51,7 +54,9 @@ public:
|
|||
};
|
||||
|
||||
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QtPlugin>
|
||||
Q_EXPORT_PLUGIN2(Sphere_implicit_function, Sphere_implicit_function)
|
||||
#endif
|
||||
|
||||
#include "Sphere_implicit_function.moc"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include <QObject>
|
||||
#include "Implicit_function_interface.h"
|
||||
|
||||
|
||||
const double radius = 4.;
|
||||
|
||||
class Tanglecube_implicit_function :
|
||||
|
|
@ -35,6 +34,10 @@ class Tanglecube_implicit_function :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(Implicit_function_interface)
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.Mesh3Demo.Implicit_function_interface/1.0")//New for Qt5 version !
|
||||
#endif
|
||||
|
||||
public:
|
||||
virtual QString name() const { return "Tanglecube function"; }
|
||||
|
||||
|
|
@ -53,7 +56,9 @@ public:
|
|||
};
|
||||
|
||||
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QtPlugin>
|
||||
Q_EXPORT_PLUGIN2(Tanglecube_implicit_function, Tanglecube_implicit_function)
|
||||
#endif
|
||||
|
||||
#include "Tanglecube_implicit_function.moc"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
class Scene_item;
|
||||
|
||||
class Io_plugin_interface
|
||||
|
|
|
|||
|
|
@ -54,8 +54,13 @@ void Plugin_helper::autoConnectActions()
|
|||
i < metaObject->methodCount();
|
||||
++i)
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
const int pos = QString(metaObject->method(i).methodSignature()).indexOf('(');
|
||||
methodsNames << QString(metaObject->method(i).methodSignature()).left(pos);
|
||||
#else
|
||||
const int pos = QString(metaObject->method(i).signature()).indexOf('(');
|
||||
methodsNames << QString(metaObject->method(i).signature()).left(pos);
|
||||
#endif
|
||||
methods << metaObject->method(i);
|
||||
}
|
||||
|
||||
|
|
@ -72,13 +77,42 @@ void Plugin_helper::autoConnectActions()
|
|||
|
||||
if(action_method.methodType() == QMetaMethod::Signal)
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
const int pos = QString(action_method.methodSignature()).indexOf('(');
|
||||
QString methodName = QString(action_method.methodSignature()).left(pos);
|
||||
#else
|
||||
const int pos = QString(action_method.signature()).indexOf('(');
|
||||
QString methodName = QString(action_method.signature()).left(pos);
|
||||
#endif
|
||||
QString slotName =
|
||||
QString("on_%1_%2").arg(action->objectName()).arg(methodName);
|
||||
// qDebug() << thisObject->tr("Slot %1 (%2)...").arg(slotName).arg(i);
|
||||
int index = methodsNames.indexOf(slotName);
|
||||
if(index>=0 && !connected.contains(slotName)) {
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
if(index>=0 && !connected.contains(slotName))
|
||||
{
|
||||
const bool ok =
|
||||
QObject::connect(action,
|
||||
qPrintable(QString("2%1").arg(QString(action_method.methodSignature()))),
|
||||
thisObject,
|
||||
qPrintable(QString("1%1").arg(QString(methods[index].methodSignature()))));
|
||||
if(!ok)
|
||||
{
|
||||
qDebug() << thisObject->tr("Cannot connect method %1.%2 to slot %3!")
|
||||
.arg(action->objectName())
|
||||
.arg(QString(action_method.methodSignature()))
|
||||
.arg(QString(methods[index].methodSignature()));
|
||||
}
|
||||
else {
|
||||
// qDebug(" ->Connected!");
|
||||
success = true;
|
||||
connected << slotName;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(index>=0 && !connected.contains(slotName))
|
||||
{
|
||||
const bool ok =
|
||||
QObject::connect(action,
|
||||
qPrintable(QString("2%1").arg(action_method.signature())),
|
||||
|
|
@ -97,6 +131,7 @@ void Plugin_helper::autoConnectActions()
|
|||
connected << slotName;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// else {
|
||||
// qDebug(" nothing found!\n");
|
||||
// }
|
||||
|
|
|
|||
Loading…
Reference in New Issue