Commit 54603ff0 authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps: add some slots / import return mapHandler

parent 261883ed
...@@ -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
......
...@@ -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;
} }
} }
......
...@@ -35,7 +35,7 @@ public: ...@@ -35,7 +35,7 @@ public:
virtual void wheelEvent(View* view, int delta, int x, int y) {} virtual void wheelEvent(View* view, int delta, int x, int y) {}
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;
} }
} }
......
...@@ -35,7 +35,7 @@ public: ...@@ -35,7 +35,7 @@ public:
virtual void wheelEvent(View* view, int delta, int x, int y) {} virtual void wheelEvent(View* view, int delta, int x, int y) {}
public slots: public slots:
void importFromFile(const QString& fileName); MapHandlerGen* importFromFile(const QString& fileName);
void importFromFileDialog(); void importFromFileDialog();
private: private:
......
...@@ -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());
...@@ -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,12 +16,16 @@ class Window; ...@@ -16,12 +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() const { return m_name; }
public slots: public slots:
const QString& getName() { return m_name; } 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; }
......
...@@ -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();
......
#include <QSplashScreen> #include <QSplashScreen>
#include <QFileInfo>
#include "PythonQt/PythonQt.h" #include "PythonQt/PythonQt.h"
#include "PythonQt/gui/PythonQtScriptingConsole.h" #include "PythonQt/gui/PythonQtScriptingConsole.h"
#include "window.h" #include "window.h"
...@@ -29,7 +30,9 @@ int main(int argc, char* argv[]) ...@@ -29,7 +30,9 @@ int main(int argc, char* argv[])
schnapps.show(); schnapps.show();
pythonContext.addObject("schnapps", &schnapps); pythonContext.addObject("schnapps", &schnapps);
pythonContext.evalFile(app.applicationDirPath() + QString("/init.py")); QFileInfo fi(app.applicationDirPath() + QString("/init.py"));
if(fi.exists())
pythonContext.evalFile(fi.filePath());
splash->finish(&schnapps); splash->finish(&schnapps);
delete splash; delete splash;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment