Commit bc452aa6 authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps: v1 !!!

parent f0cd17c2
......@@ -25,27 +25,25 @@ file(
${SCHNApps_ROOT_DIR}/src/main.cpp
${SCHNApps_ROOT_DIR}/src/mapHandler.cpp
${SCHNApps_ROOT_DIR}/src/plugin.cpp
${SCHNApps_ROOT_DIR}/src/splitArea.cpp
${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
${SCHNApps_ROOT_DIR}/src/camerasDialog.cpp
${SCHNApps_ROOT_DIR}/src/pluginsDialog.cpp
${SCHNApps_ROOT_DIR}/src/mapsDialog.cpp
${SCHNApps_ROOT_DIR}/src/cameraViewDialog.cpp
${SCHNApps_ROOT_DIR}/src/pluginsViewDialog.cpp
${SCHNApps_ROOT_DIR}/src/mapsViewDialog.cpp
)
SET(SCHNApps_H_OBJECT_FILES
${SCHNApps_ROOT_DIR}/include/splitArea.h
${SCHNApps_ROOT_DIR}/include/view.h
${SCHNApps_ROOT_DIR}/include/window.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
${SCHNApps_ROOT_DIR}/include/camerasDialog.h
${SCHNApps_ROOT_DIR}/include/pluginsDialog.h
${SCHNApps_ROOT_DIR}/include/mapsDialog.h
${SCHNApps_ROOT_DIR}/include/cameraViewDialog.h
${SCHNApps_ROOT_DIR}/include/pluginsViewDialog.h
${SCHNApps_ROOT_DIR}/include/mapsViewDialog.h
......@@ -55,8 +53,9 @@ file(
GLOB
SCHNApps_FORM_FILES
${SCHNApps_ROOT_DIR}/forms/window.ui
${SCHNApps_ROOT_DIR}/forms/cameraDialog.ui
${SCHNApps_ROOT_DIR}/forms/pluginDialog.ui
${SCHNApps_ROOT_DIR}/forms/camerasDialog.ui
${SCHNApps_ROOT_DIR}/forms/pluginsDialog.ui
${SCHNApps_ROOT_DIR}/forms/mapsDialog.ui
${SCHNApps_ROOT_DIR}/forms/cameraViewDialog.ui
${SCHNApps_ROOT_DIR}/forms/pluginsViewDialog.ui
${SCHNApps_ROOT_DIR}/forms/mapsViewDialog.ui
......
......@@ -25,27 +25,25 @@ file(
${SCHNApps_ROOT_DIR}/src/main.cpp
${SCHNApps_ROOT_DIR}/src/mapHandler.cpp
${SCHNApps_ROOT_DIR}/src/plugin.cpp
${SCHNApps_ROOT_DIR}/src/splitArea.cpp
${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
${SCHNApps_ROOT_DIR}/src/camerasDialog.cpp
${SCHNApps_ROOT_DIR}/src/pluginsDialog.cpp
${SCHNApps_ROOT_DIR}/src/mapsDialog.cpp
${SCHNApps_ROOT_DIR}/src/cameraViewDialog.cpp
${SCHNApps_ROOT_DIR}/src/pluginsViewDialog.cpp
${SCHNApps_ROOT_DIR}/src/mapsViewDialog.cpp
)
SET(SCHNApps_H_OBJECT_FILES
${SCHNApps_ROOT_DIR}/include/splitArea.h
${SCHNApps_ROOT_DIR}/include/view.h
${SCHNApps_ROOT_DIR}/include/window.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
${SCHNApps_ROOT_DIR}/include/camerasDialog.h
${SCHNApps_ROOT_DIR}/include/pluginsDialog.h
${SCHNApps_ROOT_DIR}/include/mapsDialog.h
${SCHNApps_ROOT_DIR}/include/cameraViewDialog.h
${SCHNApps_ROOT_DIR}/include/pluginsViewDialog.h
${SCHNApps_ROOT_DIR}/include/mapsViewDialog.h
......@@ -55,8 +53,9 @@ file(
GLOB
SCHNApps_FORM_FILES
${SCHNApps_ROOT_DIR}/forms/window.ui
${SCHNApps_ROOT_DIR}/forms/cameraDialog.ui
${SCHNApps_ROOT_DIR}/forms/pluginDialog.ui
${SCHNApps_ROOT_DIR}/forms/camerasDialog.ui
${SCHNApps_ROOT_DIR}/forms/pluginsDialog.ui
${SCHNApps_ROOT_DIR}/forms/mapsDialog.ui
${SCHNApps_ROOT_DIR}/forms/cameraViewDialog.ui
${SCHNApps_ROOT_DIR}/forms/pluginsViewDialog.ui
${SCHNApps_ROOT_DIR}/forms/mapsViewDialog.ui
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CameraDialog</class>
<widget class="QDialog" name="CameraDialog">
<class>CamerasDialog</class>
<widget class="QDialog" name="CamerasDialog">
<property name="geometry">
<rect>
<x>0</x>
......@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>CameraDialog</string>
<string>CamerasDialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
......@@ -26,7 +26,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="removeCameraButton">
<widget class="QPushButton" name="removeCamerasButton">
<property name="text">
<string>Remove</string>
</property>
......@@ -35,7 +35,11 @@
</layout>
</item>
<item>
<widget class="QListWidget" name="cameraList"/>
<widget class="QListWidget" name="cameraList">
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
</widget>
</item>
</layout>
</item>
......@@ -53,7 +57,7 @@
<connection>
<sender>OKButton</sender>
<signal>clicked()</signal>
<receiver>CameraDialog</receiver>
<receiver>CamerasDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PluginDialog</class>
<widget class="QDialog" name="PluginDialog">
<class>PluginsDialog</class>
<widget class="QDialog" name="PluginsDialog">
<property name="geometry">
<rect>
<x>0</x>
......@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>PluginDialog</string>
<string>PluginsDialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
......@@ -97,7 +97,7 @@
<connection>
<sender>OKButton</sender>
<signal>pressed()</signal>
<receiver>PluginDialog</receiver>
<receiver>PluginsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
......@@ -111,9 +111,9 @@
</hints>
</connection>
<connection>
<sender>PluginDialog</sender>
<sender>PluginsDialog</sender>
<signal>rejected()</signal>
<receiver>PluginDialog</receiver>
<receiver>PluginsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>785</width>
<height>593</height>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
......@@ -23,8 +23,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>785</width>
<height>22</height>
<width>800</width>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
......@@ -78,7 +78,7 @@
<action name="actionManagePlugins">
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/icons/action_plugins.png</normaloff>:/icons/icons/action_plugins.png</iconset>
<normaloff>:/icons/icons/plugins.png</normaloff>:/icons/icons/plugins.png</iconset>
</property>
<property name="text">
<string>Manage plugins</string>
......@@ -87,7 +87,7 @@
<action name="actionManageCameras">
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/icons/action_cameras.png</normaloff>:/icons/icons/action_cameras.png</iconset>
<normaloff>:/icons/icons/cameras.png</normaloff>:/icons/icons/cameras.png</iconset>
</property>
<property name="text">
<string>Manage cameras</string>
......@@ -101,7 +101,7 @@
<action name="actionManageMaps">
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/icons/icons/action_maps.png</normaloff>:/icons/icons/action_maps.png</iconset>
<normaloff>:/icons/icons/maps.png</normaloff>:/icons/icons/maps.png</iconset>
</property>
<property name="text">
<string>ManageMaps</string>
......
......@@ -20,7 +20,7 @@ public:
Window* getWindow() const { return m_window; }
void setWindow(Window* w) { m_window = w; }
bool isUsed() const { return l_views.size() > 0; }
bool isUsed() const { return !l_views.empty(); }
bool isShared() const { return l_views.size() > 1; }
/*********************************************************
......
#ifndef _CAMERADIALOG_H_
#define _CAMERADIALOG_H_
#ifndef _CAMERASDIALOG_H_
#define _CAMERASDIALOG_H_
#include "ui_cameraDialog.h"
#include "ui_camerasDialog.h"
class Window;
class Camera;
class CameraDialog : public QDialog, Ui::CameraDialog
class CamerasDialog : public QDialog, Ui::CamerasDialog
{
Q_OBJECT
public:
CameraDialog(Window* window);
~CameraDialog();
CamerasDialog(Window* window);
~CamerasDialog();
private:
Window* m_window;
public slots:
void cb_addCamera();
void cb_removeCamera();
void cb_removeCameras();
void cb_addCameraToList(Camera* c);
void cb_removeCameraFromList(Camera* c);
};
......
......@@ -6,6 +6,7 @@
#include "types.h"
#include "view.h"
#include "Topology/generic/genericmap.h"
#include "Topology/generic/functor.h"
#include "Utils/vbo.h"
#include "Algo/Render/GL2/mapRender.h"
......@@ -13,7 +14,7 @@
class MapHandlerGen
{
public:
MapHandlerGen(const QString& name, Window* window);
MapHandlerGen(const QString& name, Window* window, CGoGN::GenericMap* map);
virtual ~MapHandlerGen();
const QString& getName() const { return m_name; }
......@@ -22,6 +23,8 @@ public:
Window* getWindow() const { return m_window; }
void setWindow(Window* w) { m_window = w; }
CGoGN::GenericMap* getGenericMap() { return m_map; }
const qglviewer::Vec& getBBmin() const { return m_bbMin; }
void setBBmin(qglviewer::Vec& v) { m_bbMin = v; }
......@@ -30,6 +33,8 @@ public:
float getBBdiagSize() { return (m_bbMax - m_bbMin).norm(); }
bool isUsed() const { return !l_views.empty(); }
void draw(CGoGN::Utils::GLSLShader* shader, int primitive);
/*********************************************************
......@@ -43,7 +48,7 @@ public:
* MANAGE LINKED VIEWS
*********************************************************/
bool linkView(View* view);
void linkView(View* view);
void unlinkView(View* view);
const QList<View*>& getLinkedViews() const { return l_views; }
bool isLinkedToView(View* view) const { return l_views.contains(view); }
......@@ -51,6 +56,7 @@ public:
protected:
QString m_name;
Window* m_window;
CGoGN::GenericMap* m_map;
CGoGN::Algo::Render::GL2::MapRender* m_render;
......@@ -67,8 +73,7 @@ class MapHandler : public MapHandlerGen
{
public:
MapHandler(const QString& name, Window* window, typename PFP::MAP* map) :
MapHandlerGen(name, window),
m_map(map)
MapHandlerGen(name, window, map)
{}
~MapHandler()
......@@ -77,15 +82,12 @@ public:
delete m_map;
}
typename PFP::MAP* getMap() { return m_map; }
typename PFP::MAP* getMap() { return reinterpret_cast<typename PFP::MAP*>(m_map); }
void updatePrimitives(int primitive, const CGoGN::FunctorSelect& good)
{
m_render->initPrimitives<PFP>(*m_map, good, primitive) ;
m_render->initPrimitives<PFP>(*(reinterpret_cast<typename PFP::MAP*>(m_map)), good, primitive) ;
}
protected:
typename PFP::MAP* m_map;
};
#endif
......@@ -28,6 +28,8 @@ public:
Window* getWindow() { return m_window; }
void setWindow(Window* w) { m_window = w; }
bool isUsed() const { return !l_views.empty(); }
bool getProvidesRendering() { return b_providesRendering; }
void setProvidesRendering(bool b) { b_providesRendering = b; }
......
#ifndef _PLUGINDIALOG_H_
#define _PLUGINDIALOG_H_
#ifndef _PLUGINSDIALOG_H_
#define _PLUGINSDIALOG_H_
#include "ui_pluginDialog.h"
#include "ui_pluginsDialog.h"
#include "types.h"
......@@ -18,13 +18,13 @@ struct PluginInfo
QString pluginName;
};
class PluginDialog : public QDialog, public Ui::PluginDialog
class PluginsDialog : public QDialog, public Ui::PluginsDialog
{
Q_OBJECT
public:
PluginDialog(Window* window);
~PluginDialog();
PluginsDialog(Window* window);
~PluginsDialog();
protected:
Window* m_window;
......
#ifndef _SPLITAREA_H_
#define _SPLITAREA_H_
#include <QSplitter>
class SplitArea : public QSplitter
{
Q_OBJECT
public:
SplitArea(QWidget* parent = NULL);
int getNbRows() { return nbRows; }
void addFitElement(QWidget* element);
void addElementAt(QWidget* element, int x, int y);
void addElementRightTo(QWidget* element, QWidget* left);
bool isEmpty();
void updateSize();
protected:
int nbRows;
int maxNbColumns;
int rowMin;
int nbElements;
protected slots:
void elementRemoved();
private:
bool sizeUpdated;
void determineRowMin();
};
#endif
......@@ -22,7 +22,7 @@ class View : public QGLViewer
public:
static unsigned int viewCount;
View(const QString& name, Window* w, QWidget* parent, const QGLWidget* shareWidget = NULL);
View(const QString& name, Window* w, const QGLWidget* shareWidget = NULL);
~View();
const QString& getName() const { return m_name; }
......@@ -104,6 +104,8 @@ protected:
ViewButton* m_pluginsButton;
ViewButton* m_mapsButton;
ViewButton* m_closeButton;
ViewButton* m_VsplitButton;
ViewButton* m_HsplitButton;
QString m_textInfo;
......@@ -116,6 +118,8 @@ public slots:
void cb_pluginsView(int x, int y, int globalX, int globalY);
void cb_mapsView(int x, int y, int globalX, int globalY);
void cb_closeView(int x, int y, int globalX, int globalY);
void cb_VsplitView(int x, int y, int globalX, int globalY);
void cb_HsplitView(int x, int y, int globalX, int globalY);
};
#endif
......@@ -25,6 +25,9 @@ public:
void click(int x, int y, int globalX, int globalY);
void drawAt(int x, int y);
static const int SIZE = 24;
static const int SPACE = 4;
protected:
QString m_img;
View* m_view;
......@@ -39,7 +42,9 @@ class ViewButtonArea : public QObject
Q_OBJECT
public:
ViewButtonArea(View* view) : m_view(view)
ViewButtonArea(View* view) :
m_view(view),
m_form(0,0,0,0)
{}
~ViewButtonArea()
{}
......
#ifndef _VIEWSELECTOR_H_
#define _VIEWSELECTOR_H_
#include "view.h"
#include <QDialog>
#include <QRect>
class SplitArea;
class PixElem
{
public:
PixElem() :
view(NULL),
color(Qt::gray)
{}
PixElem(View* view) :
view(view),
color(Qt::gray)
{}
PixElem(const PixElem& pixElem) :
view(pixElem.view),
color(pixElem.color),
rect(pixElem.rect)
{}
bool operator== (const PixElem& other) const
{
return view == other.view;
}
PixElem& operator= (const PixElem & other)
{
view = other.view;
rect = other.rect;
color = other.color;
return *this;
}
View* view;
QColor color;
QRect rect;
};
class ViewPixMaps : public QList<QList<PixElem> >
{
public:
typedef ViewPixMaps::iterator y_iterator;
typedef QList<PixElem>::iterator x_iterator;
ViewPixMaps();
~ViewPixMaps()
{}
void fromSplitArea(SplitArea* splitArea);
int getMaxX() { return maxX; }
int getMinX() { return minX; }
int getY() { return Y; }
int getYMinX() { return YminX; }
PixElem& getAt(int x, int y) { return (*this)[y][x]; }
y_iterator y_begin(){return this->begin();}
y_iterator y_end(){return this->end();}
x_iterator x_begin(y_iterator y_it){return y_it->begin();}
x_iterator x_end(y_iterator y_it){return y_it->end();}
void beginMove(int x, int y);
void moveTmp(int x, int y);
void confirmMove();
void cancelMove();
void insertion(int x, int y);
bool isModified(){return this->modif;}
private:
int maxX;
int minX;
int Y;
int YminX;
int originX, originY;
PixElem origin;
int tmpX, tmpY;
PixElem tmp;
bool modif;
protected:
void computeSize();
};
class ViewSelector : public QDialog
{
Q_OBJECT
public:
enum SelectorDialogType
{
MOVE,
SELECT
};
ViewSelector(QWidget* parent = NULL, SelectorDialogType type = MOVE);
ViewSelector(ViewPixMaps viewPixMap, QWidget* parent = NULL, SelectorDialogType type = MOVE);
~ViewSelector();
void setGLVMap(const ViewPixMaps& viewPixMap);
ViewPixMaps getGLVMap() { return viewPixMap; }
QPoint getInsertPoint();
void setInsertionName(QString insertionName) { this->insertionName = insertionName; }
bool keys[3];
protected:
ViewPixMaps viewPixMap;
int mouseX;
int mouseY;
bool pixmapGrabbed;
QRect grabbed;
SelectorDialogType type;
QPoint insertPoint;
QString insertionName;
protected:
void paintEvent(QPaintEvent *event);
void mouseMoveEvent ( QMouseEvent * event );
void mousePressEvent ( QMouseEvent * event );
void mouseReleaseEvent( QMouseEvent * event );
void keyPressEvent( QKeyEvent * event );
void keyReleaseEvent( QKeyEvent * event );
private:
QPoint mouseToIndice();
};
#endif
......@@ -4,11 +4,14 @@
#include "ui_window.h"
#include "system.h"
#include <QVBoxLayout>
class SplitArea;
class PluginDialog;
class CameraDialog;
class QVBoxLayout;
class QSplitter;
class CamerasDialog;
class PluginsDialog;
class MapsDialog;
class Texture;
class Window : public QMainWindow, Ui::Window
......@@ -159,17 +162,7 @@ public:
View* getCurrentView() const { return m_currentView; }
void setCurrentView(View* view);
/**
* \fn void moveView()
* \brief shows a reordering dialog for the Views
*
* Make a call with the right parameters to the dialog class
* GLVSelector and show this dialog.
*
* This method is meant to be called when the user press
* CTRL+Shift+M.
*/
void moveView();
void splitView(const QString& name, Qt::Orientation orientation);
/*********************************************************
* MANAGE PLUGINS
......@@ -272,8 +265,9 @@ protected:
bool m_initialization;
QVBoxLayout* m_verticalLayout;
SplitArea* m_splitArea;
QVBoxLayout* m_centralLayout;
QSplitter* m_rootSplitter;
bool b_rootSplitterInitialized;
View* m_firstView;
View* m_currentView;
......@@ -288,16 +282,9 @@ protected:
TextureHash h_textures;
PluginDialog* m_pluginDialog;
CameraDialog* m_cameraDialog;
/**
* \var bool keys[3]
* \brief a static tab to store state of some keys (here: M, Shift and CTRL)
*/
bool keys[3];
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
CamerasDialog* m_camerasDialog;
PluginsDialog* m_pluginsDialog;
MapsDialog* m_mapsDialog;
public slots:
/**
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="1052.3622"
height="744.09448"
id="svg3010"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="camera_b.svg"
inkscape:export-filename="/datas/Documents/SOCIS2012/SOCIS2012/Visualizator/resources/icons/camera_b.png"
inkscape:export-xdpi="9.3779135"
inkscape:export-ydpi="9.3779135">
<defs
id="defs3">
<filter
inkscape:collect="always"
id="filter3833">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="1.3465664"
id="feGaussianBlur3835" />
</filter>
<filter
inkscape:collect="always"
id="filter3850">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="2.0152065"
id="feGaussianBlur3852" />
</filter>
<filter
inkscape:collect="always"
id="filter3856">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="1.2386822"