From 5d64b2367f6f3b76b08294b75722311e6ab978ae Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Thu, 29 Nov 2012 22:51:45 +0100 Subject: [PATCH] SCHNApps: petit debug --- SCHNApps/Debug/CMakeLists.txt | 3 ++ .../Plugins/firstPlugin/include/firstPlugin.h | 26 ++++----- .../Plugins/firstPlugin/src/firstPlugin.cpp | 11 ++-- SCHNApps/Release/CMakeLists.txt | 3 ++ SCHNApps/include/window.h | 2 +- SCHNApps/src/view.cpp | 53 +++++++++++++------ SCHNApps/src/viewButtonArea.cpp | 2 - SCHNApps/src/window.cpp | 8 ++- 8 files changed, 65 insertions(+), 43 deletions(-) diff --git a/SCHNApps/Debug/CMakeLists.txt b/SCHNApps/Debug/CMakeLists.txt index 1c3d5298..5a38af8e 100644 --- a/SCHNApps/Debug/CMakeLists.txt +++ b/SCHNApps/Debug/CMakeLists.txt @@ -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 diff --git a/SCHNApps/Plugins/firstPlugin/include/firstPlugin.h b/SCHNApps/Plugins/firstPlugin/include/firstPlugin.h index 5c2da874..b1f6396f 100644 --- a/SCHNApps/Plugins/firstPlugin/include/firstPlugin.h +++ b/SCHNApps/Plugins/firstPlugin/include/firstPlugin.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 **/ diff --git a/SCHNApps/Plugins/firstPlugin/src/firstPlugin.cpp b/SCHNApps/Plugins/firstPlugin/src/firstPlugin.cpp index c67bae72..38be9119 100644 --- a/SCHNApps/Plugins/firstPlugin/src/firstPlugin.cpp +++ b/SCHNApps/Plugins/firstPlugin/src/firstPlugin.cpp @@ -1,17 +1,14 @@ #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 bb = Algo::Geometry::computeBoundingBox(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(); } diff --git a/SCHNApps/Release/CMakeLists.txt b/SCHNApps/Release/CMakeLists.txt index 63c6b386..a29e4d4b 100644 --- a/SCHNApps/Release/CMakeLists.txt +++ b/SCHNApps/Release/CMakeLists.txt @@ -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 diff --git a/SCHNApps/include/window.h b/SCHNApps/include/window.h index 35f71c08..6c2729f6 100644 --- a/SCHNApps/include/window.h +++ b/SCHNApps/include/window.h @@ -267,7 +267,7 @@ protected: MapHash h_maps; PluginDialog* m_pluginDialog; - CameraDialog* m_cameraViewDialog; + CameraDialog* m_cameraDialog; /** * \var bool keys[3] diff --git a/SCHNApps/src/view.cpp b/SCHNApps/src/view.cpp index dc8c7a6c..4056664d 100644 --- a/SCHNApps/src/view.cpp +++ b/SCHNApps/src/view.cpp @@ -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 = diff --git a/SCHNApps/src/viewButtonArea.cpp b/SCHNApps/src/viewButtonArea.cpp index ff0816c4..19430b40 100644 --- a/SCHNApps/src/viewButtonArea.cpp +++ b/SCHNApps/src/viewButtonArea.cpp @@ -1,8 +1,6 @@ #include "viewButtonArea.h" #include "camera.h" -#include "scene.h" -//#include "context.h" #include diff --git a/SCHNApps/src/window.cpp b/SCHNApps/src/window.cpp index be3f7d1f..a3618a93 100644 --- a/SCHNApps/src/window.cpp +++ b/SCHNApps/src/window.cpp @@ -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(); } -- GitLab