Commit 326e47d1 authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps: update camera draw

parent 4af88cba
cmake_minimum_required(VERSION 2.8)
INCLUDE_DIRECTORIES(
${SCHNApps_ROOT_DIR}/include
${SCHNApps_ROOT_DIR}/Plugins/cameraControl
${CMAKE_CURRENT_BINARY_DIR}
)
SET( PLUGIN_SRC
${SCHNApps_ROOT_DIR}/Plugins/cameraControl/cameraControl.cpp
)
SET( PLUGIN_H
${SCHNApps_ROOT_DIR}/Plugins/cameraControl/cameraControl.h
)
IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
ADD_DEFINITIONS(-DDEBUG)
IF(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
ELSE (WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Debug ${CGoGN_ROOT_DIR}/lib/Release )
ENDIF (WIN32)
# QT4_WRAP_UI( PLUGIN_UI ${PLUGIN_FORM} )
QT4_WRAP_CPP( PLUGIN_MOC ${PLUGIN_H} )
ADD_LIBRARY( CameraControlD SHARED
${PLUGIN_SRC}
${PLUGIN_UI}
${PLUGIN_MOC}
)
TARGET_LINK_LIBRARIES( CameraControlD
${CGoGN_LIBS_D}
${COMMON_LIBS}
)
ADD_DEPENDENCIES( CameraControlD SCHNAppsD )
SET_TARGET_PROPERTIES( CameraControlD PROPERTIES COMPILE_DEFINITIONS "DEBUG" )
ELSE ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
IF(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
ELSE (WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
ENDIF (WIN32)
# QT4_WRAP_UI( PLUGIN_UI ${PLUGIN_FORM} )
QT4_WRAP_CPP( PLUGIN_MOC ${PLUGIN_H} )
ADD_LIBRARY( CameraControl SHARED
${PLUGIN_SRC}
${PLUGIN_UI}
${PLUGIN_MOC}
)
TARGET_LINK_LIBRARIES( CameraControl
${CGoGN_LIBS_R}
${COMMON_LIBS}
)
ADD_DEPENDENCIES( CameraControl SCHNApps )
ENDIF ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
#include "cameraControl.h"
#include "mapHandler.h"
#include "Algo/Import/import.h"
#include <QFileDialog>
#include <QFileInfo>
bool CameraControlPlugin::enable()
{
return true;
}
#ifndef DEBUG
Q_EXPORT_PLUGIN2(CameraControlPlugin, CameraControlPlugin)
#else
Q_EXPORT_PLUGIN2(CameraControlPluginD, CameraControlPlugin)
#endif
#ifndef _CAMERACONTROL_PLUGIN_H_
#define _CAMERACONTROL_PLUGIN_H_
#include "plugin.h"
using namespace CGoGN;
using namespace SCHNApps;
class CameraControlPlugin : public Plugin
{
Q_OBJECT
Q_INTERFACES(CGoGN::SCHNApps::Plugin)
public:
CameraControlPlugin()
{
setProvidesRendering(false);
}
~CameraControlPlugin()
{}
virtual bool enable();
virtual void disable() {}
virtual void redraw(View *view) {}
virtual void keyPress(View* view, int key) {}
virtual void keyRelease(View* view, int key) {}
virtual void mousePress(View* view, int button, int x, int y) {}
virtual void mouseRelease(View* view, int button, 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) {}
public slots:
private:
};
#endif
...@@ -22,50 +22,34 @@ ...@@ -22,50 +22,34 @@
<property name="sizeConstraint"> <property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum> <enum>QLayout::SetDefaultConstraint</enum>
</property> </property>
<item row="0" column="0" colspan="2"> <item row="1" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Position :</string> <string>Color :</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="0" colspan="2">
<widget class="QComboBox" name="combo_positionVBO"> <widget class="QLabel" name="label_2">
<property name="sizePolicy"> <property name="text">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <string>Position :</string>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="1" column="1" colspan="2">
<widget class="QPushButton" name="button_refreshVBOs"> <widget class="QComboBox" name="combo_colorVBO">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Refresh</string>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="0" column="2">
<widget class="QLabel" name="label_3"> <widget class="QComboBox" name="combo_positionVBO">
<property name="text">
<string>cColor :</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="combo_colorVBO">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
......
...@@ -6,43 +6,56 @@ ...@@ -6,43 +6,56 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>198</width> <width>287</width>
<height>318</height> <height>332</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>CamerasDialog</string> <string>CamerasDialog</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <widget class="QPushButton" name="addCameraButton">
<item> <property name="text">
<widget class="QPushButton" name="addCameraButton"> <string>Add</string>
<property name="text"> </property>
<string>Add</string> </widget>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeCamerasButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QListWidget" name="cameraList"> <widget class="QPushButton" name="removeCamerasButton">
<property name="selectionMode"> <property name="text">
<enum>QAbstractItemView::ExtendedSelection</enum> <string>Remove</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QTreeWidget" name="cameraList">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Ortho</string>
</property>
</column>
<column>
<property name="text">
<string>Draw</string>
</property>
</column>
<column>
<property name="text">
<string>Draw path</string>
</property>
</column>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="OKButton"> <widget class="QPushButton" name="OKButton">
<property name="text"> <property name="text">
......
...@@ -20,6 +20,7 @@ public: ...@@ -20,6 +20,7 @@ public:
Camera(const QString& name, Window* window); Camera(const QString& name, Window* window);
~Camera(); ~Camera();
public slots:
const QString& getName() const { return m_name; } const QString& getName() const { return m_name; }
void setName(const QString& name) { m_name = name; } void setName(const QString& name) { m_name = name; }
...@@ -29,29 +30,20 @@ public: ...@@ -29,29 +30,20 @@ public:
bool isUsed() const { return !l_views.empty(); } bool isUsed() const { return !l_views.empty(); }
bool isShared() const { return l_views.size() > 1; } bool isShared() const { return l_views.size() > 1; }
void changeType(qglviewer::Camera::Type type);
/********************************************************* /*********************************************************
* CAMERA DRAWING * CAMERA DRAWING
*********************************************************/ *********************************************************/
virtual void draw();
bool getDraw() const { return m_draw; } bool getDraw() const { return m_draw; }
void setDraw(bool b = true) { m_draw = b; } void setDraw(bool b);
bool getDrawFarPlane() const { return m_drawFarPlane; }
void setDrawFarPlane(bool b) { m_drawFarPlane = b; }
double getDrawScale() const { return m_drawScale; }
void setDrawScale(double s) { m_drawScale = s; }
bool getDrawPath() const { return m_drawPath; } bool getDrawPath() const { return m_drawPath; }
void setDrawPath(bool b) { m_drawPath = b; } void setDrawPath(bool b);
bool getDrawPathAxis() const { return m_drawPathAxis; } public:
void setDrawPathAxis(bool b) { m_drawPathAxis = b; } // virtual void draw();
double getDrawPathScale() const { return m_drawPathScale; }
void setDrawPathScale(double s) { m_drawPathScale = s;}
/********************************************************* /*********************************************************
* MANAGE LINKED VIEWS * MANAGE LINKED VIEWS
...@@ -76,12 +68,7 @@ protected: ...@@ -76,12 +68,7 @@ protected:
QList<View*> l_views; QList<View*> l_views;
bool m_draw; bool m_draw;
bool m_drawFarPlane;
double m_drawScale;
bool m_drawPath; bool m_drawPath;
bool m_drawPathAxis;
double m_drawPathScale;
int m_snapCount; int m_snapCount;
}; };
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define _CAMERASDIALOG_H_ #define _CAMERASDIALOG_H_
#include "ui_camerasDialog.h" #include "ui_camerasDialog.h"
#include "view.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -22,12 +23,18 @@ public: ...@@ -22,12 +23,18 @@ public:
private: private:
Window* m_window; Window* m_window;
bool b_refreshingUI;
public slots: public slots:
void setCameraType(const QString& name, qglviewer::Camera::Type type);
void setDrawCamera(const QString& name, bool b);
void setDrawCameraPath(const QString& name, bool b);
void cb_addCamera(); void cb_addCamera();
void cb_removeCameras(); void cb_removeCameras();
void cb_addCameraToList(Camera* c); void cb_addCameraToList(Camera* c);
void cb_removeCameraFromList(Camera* c); void cb_removeCameraFromList(Camera* c);
void cb_itemChanged(QTreeWidgetItem* item, int column);
}; };
} // namespace SCHNApps } // namespace SCHNApps
......
...@@ -27,19 +27,14 @@ class Window : public QMainWindow, Ui::Window ...@@ -27,19 +27,14 @@ class Window : public QMainWindow, Ui::Window
Q_OBJECT Q_OBJECT
public: public:
/**
* \fn Window()
* \brief Constructor
*/
Window(const QString& appPath, PythonQtObjectPtr& pythonContext, PythonQtScriptingConsole& pythonConsole); Window(const QString& appPath, PythonQtObjectPtr& pythonContext, PythonQtScriptingConsole& pythonConsole);
/**
* \fn ~Window()
* \brief Destructor
*/
~Window(); ~Window();
public slots:
const QString& getAppPath() { return m_appPath; } const QString& getAppPath() { return m_appPath; }
CamerasDialog* getCamerasDialog() { return m_camerasDialog; }
PluginsDialog* getPluginsDialog() { return m_pluginsDialog; }
MapsDialog* getMapsDialog() { return m_mapsDialog; }
/********************************************************* /*********************************************************
* MANAGE DOCK * MANAGE DOCK
...@@ -47,24 +42,8 @@ public: ...@@ -47,24 +42,8 @@ public:
QTabWidget* getDockTabWidget() const { return m_dockTabWidget; } QTabWidget* getDockTabWidget() const { return m_dockTabWidget; }
/** public:
* \fn void addTabInDock(QWidget* tabWidget, const QString& tabText, bool enable)
* \brief Adds the widget as a new tab in the interface's dock
*
* \param tabWidget the created and allocated pointer to the QWidget to add in the dock
* \param tabText The text that will appears in the tab label
* \param enable is the new tab enabled ?
*/
void addTabInDock(QWidget* tabWidget, const QString& tabText, bool enable); void addTabInDock(QWidget* tabWidget, const QString& tabText, bool enable);
/**
* \fn void removeTabInDock(QWidget* tabWidget)
* \brief removes a given widget from the tab
*
* \param tabWidget the reference to the widget you want to remove
*
* If the widget does belong to the tab, it will be destroyed.
*/
void removeTabInDock(QWidget* tabWidget); void removeTabInDock(QWidget* tabWidget);
public slots: public slots:
...@@ -76,55 +55,7 @@ public slots: ...@@ -76,55 +55,7 @@ public slots:
*********************************************************/ *********************************************************/
public: public:
/**
* \fn bool addMenuAction(const QString& menuPath, QAction* action)
* \brief adds an action in the program menu bar
*
* \param menuPath the menu path (see details below) to specify a location for the action in the menu.
* \param action a pointer to the allocated action to add in the menu. All the details on that action (such as
* QObject::connect() calls) are not dealt in this function.
*
* The menu path is a string used to specify the location of the new action in the menu bar.
* In such path every menu step of the path should be separate by ';'. The action is the last substring after
* the last ';', and will be added in the menu with that name. All non-existing menu specified in the path
* shall be created.
*
* <b>Example 1:</b> if you want to add an entry <em>"action"</em> to the existing menu <em>"Plugins"</em> the
* menu path shall be: <em>Plugins;action</em>
*
* <b>Example 2:</b> if you want to add an entry <em>"action"</em> in a new menu <em>"config"</em> that is also a
* submenu of a new menu <em>"Settings"</em>, the menu path
* shall be: <em>Settings;config;action</em>
*
* A new action should at least belong to one menu (already existing or not). Otherwise the method will fail.
*
* This method is called by Plugin methods
*
* \return a boolean whether the method succeeded or not.
*
* If the function failed, the error code ( Error::code ) is affected with a value
* depending on the error. This error can be shown with Error::showError
*
* \see deleteMenuAction()
* \see Plugin::addMenuAction()
*/
bool addMenuAction(const QString& menuPath, QAction* action); bool addMenuAction(const QString& menuPath, QAction* action);
/**
* \fn void deleteMenuAction(QAction* action)
* \brief delete an action from the menu bar
*
* \param action pointer to the allocated action to delete.
*
* If this action was the only action remaining in a menu, this menu will also be deleted.
*
* \warning DO NOT use this method with an action that hasn't been added with addMenuAction()
*
* This method is called by Plugin methods
*
* \see addMenuAction()
* \see Plugin::removeMenuAction()
*/
void removeMenuAction(QAction* action); void removeMenuAction(QAction* action);
/********************************************************* /*********************************************************
...@@ -132,7 +63,6 @@ public: ...@@ -132,7 +63,6 @@ public:
*********************************************************/ *********************************************************/
bool addToolbarAction(QAction* action); bool addToolbarAction(QAction* action);
void removeToolbarAction(QAction* action); void removeToolbarAction(QAction* action);
/********************************************************* /*********************************************************
...@@ -173,42 +103,9 @@ public: ...@@ -173,42 +103,9 @@ public:
public slots: public slots:
void registerPluginsDirectory(const QString& path); void registerPluginsDirectory(const QString& path);
/**
* \fn bool loadPlugin(QString pluginPath)
* \brief Loads and references a Plugin
*
* \param pluginPath the absolute path of the Plugin location
*
* The Plugin is loaded and referenced under a name that is the Plugin file name
* where the extension ('.so', '.dylib') and the prefix 'lib' were removed.
*
* <b>Example:</b> <em>/path/libExample.so</em> will be referenced as <em>Example</em>
*
* You have to make sure that a Plugin file with a similar name hasn't been loaded yet, otherwise
* the loading will fail.
*
* This method calls the Plugin::enable() method of the concerned Plugin. That is why
* when Plugin are written, this method is overriden and used as an initialization method.
*
* \return a boolean whether the loading succeeded or not.
*/
Plugin* loadPlugin(const QString& pluginFilePath); Plugin* loadPlugin(const QString& pluginFilePath);
/**
* \fn void unloadPlugin(QString pluginName)
* \brief Unload the Plugin of a given name
*
* \param pluginName the name under which the Plugin is referenced
*
* The Plugin of the given name is dereferenced and deleted, if it exists and was previously
* referenced, if not, the method does nothing.
*
* This method calls the Plugin::disable() method of the concerned Plugin. That is why,
* when Plugin are written, this method is overriden and used as a destruction method.
*/
void unloadPlugin(const QString& pluginName); void unloadPlugin(const QString& pluginName);
public:
Plugin* getPlugin(const QString& name) const; Plugin* getPlugin(const QString& name) const;
QList<Plugin*> getPluginsList() const { return h_plugins.values(); } QList<Plugin*> getPluginsList() const { return h_plugins.values(); }
const PluginHash& getPluginsHash() const { return h_plugins; } const PluginHash& getPluginsHash() const { return h_plugins; }
...@@ -219,9 +116,14 @@ public: ...@@ -219,9 +116,14 @@ public:
* MANAGE MAPS * MANAGE MAPS
*********************************************************/ *********************************************************/
public:
MapHandlerGen* addMap(const QString& name, unsigned int dim); MapHandlerGen* addMap(const QString& name, unsigned int dim);
void removeMap(const QString& name); void removeMap(const QString& name);
public slots:
MapHandlerGen* getMap(const QString& name) const; MapHandlerGen* getMap(const QString& name) const;
public:
QList<MapHandlerGen*> getMapsList() const { return h_maps.values(); } QList<MapHandlerGen*> getMapsList() const { return h_maps.values(); }
const MapHash& getMapsHash() const { return h_maps; } const MapHash& getMapsHash() const { return h_maps; }
...@@ -288,9 +190,9 @@ public slots: ...@@ -288,9 +190,9 @@ public slots:
void cb_showHideDock(); void cb_showHideDock();
void cb_showHidePythonDock(); void cb_showHidePythonDock();
void cb_manageCameras(); void cb_showCamerasDialog();
void cb_managePlugins(); void cb_showPluginsDialog();
void cb_manageMaps(); void cb_showMapsDialog();
signals: