Commit 5d64b236 authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps: petit debug

parent 4081dfdc
......@@ -29,6 +29,7 @@ file(
${SCHNApps_ROOT_DIR}/src/system.cpp
${SCHNApps_ROOT_DIR}/src/view.cpp
${SCHNApps_ROOT_DIR}/src/window.cpp
${SCHNApps_ROOT_DIR}/src/viewButtonArea.cpp
${SCHNApps_ROOT_DIR}/src/viewSelector.cpp
${SCHNApps_ROOT_DIR}/src/cameraDialog.cpp
${SCHNApps_ROOT_DIR}/src/pluginDialog.cpp
......@@ -38,7 +39,9 @@ file(
SET(SCHNApps_H_OBJECT_FILES
${SCHNApps_ROOT_DIR}/include/window.h
${SCHNApps_ROOT_DIR}/include/view.h
${SCHNApps_ROOT_DIR}/include/plugin.h
${SCHNApps_ROOT_DIR}/include/splitArea.h
${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/viewSelector.h
${SCHNApps_ROOT_DIR}/include/cameraDialog.h
${SCHNApps_ROOT_DIR}/include/pluginDialog.h
......
......@@ -70,20 +70,20 @@ public:
*/
void disable();
void cb_initGL(Scene *scene);
void cb_initGL(View *scene);
virtual void cb_updateMatrix(View* view) {}
void cb_redraw(Scene *scene);
virtual void cb_keyPress(Scene* scene, int key) {}
virtual void cb_keyRelease(Scene* scene, int key) {}
virtual void cb_mousePress(Scene* scene, int button, int x, int y) {}
virtual void cb_mouseRelease(Scene* scene, int button, int x, int y) {}
// virtual void cb_mouseClick(Scene* scene, int button, int x, int y) {}
virtual void cb_mouseMove(Scene* scene, int buttons, int x, int y) {}
virtual void cb_wheelEvent(Scene* scene, int delta, int x, int y) {}
virtual void cb_viewAdded(Scene* s) {}
virtual void cb_viewRemoved(Scene* s) {}
void cb_redraw(View *scene);
virtual void cb_keyPress(View* scene, int key) {}
virtual void cb_keyRelease(View* scene, int key) {}
virtual void cb_mousePress(View* scene, int button, int x, int y) {}
virtual void cb_mouseRelease(View* scene, int button, int x, int y) {}
// virtual void cb_mouseClick(View* scene, int button, int x, int y) {}
virtual void cb_mouseMove(View* scene, int buttons, int x, int y) {}
virtual void cb_wheelEvent(View* scene, int delta, int x, int y) {}
virtual void cb_viewAdded(View* s) {}
virtual void cb_viewRemoved(View* s) {}
protected:
/** Attributes that are specific to this plugin **/
......
#include "firstPlugin.h"
#include "Algo/Geometry/boundingbox.h"
void FirstPlugin::cb_initGL(Scene *scene)
void FirstPlugin::cb_initGL(View *view)
{
if (scene)
if (view)
{
// we fit the first (possibly the only) view of the newly liked
// scene to the content of our map
// bounding box of scene
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
scene->firstViewFitSphere(bb.center()[0], bb.center()[1], bb.center()[2], bb.maxSize());
// scene->firstViewFitSphere(bb.center()[0], bb.center()[1], bb.center()[2], bb.maxSize());
m_render_topo = new Algo::Render::GL2::TopoRender() ;
......@@ -21,7 +18,7 @@ void FirstPlugin::cb_initGL(Scene *scene)
}
}
void FirstPlugin::cb_redraw(Scene *scene)
void FirstPlugin::cb_redraw(View* view)
{
m_render_topo->drawTopo();
}
......
......@@ -31,6 +31,7 @@ file(
${SCHNApps_ROOT_DIR}/src/system.cpp
${SCHNApps_ROOT_DIR}/src/view.cpp
${SCHNApps_ROOT_DIR}/src/window.cpp
${SCHNApps_ROOT_DIR}/src/viewButtonArea.cpp
${SCHNApps_ROOT_DIR}/src/viewSelector.cpp
${SCHNApps_ROOT_DIR}/src/cameraDialog.cpp
${SCHNApps_ROOT_DIR}/src/pluginDialog.cpp
......@@ -40,7 +41,9 @@ file(
SET(SCHNApps_H_OBJECT_FILES
${SCHNApps_ROOT_DIR}/include/window.h
${SCHNApps_ROOT_DIR}/include/view.h
${SCHNApps_ROOT_DIR}/include/plugin.h
${SCHNApps_ROOT_DIR}/include/splitArea.h
${SCHNApps_ROOT_DIR}/include/viewButtonArea.h
${SCHNApps_ROOT_DIR}/include/viewSelector.h
${SCHNApps_ROOT_DIR}/include/cameraDialog.h
${SCHNApps_ROOT_DIR}/include/pluginDialog.h
......
......@@ -267,7 +267,7 @@ protected:
MapHash h_maps;
PluginDialog* m_pluginDialog;
CameraDialog* m_cameraViewDialog;
CameraDialog* m_cameraDialog;
/**
* \var bool keys[3]
......
......@@ -18,6 +18,7 @@ View::View(const QString& name, Window* w, QWidget* parent, const QGLWidget* sha
QGLViewer(parent, shareWidget),
m_name(name),
m_window(w),
m_currentCamera(NULL),
m_cameraButton(NULL),
m_pluginsButton(NULL),
m_mapsButton(NULL),
......@@ -47,20 +48,6 @@ View::~View()
delete m_buttonArea;
}
void View::setCurrentCamera(Camera* c)
{
if(c != m_currentCamera)
{
if(m_currentCamera != NULL)
m_currentCamera->unlinkView(this);
m_currentCamera = c;
m_currentCamera->linkView(this);
this->setCamera(m_currentCamera);
updateTextInfo();
updateGL();
}
}
void View::initGL()
{
m_cameraButton = new ViewButton(":icons/icons/camera_32.png", this);
......@@ -101,7 +88,7 @@ void View::draw()
glEnd();
glPushAttrib(GL_ALL_ATTRIB_BITS);
drawButtons();
// drawButtons();
drawText();
glPopAttrib();
}
......@@ -183,6 +170,42 @@ void View::drawOverpaint(QPainter *painter)
painter->restore();
}
void View::setCurrentCamera(Camera* c)
{
if(c != m_currentCamera)
{
if(m_currentCamera != NULL)
m_currentCamera->unlinkView(this);
m_currentCamera = c;
m_currentCamera->linkView(this);
this->setCamera(m_currentCamera);
updateTextInfo();
updateGL();
}
}
void View::linkPlugin(Plugin* plugin)
{
if(plugin && !l_plugins.contains(plugin))
l_plugins.push_back(plugin);
}
void View::unlinkPlugin(Plugin* plugin)
{
l_plugins.removeOne(plugin);
}
void View::linkMap(MapHandler* map)
{
if(map && !l_maps.contains(map))
l_maps.push_back(map);
}
void View::unlinkMap(MapHandler* map)
{
l_maps.removeOne(map);
}
void View::updateTextInfo()
{
m_textInfo =
......
#include "viewButtonArea.h"
#include "camera.h"
#include "scene.h"
//#include "context.h"
#include <iostream>
......
......@@ -26,7 +26,7 @@ Window::Window(QWidget *parent) :
m_initialization = true;
m_pluginDialog = new PluginDialog(this);
m_cameraViewDialog = new CameraDialog(this);
m_cameraDialog = new CameraDialog(this);
glewInit();
......@@ -414,8 +414,6 @@ View* Window::addView(const QString& name)
view = new View(name, this, this, m_firstView);
h_views.insert(name, view);
m_cameraViewDialog->addViewToList(view->getName());
return view;
}
......@@ -465,7 +463,7 @@ Camera* Window::addCamera(const QString& name)
Camera* camera = new Camera(name, this);
h_cameras.insert(name, camera);
m_cameraViewDialog->addCameraToList(camera->getName());
m_cameraDialog->addCameraToList(camera->getName());
return camera;
}
......@@ -655,5 +653,5 @@ void Window::cb_manageViews()
void Window::cb_manageCameras()
{
m_cameraViewDialog->show();
m_cameraDialog->show();
}
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