Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit e739fd2a authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

SCHNApps : la suite..

parent 51b765cb
#ifndef FIRSTPLUGIN_H_ #ifndef _FIRSTPLUGIN_H_
#define FIRSTPLUGIN_H_ #define _FIRSTPLUGIN_H_
#include "plugins/visualPlugin.h" #include "plugins/visualPlugin.h"
/**---CGoGN includes **/ /**---CGoGN includes **/
#include "Utils/Qt/qtSimple.h"
#include "Utils/cgognStream.h"
#include "Topology/generic/parameters.h" #include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#ifdef USE_GMAP
#include "Topology/gmap/embeddedGMap2.h"
#else
#include "Topology/map/embeddedMap2.h"
#endif
#include "Algo/Render/GL2/topoRender.h" #include "Algo/Render/GL2/topoRender.h"
/**---CGoGN includes **/ /**---CGoGN includes **/
...@@ -27,17 +18,13 @@ using namespace CGoGN ; ...@@ -27,17 +18,13 @@ using namespace CGoGN ;
*/ */
struct PFP: public PFP_STANDARD struct PFP: public PFP_STANDARD
{ {
// definition of the type of the map // definition of the map
#ifdef USE_GMAP
typedef EmbeddedGMap2 MAP;
#else
typedef EmbeddedMap2 MAP; typedef EmbeddedMap2 MAP;
#endif
}; };
typedef PFP::MAP MAP; typedef PFP::MAP MAP;
typedef PFP::VEC3 VEC3; typedef PFP::VEC3 VEC3;
/**---Definitions specific to CGoGN ---*/ /**---Definitions specific to CGoGN ---*/
/** /**
* This class is a basic minimal plugin. * This class is a basic minimal plugin.
...@@ -71,7 +58,7 @@ public: ...@@ -71,7 +58,7 @@ public:
* When a scene will be link to this plugin, it will call * When a scene will be link to this plugin, it will call
* back this method with itself as a parameter. * back this method with itself as a parameter.
*/ */
void cb_initGL(Scene* scene); void cb_initGL(Scene *scene);
/** /**
* The drawing method that needs to be overloaded. * The drawing method that needs to be overloaded.
...@@ -79,7 +66,7 @@ public: ...@@ -79,7 +66,7 @@ public:
* views that is contains) needs to be refresh, it calls back * views that is contains) needs to be refresh, it calls back
* this method with itself as a parameter * this method with itself as a parameter
*/ */
void cb_redraw(Scene* scene); void cb_redraw(Scene *scene);
/** /**
* The plugin's activation method * The plugin's activation method
...@@ -106,15 +93,27 @@ protected: ...@@ -106,15 +93,27 @@ protected:
VertexAttribute<VEC3> position; VertexAttribute<VEC3> position;
// render (for the topo) // render (for the topo)
Algo::Render::GL2::TopoRender* m_render_topo; Algo::Render::GL2::TopoRender *m_render_topo;
// just for more compact writing // just for more compact writing
inline Dart PHI1(Dart d) { return myMap.phi1(d); } inline Dart PHI1(Dart d)
inline Dart PHI_1(Dart d) { return myMap.phi_1(d); } {
inline Dart PHI2(Dart d) { return myMap.phi2(d); } return myMap.phi1(d);
}
inline Dart PHI_1(Dart d)
{
return myMap.phi_1(d);
}
inline Dart PHI2(Dart d)
{
return myMap.phi2(d);
}
template<int X> template<int X>
Dart PHI(Dart d) { return myMap.phi<X>(d); } Dart PHI(Dart d)
{
return myMap.phi<X>(d);
}
/** Attributes that are specific to this plugin **/ /** Attributes that are specific to this plugin **/
}; };
#endif /* FIRSTPLUGIN_H_ */ #endif // _FIRSTPLUGIN_H_
#include "firstPlugin.h" #include "firstPlugin.h"
#include "Algo/Geometry/boundingbox.h" #include "Algo/Geometry/boundingbox.h"
void FirstPlugin::cb_initGL(Scene* scene) void FirstPlugin::cb_initGL(Scene *scene)
{ {
if(scene) if (scene)
{ {
// we fit the first (possibly the only) view of the newly liked // we fit the first (possibly the only) view of the newly liked
// scene to the content of our map // scene to the content of our map
...@@ -21,7 +21,7 @@ void FirstPlugin::cb_initGL(Scene* scene) ...@@ -21,7 +21,7 @@ void FirstPlugin::cb_initGL(Scene* scene)
} }
} }
void FirstPlugin::cb_redraw(Scene* scene) void FirstPlugin::cb_redraw(Scene *scene)
{ {
m_render_topo->drawTopo(); m_render_topo->drawTopo();
} }
...@@ -46,14 +46,14 @@ bool FirstPlugin::activate() ...@@ -46,14 +46,14 @@ bool FirstPlugin::activate()
position[PHI<11>(d2)] = VEC3(0, -2, 0); position[PHI<11>(d2)] = VEC3(0, -2, 0);
position[PHI_1(d2)] = VEC3(2, -2, 0); position[PHI_1(d2)] = VEC3(2, -2, 0);
m_render_topo=NULL; m_render_topo = NULL;
return true; return true;
} }
void FirstPlugin::disable() void FirstPlugin::disable()
{ {
if(m_render_topo) if (m_render_topo)
{ {
delete m_render_topo; delete m_render_topo;
} }
...@@ -64,11 +64,11 @@ void FirstPlugin::disable() ...@@ -64,11 +64,11 @@ void FirstPlugin::disable()
* we also define a DEBUG macro at the compilation * we also define a DEBUG macro at the compilation
*/ */
#ifndef DEBUG #ifndef DEBUG
// essential Qt function: // essential Qt function:
// arguments are // arguments are
// - the complied name of the plugin // - the complied name of the plugin
// - the main class of our plugin (that extends VisualPlugin) // - the main class of our plugin (that extends VisualPlugin)
Q_EXPORT_PLUGIN2(FirstPlugin, FirstPlugin) Q_EXPORT_PLUGIN2(FirstPlugin, FirstPlugin)
#else #else
Q_EXPORT_PLUGIN2(FirstPluginD, FirstPlugin) Q_EXPORT_PLUGIN2(FirstPluginD, FirstPlugin)
#endif #endif
...@@ -16,92 +16,116 @@ ...@@ -16,92 +16,116 @@
class Window; class Window;
class SplitArea; class SplitArea;
namespace System{ namespace System
{
namespace Dialog{ namespace Dialog
class QuestionSessionDialog : public QDialog, public Ui::QSDialog{ {
Q_OBJECT
public:
QuestionSessionDialog(QWidget* parent=0) : QDialog(parent){ this->setupUi(this);}
};
class QuestionSessionDialog : public QDialog, public Ui::QSDialog
{
Q_OBJECT
public:
QuestionSessionDialog(QWidget *parent = 0) : QDialog(parent)
{
this->setupUi(this);
}
};
class InfoDialog : public QDialog, public Ui::InfoDialog{
Q_OBJECT
public:
InfoDialog(QWidget* parent=0) : QDialog(parent){ this->setupUi(this);}
bool setContent(QUrl urlHTMLFile); class InfoDialog : public QDialog, public Ui::InfoDialog
}; {
Q_OBJECT
public:
InfoDialog(QWidget *parent = 0) : QDialog(parent)
{
this->setupUi(this);
} }
class Error{ bool setContent(QUrl urlHTMLFile);
public: };
virtual ~Error() =0;
}
typedef enum{SUCCESS, NO_SCENE, SCENE_UNREFERENCED, SCENE_EXISTS, NO_DOCK, NO_PLUGIN_PATH_FILE,
ERROR_OPEN_PLUGIN_FILE ,BAD_PLUGIN_PATH_FILE, BAD_PLUGIN_PATH_IN_FILE, NO_PLUGIN_IN_DIR, class Error
PLUGIN_EXISTS, ERROR_PLUGIN_LOAD, BAD_LINK_PLUGIN_WINDOW, UNSATSIFIED_PLUGIN_DEPENDENCIE, {
BAD_ACTION_MENU_PATH, MAP_UNREFERENCED, MAP_EXISTS, SHADER_EXISTS, SHADER_NOT_FOUND, public:
VBO_EXISTS, VBO_NOT_FOUND, TOPO3RENDER_EXISTS, TOPO3RENDER_NOT_FOUND, OPEN_FILE_ERROR, virtual ~Error() = 0;
BAD_XML_FILE} ERROR_CODE;
typedef enum
{
static QString parameter; SUCCESS, NO_SCENE, SCENE_UNREFERENCED, SCENE_EXISTS, NO_DOCK, NO_PLUGIN_PATH_FILE,
ERROR_OPEN_PLUGIN_FILE , BAD_PLUGIN_PATH_FILE, BAD_PLUGIN_PATH_IN_FILE, NO_PLUGIN_IN_DIR,
static ERROR_CODE code; PLUGIN_EXISTS, ERROR_PLUGIN_LOAD, BAD_LINK_PLUGIN_WINDOW, UNSATSIFIED_PLUGIN_DEPENDENCIE,
BAD_ACTION_MENU_PATH, MAP_UNREFERENCED, MAP_EXISTS, SHADER_EXISTS, SHADER_NOT_FOUND,
static ERROR_CODE BAD_PLUGIN_PATH_IN_FILE_f(QString file); VBO_EXISTS, VBO_NOT_FOUND, TOPO3RENDER_EXISTS, TOPO3RENDER_NOT_FOUND, OPEN_FILE_ERROR,
static ERROR_CODE NO_PLUGIN_IN_DIR_f(QString dir); BAD_XML_FILE
static ERROR_CODE PLUGIN_EXISTS_f(QString plugin); } ERROR_CODE;
static ERROR_CODE ERROR_PLUGIN_LOAD_f(QString plugin);
static ERROR_CODE BAD_LINK_PLUGIN_WINDOW_f(QString plugin); static QString parameter;
static ERROR_CODE UNSATSIFIED_PLUGIN_DEPENDENCIE_f(QString dependencie, QString from=QString());
static ERROR_CODE BAD_ACTION_MENU_PATH_f(QString actionPath); static ERROR_CODE code;
static ERROR_CODE MAP_UNREFERENCED_f(QString map_name);
static ERROR_CODE MAP_EXISTS_f(QString map_name); static ERROR_CODE BAD_PLUGIN_PATH_IN_FILE_f(QString file);
static ERROR_CODE SHADER_EXISTS_f(QString shader_name, QString glv_name=QString()); static ERROR_CODE NO_PLUGIN_IN_DIR_f(QString dir);
static ERROR_CODE SHADER_NOT_FOUND_f(QString shader_name, QString glv_name=QString()); static ERROR_CODE PLUGIN_EXISTS_f(QString plugin);
static ERROR_CODE VBO_EXISTS_f(QString vbo_name, QString glv_name=QString()); static ERROR_CODE ERROR_PLUGIN_LOAD_f(QString plugin);
static ERROR_CODE VBO_NOT_FOUND_f(QString vbo_name, QString glv_name=QString()); static ERROR_CODE BAD_LINK_PLUGIN_WINDOW_f(QString plugin);
static ERROR_CODE TOPO3RENDER_EXISTS_f(QString name, QString glv_name=QString()); static ERROR_CODE UNSATSIFIED_PLUGIN_DEPENDENCIE_f(QString dependencie, QString from = QString());
static ERROR_CODE TOPO3RENDER_NOT_FOUND_f(QString name, QString glv_name=QString()); static ERROR_CODE BAD_ACTION_MENU_PATH_f(QString actionPath);
static ERROR_CODE OPEN_FILE_ERROR_f(QString filepath); static ERROR_CODE MAP_UNREFERENCED_f(QString map_name);
static ERROR_CODE BAD_XML_FILE_f(QString filepath); static ERROR_CODE MAP_EXISTS_f(QString map_name);
static ERROR_CODE SHADER_EXISTS_f(QString shader_name, QString glv_name = QString());
static void showError(QWidget* parent=0); static ERROR_CODE SHADER_NOT_FOUND_f(QString shader_name, QString glv_name = QString());
}; static ERROR_CODE VBO_EXISTS_f(QString vbo_name, QString glv_name = QString());
static ERROR_CODE VBO_NOT_FOUND_f(QString vbo_name, QString glv_name = QString());
class Events{ static ERROR_CODE TOPO3RENDER_EXISTS_f(QString name, QString glv_name = QString());
public: static ERROR_CODE TOPO3RENDER_NOT_FOUND_f(QString name, QString glv_name = QString());
virtual ~Events() =0; static ERROR_CODE OPEN_FILE_ERROR_f(QString filepath);
static ERROR_CODE BAD_XML_FILE_f(QString filepath);
static bool movieDialogOpened;
}; static void showError(QWidget *parent = 0);
};
class Info{
public: class Events
virtual ~Info() =0; {
public:
static void showPluginInfo(QString pluginAbsolutePath, QWidget* parent=0); virtual ~Events() = 0;
static void showPluginInfo(QString locationPath, QString pluginName, QWidget* parent=0);
}; static bool movieDialogOpened;
};
class StateHandler{
public: class Info
virtual ~StateHandler() =0; {
public:
static bool saveState(Window* window, PluginHash* pluginHash, SceneHash* sceneHash, SplitArea* splitArea); virtual ~Info() = 0;
static bool loadState(Window* window, PluginHash* pluginHash, SceneHash* sceneHash, SplitArea* splitArea);
static void unsaveState(); static void showPluginInfo(QString pluginAbsolutePath, QWidget *parent = 0);
static bool savePluginsInfo(Window* window, PluginHash* pluginHash, QStringList paths); static void showPluginInfo(QString locationPath, QString pluginName, QWidget *parent = 0);
}; };
typedef enum{GLVIEWER_IN_DOCK, SIMPLE_GLVIEWER} QGLV_CREATE_SETTINGS; class StateHandler
{
extern QString app_path; public:
virtual ~StateHandler() = 0;
extern QSplashScreen* splash;
static bool saveState(Window *window, PluginHash *pluginHash, SceneHash *sceneHash, SplitArea *splitArea);
static bool loadState(Window *window, PluginHash *pluginHash, SceneHash *sceneHash, SplitArea *splitArea);
static void unsaveState();
static bool savePluginsInfo(Window *window, PluginHash *pluginHash, QStringList paths);
};
typedef enum
{
GLVIEWER_IN_DOCK, SIMPLE_GLVIEWER
} QGLV_CREATE_SETTINGS;
extern QString app_path;
extern QSplashScreen *splash;
} }
#endif #endif
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include "Topology/generic/genericmap.h" #include "Topology/generic/genericmap.h"
#include "types.h" #include "types.h"
#include "visualization/mapHandler.h" #include "visualization/mapHandler.h"
#include "interface/splitArea.h" #include "interface/splitArea.h"
...@@ -18,8 +19,10 @@ class Plugin; ...@@ -18,8 +19,10 @@ class Plugin;
class Context; class Context;
class MapHandler; class MapHandler;
class Window : public QMainWindow, Ui::Window{ class Window : public QMainWindow, Ui::Window
{
Q_OBJECT Q_OBJECT
public: public:
/** /**
* \fn Window(QWidget* parent=0) * \fn Window(QWidget* parent=0)
...@@ -27,26 +30,28 @@ public: ...@@ -27,26 +30,28 @@ public:
* *
* \param parent the parent of the window * \param parent the parent of the window
*/ */
Window(QWidget* parent=0); Window(QWidget *parent = 0);
/** /**
* \fn ~Window() * \fn ~Window()
* \brief the class destructor * \brief the class destructor
*/ */
~Window(); ~Window();
bool addNewEmptyScene(QString name, Scene* &scene, bool dialog, Camera* sharedCamera=NULL); bool addNewEmptyScene(QString name, Scene *&scene, bool dialog, Camera *sharedCamera = NULL);
bool addNewSceneView(Scene* scene, View* view); bool addNewSceneView(Scene *scene, View *view);
QList<Scene*> scenes(){return h_scene.values();} QList<Scene *> scenes()
{
return h_scene.values();
}
bool associateSceneWithPlugin(QString glviewer, Plugin* plugin, Scene* &scene, bool cb_initGL=false); bool associateSceneWithPlugin(QString glviewer, Plugin *plugin, Scene *&scene, bool cb_initGL = false);
bool addNewSceneFromPlugin(QString name, Plugin* plugin, Scene* &scene); bool addNewSceneFromPlugin(QString name, Plugin *plugin, Scene *&scene);
bool addNewSceneFromPluginDialog(QString name, Plugin* plugin, Scene* &scene); bool addNewSceneFromPluginDialog(QString name, Plugin *plugin, Scene *&scene);
void removeScene(QString name); void removeScene(QString name);
/** /**
* \fn void addEmptyDock() * \fn void addEmptyDock()
* \brief add an empty dock to the window, if one doesn't already exists * \brief add an empty dock to the window, if one doesn't already exists
...@@ -55,6 +60,7 @@ public: ...@@ -55,6 +60,7 @@ public:
* \see VisualPlugin::addWidgetInDockTab() * \see VisualPlugin::addWidgetInDockTab()
*/ */
void addEmptyDock(); void addEmptyDock();
/** /**
* \fn QTabWidget* getDockTabWidget() * \fn QTabWidget* getDockTabWidget()
* \brief Accessor to the QTabWidget of this interface * \brief Accessor to the QTabWidget of this interface
...@@ -63,7 +69,8 @@ public: ...@@ -63,7 +69,8 @@ public:
* *
* \return a pointer to the TabWidget, NULL if not allocated yet * \return a pointer to the TabWidget, NULL if not allocated yet
*/ */
QTabWidget* getDockTabWidget(); QTabWidget *getDockTabWidget();
/** /**
* \fn void addWidgetInDockTab(QWidget* newTabWidget, QString tabText) * \fn void addWidgetInDockTab(QWidget* newTabWidget, QString tabText)
* \brief Adds the widget as a new tab in the interface's dock * \brief Adds the widget as a new tab in the interface's dock
...@@ -73,7 +80,8 @@ public: ...@@ -73,7 +80,8 @@ public:
* *
* \see removeTabInDock() * \see removeTabInDock()
*/ */
void addWidgetInDockTab(QWidget* newTabWidget, QString tabText); void addWidgetInDockTab(QWidget *newTabWidget, QString tabText);
/** /**
* \fn void removeTabInDock(QWidget* tabWidget) * \fn void removeTabInDock(QWidget* tabWidget)
* \brief removes a given widget from the tab * \brief removes a given widget from the tab
...@@ -84,7 +92,7 @@ public: ...@@ -84,7 +92,7 @@ public:
* *
* \see addWidgetInDockTab() * \see addWidgetInDockTab()
*/ */
void removeTabInDock(QWidget* tabWidget); void removeTabInDock(QWidget *tabWidget);
/** /**
* \fn bool addMenuAction(QString menuPath, QAction* act) * \fn bool addMenuAction(QString menuPath, QAction* act)
...@@ -92,56 +100,53 @@ public: ...@@ -92,56 +100,53 @@ public:
* *
* \param menuPath the menu path (see details below) to specify a location for the action in the menu. * \param menuPath the menu path (see details below) to specify a location for the action in the menu.
* \param act a pointer to the allocated action to add in the menu. All the details ont that action (such as * \param act a pointer to the allocated action to add in the menu. All the details ont that action (such as
* QObject::connect() calls) are not dealt in this function. * QObject::connect() calls) are not dealt in this function.
* *
* The menu path is a string used to specify the location of the new action in the menu bar. * The menu path is a string used to specify the location of the new action in the menu bar.
* In such path every menu step of the path should be separate by ';'. The action is the last substring after * In such path every menu step of the path should be separate by ';'. The action is the last substring after
* the last ';', and will be added in the menu with that name. All non-existing menu specified in the path * the last ';', and will be added in the menu with that name. All non-existing menu specified in the path
* shall be created. * shall be created.
* *
* <b>Example 1:</b> if you want to add an entry <em>"action"</em> to the existing menu <em>"Plugins"</em> the * <b>Example 1:</b> if you want to add an entry <em>"action"</em> to the existing menu <em>"Plugins"</em> the
* menu path shall be: <em>Plugins;action</em> * menu path shall be: <em>Plugins;action</em>
* *
* <b>Example 2:</b> if you want to add an entry <em>"action"</em> in a new menu <em>"config"</em> that is also a * <b>Example 2:</b> if you want to add an entry <em>"action"</em> in a new menu <em>"config"</em> that is also a
* submenu of a new menu <em>"Settings"</em>, the menu path * submenu of a new menu <em>"Settings"</em>, the menu path
* shall be: <em>Settings;config;action</em> * shall be: <em>Settings;config;action</em>
* *
* *
* A new action should at least belong to one menu (already existing or not). Otherwise the method will fail. * A new action should at least belong to one menu (already existing or not). Otherwise the method will fail.
* *
* This method is already called by reimplemented Plugin methods, there's apparently no reason for calling it. * This method is already called by reimplemented Plugin methods, there's apparently no reason for calling it.
* *
* \return a boolean whether the method succeeded or not. * \return a boolean whether the method succeeded or not.
* *
* If the function failed, the error code ( Error::code ) is affected with a value * If the function failed, the error code ( Error::code ) is affected with a value
depending on the error. This error can be shown with Error::showError depending on the error. This error can be shown with Error::showError
* *
* \see deleteMenuAction() * \see deleteMenuAction()
* \see VisualPlugin::addMenuAction() * \see VisualPlugin::addMenuAction()
*/ */
bool addMenuAction(QString menuPath, QAction* act); bool addMenuAction(QString menuPath, QAction *act);
/** /**
* \fn void deleteMenuAction(QAction* act) * \fn void deleteMenuAction(QAction* act)
* \brief delete an action from the menu bar * \brief delete an action from the menu bar
* *
* \param act pointer to the allocated action to delete. * \param act pointer to the allocated action to delete.
* *
* If this action was the only action remaining in a menu, this menu will also be deleted. * If this action was the only action remaining in a menu, this menu will also be deleted.
* *
* \warning DO NOT use this method with an action that hasn't been added with addMenuAction() * \warning DO NOT use this method with an action that hasn't been added with addMenuAction()
* *
* This method is already called by reimplemented Plugin methods, there's apparently no reason for calling it. * This method is already called by reimplemented Plugin methods, there's apparently no reason for calling it.
* *
* \see addMenuAction() * \see addMenuAction()
* \see VisualPlugin::deleteMenuActions() * \see VisualPlugin::deleteMenuActions()
*/ */