Commit 2046135e authored by untereiner's avatar untereiner

Merge cgogn:~cgogn/CGoGN

parents 8b368628 42e522b2
...@@ -38,6 +38,7 @@ SET(SCHNApps_H_OBJECT_FILES ...@@ -38,6 +38,7 @@ SET(SCHNApps_H_OBJECT_FILES
${SCHNApps_ROOT_DIR}/include/view.h ${SCHNApps_ROOT_DIR}/include/view.h
${SCHNApps_ROOT_DIR}/include/window.h ${SCHNApps_ROOT_DIR}/include/window.h
${SCHNApps_ROOT_DIR}/include/mapHandler.h ${SCHNApps_ROOT_DIR}/include/mapHandler.h
${SCHNApps_ROOT_DIR}/include/plugin.h
${SCHNApps_ROOT_DIR}/include/viewButtonArea.h ${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/dialogs/camerasDialog.h ${SCHNApps_ROOT_DIR}/include/dialogs/camerasDialog.h
${SCHNApps_ROOT_DIR}/include/dialogs/pluginsDialog.h ${SCHNApps_ROOT_DIR}/include/dialogs/pluginsDialog.h
......
...@@ -37,10 +37,6 @@ public: ...@@ -37,10 +37,6 @@ public:
virtual void mouseMove(View* view, int buttons, int x, int y) {} virtual void mouseMove(View* view, int buttons, int x, int y) {}
virtual void wheelEvent(View* view, int delta, int x, int y) {} virtual void wheelEvent(View* view, int delta, int x, int y) {}
virtual void viewLinked(View* view) {}
virtual void viewUnlinked(View* view) {}
virtual void currentViewChanged(View* view) {}
public slots: public slots:
void openComputeNormalDialog(); void openComputeNormalDialog();
void openComputeCurvatureDialog(); void openComputeCurvatureDialog();
......
...@@ -15,7 +15,7 @@ bool ImportSurfacePlugin::enable() ...@@ -15,7 +15,7 @@ bool ImportSurfacePlugin::enable()
return true; return true;
} }
void ImportSurfacePlugin::importFromFile(const QString& fileName) MapHandlerGen* ImportSurfacePlugin::importFromFile(const QString& fileName)
{ {
QFileInfo fi(fileName); QFileInfo fi(fileName);
if(fi.exists()) if(fi.exists())
...@@ -43,6 +43,7 @@ void ImportSurfacePlugin::importFromFile(const QString& fileName) ...@@ -43,6 +43,7 @@ void ImportSurfacePlugin::importFromFile(const QString& fileName)
mh->updatePrimitives(Algo::Render::GL2::LINES); mh->updatePrimitives(Algo::Render::GL2::LINES);
mh->updatePrimitives(Algo::Render::GL2::TRIANGLES); mh->updatePrimitives(Algo::Render::GL2::TRIANGLES);
} }
return mhg;
} }
} }
......
...@@ -34,12 +34,8 @@ public: ...@@ -34,12 +34,8 @@ public:
virtual void mouseMove(View* view, int buttons, int x, int y) {} virtual void mouseMove(View* view, int buttons, int x, int y) {}
virtual void wheelEvent(View* view, int delta, int x, int y) {} virtual void wheelEvent(View* view, int delta, int x, int y) {}
virtual void viewLinked(View* view) {}
virtual void viewUnlinked(View* view) {}
virtual void currentViewChanged(View* view) {}
public slots: public slots:
void importFromFile(const QString& fileName); MapHandlerGen* importFromFile(const QString& fileName);
void importFromFileDialog(); void importFromFileDialog();
private: private:
......
...@@ -15,7 +15,7 @@ bool ImportVolumePlugin::enable() ...@@ -15,7 +15,7 @@ bool ImportVolumePlugin::enable()
return true; return true;
} }
void ImportVolumePlugin::importFromFile(const QString& fileName) MapHandlerGen* ImportVolumePlugin::importFromFile(const QString& fileName)
{ {
QFileInfo fi(fileName); QFileInfo fi(fileName);
if(fi.exists()) if(fi.exists())
...@@ -43,6 +43,7 @@ void ImportVolumePlugin::importFromFile(const QString& fileName) ...@@ -43,6 +43,7 @@ void ImportVolumePlugin::importFromFile(const QString& fileName)
mh->updatePrimitives(Algo::Render::GL2::LINES); mh->updatePrimitives(Algo::Render::GL2::LINES);
mh->updatePrimitives(Algo::Render::GL2::TRIANGLES); mh->updatePrimitives(Algo::Render::GL2::TRIANGLES);
} }
return mhg;
} }
} }
......
...@@ -34,12 +34,8 @@ public: ...@@ -34,12 +34,8 @@ public:
virtual void mouseMove(View* view, int buttons, int x, int y) {} virtual void mouseMove(View* view, int buttons, int x, int y) {}
virtual void wheelEvent(View* view, int delta, int x, int y) {} virtual void wheelEvent(View* view, int delta, int x, int y) {}
virtual void viewLinked(View* view) {}
virtual void viewUnlinked(View* view) {}
virtual void currentViewChanged(View* view) {}
public slots: public slots:
void importFromFile(const QString& fileName); MapHandlerGen* importFromFile(const QString& fileName);
void importFromFileDialog(); void importFromFileDialog();
private: private:
......
...@@ -66,6 +66,10 @@ bool RenderPlugin::enable() ...@@ -66,6 +66,10 @@ bool RenderPlugin::enable()
connect(m_dockTab->check_renderFaces, SIGNAL(toggled(bool)), this, SLOT(cb_renderFacesChanged(bool))); connect(m_dockTab->check_renderFaces, SIGNAL(toggled(bool)), this, SLOT(cb_renderFacesChanged(bool)));
connect(m_dockTab->group_faceShading, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(cb_faceStyleChanged(QAbstractButton*))); connect(m_dockTab->group_faceShading, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(cb_faceStyleChanged(QAbstractButton*)));
connect(m_window, SIGNAL(viewAndPluginLinked(View*, Plugin*)), this, SLOT(viewLinked(View*, Plugin*)));
connect(m_window, SIGNAL(viewAndPluginUnlinked(View*, Plugin*)), this, SLOT(viewUnlinked(View*, Plugin*)));
connect(m_window, SIGNAL(currentViewChanged(View*)), this, SLOT(currentViewChanged(View*)));
return true; return true;
} }
...@@ -128,8 +132,10 @@ void RenderPlugin::redraw(View* view) ...@@ -128,8 +132,10 @@ void RenderPlugin::redraw(View* view)
} }
} }
void RenderPlugin::viewLinked(View* view) void RenderPlugin::viewLinked(View* view, Plugin* plugin)
{ {
if(plugin == this)
{
ParameterSet* params = new ParameterSet(); ParameterSet* params = new ParameterSet();
h_viewParams.insert(view, params); h_viewParams.insert(view, params);
const QList<MapHandlerGen*>& maps = view->getLinkedMaps(); const QList<MapHandlerGen*>& maps = view->getLinkedMaps();
...@@ -146,19 +152,23 @@ void RenderPlugin::viewLinked(View* view) ...@@ -146,19 +152,23 @@ void RenderPlugin::viewLinked(View* view)
if(view->isCurrentView()) if(view->isCurrentView())
m_dockTab->refreshUI(params); m_dockTab->refreshUI(params);
}
} }
void RenderPlugin::viewUnlinked(View* view) void RenderPlugin::viewUnlinked(View* view, Plugin* plugin)
{ {
if(plugin == this)
{
h_viewParams.remove(view); h_viewParams.remove(view);
disconnect(view, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(mapLinked(MapHandlerGen*))); disconnect(view, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(mapLinked(MapHandlerGen*)));
disconnect(view, SIGNAL(mapUnlinked(MapHandlerGen*)), this, SLOT(mapUnlinked(MapHandlerGen*))); disconnect(view, SIGNAL(mapUnlinked(MapHandlerGen*)), this, SLOT(mapUnlinked(MapHandlerGen*)));
}
} }
void RenderPlugin::currentViewChanged(View* view) void RenderPlugin::currentViewChanged(View* view)
{ {
assert(isLinkedToView(view)); if(isLinkedToView(view))
m_dockTab->refreshUI(h_viewParams[view]); m_dockTab->refreshUI(h_viewParams[view]);
} }
...@@ -210,6 +220,8 @@ void RenderPlugin::vboRemoved(Utils::VBO* vbo) ...@@ -210,6 +220,8 @@ void RenderPlugin::vboRemoved(Utils::VBO* vbo)
changePositionVBO(view, map, NULL); changePositionVBO(view, map, NULL);
if(params->perMap[map->getName()].normalVBO == vbo) if(params->perMap[map->getName()].normalVBO == vbo)
changeNormalVBO(view, map, NULL); changeNormalVBO(view, map, NULL);
m_dockTab->refreshUI(h_viewParams[view]);
} }
void RenderPlugin::changeSelectedMap(View* view, MapHandlerGen* map) void RenderPlugin::changeSelectedMap(View* view, MapHandlerGen* map)
......
...@@ -96,10 +96,6 @@ public: ...@@ -96,10 +96,6 @@ public:
virtual void mouseMove(View* view, int buttons, int x, int y) {} virtual void mouseMove(View* view, int buttons, int x, int y) {}
virtual void wheelEvent(View* view, int delta, int x, int y) {} virtual void wheelEvent(View* view, int delta, int x, int y) {}
virtual void viewLinked(View* view);
virtual void viewUnlinked(View* view);
virtual void currentViewChanged(View* view);
void setRefreshingUI(bool b) { b_refreshingUI = b; } void setRefreshingUI(bool b) { b_refreshingUI = b; }
protected: protected:
...@@ -114,8 +110,13 @@ protected: ...@@ -114,8 +110,13 @@ protected:
bool b_refreshingUI; bool b_refreshingUI;
public slots: public slots:
void viewLinked(View* view, Plugin* plugin);
void viewUnlinked(View* view, Plugin* plugin);
void currentViewChanged(View* view);
void mapLinked(MapHandlerGen* m); void mapLinked(MapHandlerGen* m);
void mapUnlinked(MapHandlerGen* m); void mapUnlinked(MapHandlerGen* m);
void vboAdded(Utils::VBO* vbo); void vboAdded(Utils::VBO* vbo);
void vboRemoved(Utils::VBO* vbo); void vboRemoved(Utils::VBO* vbo);
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2" alignment="Qt::AlignRight"> <item row="2" column="2">
<widget class="QPushButton" name="button_refreshVBOs"> <widget class="QPushButton" name="button_refreshVBOs">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
......
...@@ -36,6 +36,10 @@ bool RenderVectorPlugin::enable() ...@@ -36,6 +36,10 @@ bool RenderVectorPlugin::enable()
connect(m_dockTab->list_vectorVBO, SIGNAL(itemSelectionChanged()), this, SLOT(cb_selectedVectorsVBOChanged())); connect(m_dockTab->list_vectorVBO, SIGNAL(itemSelectionChanged()), this, SLOT(cb_selectedVectorsVBOChanged()));
connect(m_dockTab->slider_vectorsScaleFactor, SIGNAL(valueChanged(int)), this, SLOT(cb_vectorsScaleFactorChanged(int))); connect(m_dockTab->slider_vectorsScaleFactor, SIGNAL(valueChanged(int)), this, SLOT(cb_vectorsScaleFactorChanged(int)));
connect(m_window, SIGNAL(viewAndPluginLinked(View*, Plugin*)), this, SLOT(viewLinked(View*, Plugin*)));
connect(m_window, SIGNAL(viewAndPluginUnlinked(View*, Plugin*)), this, SLOT(viewUnlinked(View*, Plugin*)));
connect(m_window, SIGNAL(currentViewChanged(View*)), this, SLOT(currentViewChanged(View*)));
return true; return true;
} }
...@@ -66,8 +70,10 @@ void RenderVectorPlugin::redraw(View* view) ...@@ -66,8 +70,10 @@ void RenderVectorPlugin::redraw(View* view)
} }
} }
void RenderVectorPlugin::viewLinked(View* view) void RenderVectorPlugin::viewLinked(View* view, Plugin* plugin)
{ {
if(plugin == this)
{
ParameterSet* params = new ParameterSet(); ParameterSet* params = new ParameterSet();
h_viewParams.insert(view, params); h_viewParams.insert(view, params);
const QList<MapHandlerGen*>& maps = view->getLinkedMaps(); const QList<MapHandlerGen*>& maps = view->getLinkedMaps();
...@@ -84,19 +90,23 @@ void RenderVectorPlugin::viewLinked(View* view) ...@@ -84,19 +90,23 @@ void RenderVectorPlugin::viewLinked(View* view)
if(view->isCurrentView()) if(view->isCurrentView())
m_dockTab->refreshUI(params); m_dockTab->refreshUI(params);
}
} }
void RenderVectorPlugin::viewUnlinked(View* view) void RenderVectorPlugin::viewUnlinked(View* view, Plugin* plugin)
{ {
if(plugin == this)
{
h_viewParams.remove(view); h_viewParams.remove(view);
disconnect(view, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(mapLinked(MapHandlerGen*))); disconnect(view, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(mapLinked(MapHandlerGen*)));
disconnect(view, SIGNAL(mapUnlinked(MapHandlerGen*)), this, SLOT(mapUnlinked(MapHandlerGen*))); disconnect(view, SIGNAL(mapUnlinked(MapHandlerGen*)), this, SLOT(mapUnlinked(MapHandlerGen*)));
}
} }
void RenderVectorPlugin::currentViewChanged(View* view) void RenderVectorPlugin::currentViewChanged(View* view)
{ {
assert(isLinkedToView(view)); if(isLinkedToView(view))
m_dockTab->refreshUI(h_viewParams[view]); m_dockTab->refreshUI(h_viewParams[view]);
} }
......
...@@ -78,10 +78,6 @@ public: ...@@ -78,10 +78,6 @@ public:
virtual void mouseMove(View* view, int buttons, int x, int y) {} virtual void mouseMove(View* view, int buttons, int x, int y) {}
virtual void wheelEvent(View* view, int delta, int x, int y) {} virtual void wheelEvent(View* view, int delta, int x, int y) {}
virtual void viewLinked(View* view);
virtual void viewUnlinked(View* view);
virtual void currentViewChanged(View* view);
void setRefreshingUI(bool b) { b_refreshingUI = b; } void setRefreshingUI(bool b) { b_refreshingUI = b; }
protected: protected:
...@@ -93,8 +89,13 @@ protected: ...@@ -93,8 +89,13 @@ protected:
bool b_refreshingUI; bool b_refreshingUI;
public slots: public slots:
void viewLinked(View* view, Plugin* plugin);
void viewUnlinked(View* view, Plugin* plugin);
void currentViewChanged(View* view);
void mapLinked(MapHandlerGen* m); void mapLinked(MapHandlerGen* m);
void mapUnlinked(MapHandlerGen* m); void mapUnlinked(MapHandlerGen* m);
void vboAdded(Utils::VBO* vbo); void vboAdded(Utils::VBO* vbo);
void vboRemoved(Utils::VBO* vbo); void vboRemoved(Utils::VBO* vbo);
......
...@@ -36,10 +36,6 @@ public: ...@@ -36,10 +36,6 @@ public:
virtual void mouseMove(View* view, int buttons, int x, int y) {} virtual void mouseMove(View* view, int buttons, int x, int y) {}
virtual void wheelEvent(View* view, int delta, int x, int y) {} virtual void wheelEvent(View* view, int delta, int x, int y) {}
virtual void viewLinked(View* view) {}
virtual void viewUnlinked(View* view) {}
virtual void currentViewChanged(View* view) {}
public slots: public slots:
void openSubdivideSurfaceDialog(); void openSubdivideSurfaceDialog();
void subdivideSurface(); void subdivideSurface();
......
...@@ -37,6 +37,7 @@ file( ...@@ -37,6 +37,7 @@ file(
SET(SCHNApps_H_OBJECT_FILES SET(SCHNApps_H_OBJECT_FILES
${SCHNApps_ROOT_DIR}/include/view.h ${SCHNApps_ROOT_DIR}/include/view.h
${SCHNApps_ROOT_DIR}/include/mapHandler.h ${SCHNApps_ROOT_DIR}/include/mapHandler.h
${SCHNApps_ROOT_DIR}/include/plugin.h
${SCHNApps_ROOT_DIR}/include/window.h ${SCHNApps_ROOT_DIR}/include/window.h
${SCHNApps_ROOT_DIR}/include/viewButtonArea.h ${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/dialogs/camerasDialog.h ${SCHNApps_ROOT_DIR}/include/dialogs/camerasDialog.h
......
importPlugin = schnapps.loadPlugin("ImportSurfacePlugin");
differentialPropertiesPlugin = schnapps.loadPlugin("DifferentialPropertiesPlugin");
renderPlugin = schnapps.loadPlugin("RenderPlugin");
hand = importPlugin.importFromFile("/home/kraemer/Media/Data/surface/midRes/handman_12k.off");
v = schnapps.getView("view_0");
schnapps.linkViewAndPlugin(v.getName(), renderPlugin.getName());
schnapps.linkViewAndMap(v.getName(), hand.getName());
...@@ -24,11 +24,14 @@ public: ...@@ -24,11 +24,14 @@ public:
private: private:
Window* m_window; Window* m_window;
View* m_view; View* m_view;
bool b_refreshingUI;
void selectCurrentCamera(); void selectCurrentCamera();
public slots: public slots:
void selectedCameraChanged(); void selectedCameraChanged();
void selectCamera(View* view, Camera* camera);
void deselectCamera(View* view, Camera* camera);
void addCameraToList(Camera* c); void addCameraToList(Camera* c);
void removeCameraFromList(Camera* c); void removeCameraFromList(Camera* c);
}; };
......
...@@ -24,9 +24,12 @@ public: ...@@ -24,9 +24,12 @@ public:
private: private:
Window* m_window; Window* m_window;
View* m_view; View* m_view;
bool b_refreshingUI;
public slots: public slots:
void selectedMapsChanged(); void selectedMapsChanged();
void selectMap(View* view, MapHandlerGen* map);
void deselectMap(View* view, MapHandlerGen* map);
void addMapToList(MapHandlerGen* m); void addMapToList(MapHandlerGen* m);
void removeMapFromList(MapHandlerGen* m); void removeMapFromList(MapHandlerGen* m);
}; };
......
...@@ -24,9 +24,12 @@ public: ...@@ -24,9 +24,12 @@ public:
private: private:
Window* m_window; Window* m_window;
View* m_view; View* m_view;
bool b_refreshingUI;
public slots: public slots:
void selectedPluginsChanged(); void selectedPluginsChanged();
void selectPlugin(View* view, Plugin* plugin);
void deselectPlugin(View* view, Plugin* plugin);
void addPluginToList(Plugin* p); void addPluginToList(Plugin* p);
void removePluginFromList(Plugin* p); void removePluginFromList(Plugin* p);
}; };
......
...@@ -29,6 +29,9 @@ public: ...@@ -29,6 +29,9 @@ public:
virtual ~MapHandlerGen(); virtual ~MapHandlerGen();
const QString& getName() const { return m_name; } const QString& getName() const { return m_name; }
public slots:
QString getName() { return m_name; }
void setName(const QString& name) { m_name = name; } void setName(const QString& name) { m_name = name; }
Window* getWindow() const { return m_window; } Window* getWindow() const { return m_window; }
...@@ -42,6 +45,7 @@ public: ...@@ -42,6 +45,7 @@ public:
bool isUsed() const { return !l_views.empty(); } bool isUsed() const { return !l_views.empty(); }
public:
void draw(Utils::GLSLShader* shader, int primitive) { m_render->draw(shader, primitive); } void draw(Utils::GLSLShader* shader, int primitive) { m_render->draw(shader, primitive); }
/********************************************************* /*********************************************************
......
...@@ -16,11 +16,16 @@ class Window; ...@@ -16,11 +16,16 @@ class Window;
class Plugin : public QObject class Plugin : public QObject
{ {
Q_OBJECT
public: public:
Plugin(); Plugin();
virtual ~Plugin(); virtual ~Plugin();
const QString& getName() { return m_name; } const QString& getName() const { return m_name; }
public slots:
QString getName() { return m_name; }
void setName(const QString& name) { m_name = name; } void setName(const QString& name) { m_name = name; }
const QString& getFilePath() { return m_filePath; } const QString& getFilePath() { return m_filePath; }
...@@ -34,6 +39,7 @@ public: ...@@ -34,6 +39,7 @@ public:
bool getProvidesRendering() { return b_providesRendering; } bool getProvidesRendering() { return b_providesRendering; }
void setProvidesRendering(bool b) { b_providesRendering = b; } void setProvidesRendering(bool b) { b_providesRendering = b; }
public:
virtual bool enable() = 0; virtual bool enable() = 0;
virtual void disable() = 0; virtual void disable() = 0;
...@@ -46,10 +52,6 @@ public: ...@@ -46,10 +52,6 @@ public:
virtual void mouseMove(View* view, int buttons, int x, int y) = 0; virtual void mouseMove(View* view, int buttons, int x, int y) = 0;
virtual void wheelEvent(View* view, int delta, int x, int y) = 0; virtual void wheelEvent(View* view, int delta, int x, int y) = 0;
virtual void viewLinked(View* view) = 0;
virtual void viewUnlinked(View* view) = 0;
virtual void currentViewChanged(View* view) = 0;
/********************************************************* /*********************************************************
* MANAGE LINKED VIEWS * MANAGE LINKED VIEWS
*********************************************************/ *********************************************************/
......
...@@ -32,6 +32,9 @@ public: ...@@ -32,6 +32,9 @@ public:
~View(); ~View();
const QString& getName() const { return m_name; } const QString& getName() const { return m_name; }
public slots:
QString getName() { return m_name; }
void setName(const QString& name) { m_name = name; } void setName(const QString& name) { m_name = name; }
Window* getWindow() const { return m_window; } Window* getWindow() const { return m_window; }
...@@ -39,6 +42,7 @@ public: ...@@ -39,6 +42,7 @@ public:
bool isCurrentView() const { return m_window->getCurrentView() == this; } bool isCurrentView() const { return m_window->getCurrentView() == this; }
public:
virtual void init(); virtual void init();
virtual void preDraw(); virtual void preDraw();
virtual void draw(); virtual void draw();
......
...@@ -231,12 +231,17 @@ public: ...@@ -231,12 +231,17 @@ public:
public slots: public slots:
void linkViewAndCamera(View* v, Camera* c); void linkViewAndCamera(View* v, Camera* c);
void linkViewAndCamera(const QString& viewName, const QString& cameraName);
void linkViewAndMap(View* v, MapHandlerGen* m); void linkViewAndMap(View* v, MapHandlerGen* m);
void linkViewAndMap(const QString& viewName, const QString& mapName);
void unlinkViewAndMap(View* v, MapHandlerGen* m); void unlinkViewAndMap(View* v, MapHandlerGen* m);
void unlinkViewAndMap(const QString& viewName, const QString& mapName);
void linkViewAndPlugin(View* v, Plugin* p); void linkViewAndPlugin(View* v, Plugin* p);
void linkViewAndPlugin(const QString& viewName, const QString& pluginName);
void unlinkViewAndPlugin(View* v, Plugin* p); void unlinkViewAndPlugin(View* v, Plugin* p);
void unlinkViewAndPlugin(const QString& viewName, const QString& pluginName);
/********************************************************* /*********************************************************
* MANAGE TEXTURES