Commit 14faf2bb authored by untereiner's avatar untereiner
Browse files

Merge cgogn:~kraemer/CGoGN

parents cef35811 78546092
......@@ -8,12 +8,14 @@ SET( QT_USE_QTDESIGNER TRUE )
SET( QT_USE_QTGUI TRUE )
SET( QT_USE_QTPLUGIN TRUE )
#========CGoGN========#
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/.. CACHE STRING "CGoGN root dir")
INCLUDE(${CGoGN_ROOT_DIR}/apps_cmake.txt)
find_package(Qt4 REQUIRED)
#=======QGLViewer=========#
find_package(QGLViewer REQUIRED)
......
......@@ -20,28 +20,35 @@ INCLUDE_DIRECTORIES(
file(
GLOB
SCHNApps_SRC_FILES
${SCHNApps_ROOT_DIR}/src/camera.cpp
${SCHNApps_ROOT_DIR}/src/context.cpp
${SCHNApps_ROOT_DIR}/src/main.cpp
${SCHNApps_ROOT_DIR}/src/interface/*.cpp
${SCHNApps_ROOT_DIR}/src/visualization/*.cpp
${SCHNApps_ROOT_DIR}/src/dialogs/*.cpp
${SCHNApps_ROOT_DIR}/src/mapHandler.cpp
${SCHNApps_ROOT_DIR}/src/plugin.cpp
${SCHNApps_ROOT_DIR}/src/scene.cpp
${SCHNApps_ROOT_DIR}/src/splitArea.cpp
${SCHNApps_ROOT_DIR}/src/system.cpp
${SCHNApps_ROOT_DIR}/src/view.cpp
${SCHNApps_ROOT_DIR}/src/viewSelector.cpp
${SCHNApps_ROOT_DIR}/src/window.cpp
)
SET(SCHNApps_H_OBJECT_FILES
${SCHNApps_ROOT_DIR}/include/interface/window.h
${SCHNApps_ROOT_DIR}/include/interface/system.h
${SCHNApps_ROOT_DIR}/include/interface/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/interface/splitArea.h
${SCHNApps_ROOT_DIR}/include/visualization/view.h
${SCHNApps_ROOT_DIR}/include/visualization/scene.h
${SCHNApps_ROOT_DIR}/include/dialogs/newSceneDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/sceneSelector.h
${SCHNApps_ROOT_DIR}/include/dialogs/cameraViewDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/cameraOptionDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/cameraSceneDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/globalCameraDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/pluginDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/linkViewDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/mapPluginDialog.h
${SCHNApps_ROOT_DIR}/include/window.h
${SCHNApps_ROOT_DIR}/include/scene.h
${SCHNApps_ROOT_DIR}/include/view.h
${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/system.h
${SCHNApps_ROOT_DIR}/include/splitArea.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/newSceneDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/sceneSelector.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraViewDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraOptionDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraSceneDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/globalCameraDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/pluginDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/linkViewDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/mapPluginDialog.h
)
file(
......@@ -74,4 +81,4 @@ TARGET_LINK_LIBRARIES( SCHNAppsD
)
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins PluginsD)
#ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins PluginsD)
......@@ -22,28 +22,35 @@ INCLUDE_DIRECTORIES(
file(
GLOB
SCHNApps_SRC_FILES
${SCHNApps_ROOT_DIR}/src/camera.cpp
${SCHNApps_ROOT_DIR}/src/context.cpp
${SCHNApps_ROOT_DIR}/src/main.cpp
${SCHNApps_ROOT_DIR}/src/interface/*.cpp
${SCHNApps_ROOT_DIR}/src/visualization/*.cpp
${SCHNApps_ROOT_DIR}/src/dialogs/*.cpp
${SCHNApps_ROOT_DIR}/src/mapHandler.cpp
${SCHNApps_ROOT_DIR}/src/plugin.cpp
${SCHNApps_ROOT_DIR}/src/scene.cpp
${SCHNApps_ROOT_DIR}/src/splitArea.cpp
${SCHNApps_ROOT_DIR}/src/system.cpp
${SCHNApps_ROOT_DIR}/src/view.cpp
${SCHNApps_ROOT_DIR}/src/viewSelector.cpp
${SCHNApps_ROOT_DIR}/src/window.cpp
)
SET(SCHNApps_H_OBJECT_FILES
${SCHNApps_ROOT_DIR}/include/interface/window.h
${SCHNApps_ROOT_DIR}/include/interface/system.h
${SCHNApps_ROOT_DIR}/include/interface/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/interface/splitArea.h
${SCHNApps_ROOT_DIR}/include/visualization/view.h
${SCHNApps_ROOT_DIR}/include/visualization/scene.h
${SCHNApps_ROOT_DIR}/include/dialogs/newSceneDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/sceneSelector.h
${SCHNApps_ROOT_DIR}/include/dialogs/cameraViewDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/cameraOptionDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/cameraSceneDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/globalCameraDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/pluginDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/linkViewDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/mapPluginDialog.h
${SCHNApps_ROOT_DIR}/include/window.h
${SCHNApps_ROOT_DIR}/include/scene.h
${SCHNApps_ROOT_DIR}/include/view.h
${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/system.h
${SCHNApps_ROOT_DIR}/include/splitArea.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/newSceneDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/sceneSelector.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraViewDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraOptionDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/cameraSceneDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/globalCameraDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/pluginDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/linkViewDialog.h
# ${SCHNApps_ROOT_DIR}/include/dialogs/mapPluginDialog.h
)
file(
......@@ -76,4 +83,4 @@ TARGET_LINK_LIBRARIES( SCHNApps
)
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins Plugins)
#ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins Plugins)
......@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>CGoGN Plug</string>
<string>SCHNApps</string>
</property>
<property name="windowIcon">
<iconset resource="../resources/resources.qrc">
......@@ -24,39 +24,23 @@
<x>0</x>
<y>0</y>
<width>785</width>
<height>29</height>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuFichier">
<widget class="QMenu" name="menuFile">
<property name="title">
<string>Fichier</string>
<string>File</string>
</property>
<addaction name="actionQuitter"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionAbout_CGoGN"/>
<addaction name="actionAbout"/>
<addaction name="actionAboutSCHNApps"/>
<addaction name="actionAboutCGoGN"/>
</widget>
<widget class="QMenu" name="menuPlugins">
<property name="title">
<string>Plugins</string>
</property>
<addaction name="actionPlugins"/>
</widget>
<widget class="QMenu" name="menuViews">
<property name="title">
<string>Visu</string>
</property>
<addaction name="actionNew_Scene"/>
<addaction name="actionGlobalCamera"/>
<addaction name="actionLinkPluginMap"/>
</widget>
<addaction name="menuFichier"/>
<addaction name="menuViews"/>
<addaction name="menuPlugins"/>
<addaction name="menuFile"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
......@@ -65,71 +49,65 @@
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
<enum>LeftToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionNew_Scene"/>
<addaction name="actionPlugins"/>
<addaction name="actionGlobalCamera"/>
<addaction name="actionLinkPluginMap"/>
<addaction name="actionManagePlugins"/>
<addaction name="actionManageView"/>
<addaction name="actionManageCameras"/>
<addaction name="actionManageMaps"/>
</widget>
<action name="actionAbout_CGoGN">
<action name="actionAboutCGoGN">
<property name="text">
<string>About CGoGN ...</string>
<string>About CGoGN</string>
</property>
</action>
<action name="actionAbout">
<action name="actionAboutSCHNApps">
<property name="text">
<string>About ...</string>
<string>About SCHNApps</string>
</property>
</action>
<action name="actionQuitter">
<action name="actionQuit">
<property name="text">
<string>Quitter</string>
<string>Quit</string>
</property>
</action>
<action name="actionPlugins">
<action name="actionManagePlugins">
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/icons/plugins.png</normaloff>:/icons/icons/plugins.png</iconset>
</property>
<property name="text">
<string>Plugins ...</string>
<string>Manage plugins</string>
</property>
</action>
<action name="actionNew_Scene">
<action name="actionManageView">
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/icons/add_view.png</normaloff>:/icons/icons/add_view.png</iconset>
</property>
<property name="text">
<string>Ajouter nouvelle scène ...</string>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Adds a new empty view.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Add view</string>
</property>
</action>
<action name="actionGlobalCamera">
<action name="actionManageCameras">
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/icons/camera_b.png</normaloff>:/icons/icons/camera_b.png</iconset>
</property>
<property name="text">
<string>Gestion des caméras ...</string>
</property>
<property name="toolTip">
<string>Gestion des caméras</string>
<string>Manage cameras</string>
</property>
</action>
<action name="actionLinkPluginMap">
<action name="actionManageMaps">
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/icons/map_plugin.png</normaloff>:/icons/icons/map_plugin.png</iconset>
</property>
<property name="text">
<string>Lier plugins et maps</string>
<string>Manage CGoGN maps</string>
</property>
</action>
</widget>
......@@ -138,7 +116,7 @@
</resources>
<connections>
<connection>
<sender>actionQuitter</sender>
<sender>actionQuit</sender>
<signal>triggered()</signal>
<receiver>Window</receiver>
<slot>close()</slot>
......
#ifndef _CAMERA_H_
#define _CAMERA_H_
#include "view.h"
#include "types.h"
#include "QGLViewer/camera.h"
//forward declaration
class Window;
class View;
class Camera : public qglviewer::Camera
{
public:
Camera(View* v);
Camera(View* v, Camera c);
Camera(const QString& name, Window* window);
Camera(const QString& name, Window* window, const qglviewer::Camera& c);
~Camera();
bool isShared() { return l_views.size() > 1; }
QString getName() { return m_name; }
void setName(QString name) { m_name = name; }
QString getName() { return m_name; }
Window* getWindow() { return m_window; }
void setWindow(Window* w) { m_window = w; }
bool isShared() { return l_views.size() > 1; }
void draw();
bool getDraw() { return m_draw; }
bool getDrawFarPlane() { return m_drawFarPlane; }
double getDrawScale() { return m_drawScale; }
bool getDrawPath() { return m_drawPath; }
bool getDrawPathAxis() { return m_drawPathAxis; }
double getDrawPathScale() { return m_drawPathScale; }
void setDraw(bool b = true) { m_draw = b; }
bool getDrawFarPlane() { return m_drawFarPlane; }
void setDrawFarPlane(bool b = true) { m_drawFarPlane = b; }
double getDrawScale() { return m_drawScale; }
void setDrawScale(double s) { m_drawScale = s; }
bool getDrawPath() { return m_drawPath; }
void setDrawPath(bool b = true) { m_drawPath = b; }
bool getDrawPathAxis() { return m_drawPathAxis; }
void setDrawPathAxis(bool b = true) { m_drawPathAxis = b; }
double getDrawPathScale() { return m_drawPathScale; }
void setDrawPathScale(double s) { m_drawPathScale = s;}
void takenFrom(View* v);
void sharedWith(View* v);
void fitParamWith(View* v);
void linkView(View* view);
void unlinkView(View* view);
bool isLinkedWithView(View* view);
void fitParamWith(View* view);
void resetSnapCount() { m_snapCount = 0; }
void saveSnapshot(QString snapPathName);
void updateGL();
void viewShowButton(bool b);
// void viewShowButton(bool b);
protected:
QList<View*> l_views;
static unsigned int cameraCount;
QString m_name;
Window* m_window;
QList<View*> l_views;
bool m_draw;
bool m_drawFarPlane;
......@@ -57,8 +71,6 @@ protected:
bool m_drawPathAxis;
double m_drawPathScale;
View* m_lastWorkingView;
int m_snapCount;
};
......
......@@ -8,7 +8,7 @@
class Context : public QGLContext
{
public:
Context(QWidget* w, const QGLFormat & format);
Context(const QGLFormat& format, QWidget* w);
void setDevice(QWidget* w);
};
......
#ifndef _VIZUHANDLER_H_
#define _VIZUHANDLER_H_
#ifndef _MAPHANDLER_H_
#define _MAPHANDLER_H_
#include <QHash>
#include <QString>
#include "types.h"
namespace CGoGN
{
......@@ -12,36 +13,30 @@ namespace CGoGN
}
}
class VBOHandler;
class MapHandler
{
public:
MapHandler(CGoGN::GenericMap *map);
MapHandler(const QString& name, CGoGN::GenericMap* map);
~MapHandler();
CGoGN::GenericMap *map()
{
return m_map;
}
const QString& getName() { return m_name; }
void setName(const QString& name) { m_name = name; }
VBOHandler *findVBO(QString name);
VBOHandler *findFirstVBOMatching(QRegExp regexp);
QList<VBOHandler *> findVBOsMatching(QRegExp regexp);
CGoGN::GenericMap* getMap() { return m_map; }
bool addVBO(VBOHandler *vboH);
VBOHandler *addNewVBO(QString vboName);
CGoGN::Utils::VBO* addVBO(const QString& name);
void removeVBO(const QString& name);
CGoGN::Utils::VBO* getVBO(const QString& name);
CGoGN::Utils::VBO* findFirstVBOMatching(const QRegExp& regexp);
QList<CGoGN::Utils::VBO*> findVBOsMatching(const QRegExp& regexp);
VBOHandler *takeVBO(VBOHandler *vbo);
int countVBO()
{
return l_vbo.count();
}
int getNbVBO() { return h_vbo.count(); }
protected:
CGoGN::GenericMap *m_map;
QList<VBOHandler *> l_vbo;
QString m_name;
CGoGN::GenericMap* m_map;
VBOHash h_vbo;
};
#endif
......@@ -8,11 +8,11 @@
#include "window.h"
#include "system.h"
#include "scene.h"
#include "view.h"
#include "camera.h"
#include "mapHandler.h"
#include "vboHandler.h"
#include "scene.h"
class Plugin
{
......@@ -20,52 +20,96 @@ public:
enum { UNLIMITED_NUMBER_OF_MAPS = -1 };
enum { UNLIMITED_NUMBER_OF_SCENES = -1 };
virtual ~Plugin()
{}
Plugin(const QString& name, const QString& filePath, Window* window);
virtual ~Plugin();
virtual void cb_updateMatrix(View* view) = 0;
virtual void cb_redraw(Scene* scene) = 0;
virtual void cb_initGL(Scene* scene) = 0;
virtual bool enable() = 0;
virtual void disable() = 0;
void updateGL() = 0;
void updateGL(Scene* scene) = 0;
const QString& getName() { return m_name; }
void setName(const QString& name) { m_name = name; }
virtual bool cb_keyPress(Scene* scene, int event) = 0;
virtual bool cb_keyRelease(Scene* scene, int event) = 0;
virtual bool cb_mousePress(Scene* scene, int button, int x, int y) = 0;
virtual bool cb_mouseRelease(Scene* scene, int button, int x, int y) = 0;
virtual bool cb_mouseClick(Scene* scene, int button, int x, int y) = 0;
virtual bool cb_mouseMove(Scene* scene, int buttons, int x, int y) = 0;
virtual bool cb_wheelEvent(Scene* scene, int delta, int x, int y) = 0;
const QString& getFilePath() { return m_filePath; }
void setFilePath(const QString& f) { m_filePath = f; }
virtual void cb_recievedMap(MapHandler* map) = 0;
virtual void cb_removingMap(MapHandler* map) = 0;
Window* getWindow() { return m_window; }
void setWindow(Window* w) { m_window = w; }
virtual bool isWaitingForScene() = 0;
virtual void recieveScene(Scene* scene) = 0;
virtual void deleteLinkWithScene(Scene* scene) = 0;
virtual bool hasManualLinkWithScene(Scene* scene) = 0;
void updateGL();
void updateGL(Scene* scene);
const QString& getName() { return m_name; }
void setName(QString name) { m_name = name; }
virtual void cb_initGL(Scene* scene) = 0;
virtual void cb_updateMatrix(View* view) = 0;
virtual void cb_redraw(Scene* scene) = 0;
const QString& getPluginFilePath() { return m_pluginPathFile; }
void setPluginFilePath(QString path) { m_pluginPathFile = path; }
virtual void cb_keyPress(Scene* scene, int key) = 0;
virtual void cb_keyRelease(Scene* scene, int key) = 0;
virtual void cb_mousePress(Scene* scene, int button, int x, int y) = 0;
virtual void cb_mouseRelease(Scene* scene, int button, int x, int y) = 0;
virtual void cb_mouseClick(Scene* scene, int button, int x, int y) = 0;
virtual void cb_mouseMove(Scene* scene, int buttons, int x, int y) = 0;
virtual void cb_wheelEvent(Scene* scene, int delta, int x, int y) = 0;
virtual void cb_mapAdded(MapHandler* map) = 0;
virtual void cb_mapRemoved(MapHandler* map) = 0;
virtual void cb_sceneAdded(Scene* s) = 0;
virtual void cb_sceneRemoved(Scene* s) = 0;
/*********************************************************
* MANAGE MAPS
*********************************************************/
bool linkMap(MapHandler* map);
void unlinkMap(MapHandler* map);
bool isLinkedToMap(MapHandler* map);
QList<MapHandler*> getLinkedMaps();
void setMaxNumberOfLinkedMaps(int n);
int getCurrentNumberOfLinkedMaps();
int getRemainingNumberOfLinkedMaps();
/*********************************************************
* MANAGE SCENES
*********************************************************/
bool linkScene(Scene* scene);
void unlinkScene(Scene* scene);
bool isLinkedToScene(Scene* scene);
QList<Scene*> getLinkedScenes();
/*********************************************************
* MANAGE DOCK TABS
*********************************************************/
bool addTabInDock(QWidget* tabWidget, const QString& tabText);
void removeTabInDock(QWidget* tabWidget);
/*********************************************************
* MANAGE MENU ACTIONS
*********************************************************/
bool addMenuAction(const QString& menuPath, QAction* action);
void removeMenuAction(QAction* action);
/*********************************************************
* MANAGE TOOLBAR ACTIONS
*********************************************************/
bool addToolbarAction(QAction* action);
void removeToolbarAction(QAction* action);
Window* getWindow() { return m_window; }
void setWindow(Window* window) { m_window = window; }
protected:
QString m_name;
QString m_filePath;
Window* m_window;
virtual bool activate(bool initializing)
{
m_windowInitializing = initializing;
bool r = activate();
m_windowInitializing = false;
return r;
}
int m_maxNumberOfMaps;
QList<MapHandler*> l_maps;
QList<Scene*> l_scenes;
QList<QWidget*> l_tabWidgets;
QList<QAction*> l_menuActions;
QList<QAction*> l_toolbarActions;
// QList<ViewButton*> l_viewButtons;
virtual void activate() = 0;
virtual void disable() = 0;
// QList<Plugin*> l_dependencies;
// QList<Plugin*> l_dependantPlugins;
/*
void addDependantPlugin(Plugin* p) { l_dependantPlugins.push_back(p); }
void removeDependantPlugin(Plugin* p) { l_dependantPlugins.removeAll(p); }
void removeAllDependantPlugins() { l_dependantPlugins.clear(); }
......@@ -127,49 +171,7 @@ public:
m_window->unloadPlugin(l_dependantPlugins.back()->getName());
}
}