Commit a517c887 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

update modelisation plugin & voxellisation file

parent 038b8c37
...@@ -42,4 +42,7 @@ TARGET_LINK_LIBRARIES( SCHNAppsD ...@@ -42,4 +42,7 @@ TARGET_LINK_LIBRARIES( SCHNAppsD
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins PluginsD) ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins PluginsD)
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../SCHNAppsPlugins ExtPluginsD)
IF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/../../Plugins ExtPluginsD)
ENDIF(IS_DIRECTORY ${SCHNApps_ROOT_DIR}/../../Plugins)
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>345</width> <width>385</width>
<height>600</height> <height>600</height>
</rect> </rect>
</property> </property>
...@@ -21,33 +21,158 @@ ...@@ -21,33 +21,158 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" colspan="3"> <item row="8" column="0" colspan="3">
<widget class="QComboBox" name="combo_positionAttribute"> <widget class="QComboBox" name="combo_edgeOperation">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>- select attribute -</string> <string>- select operation -</string>
</property>
</item>
<item>
<property name="text">
<string>Cut edge</string>
</property>
</item>
<item>
<property name="text">
<string>Uncut edge</string>
</property>
</item>
<item>
<property name="text">
<string>Collapse edge</string>
</property>
</item>
<item>
<property name="text">
<string>Flip edge</string>
</property>
</item>
<item>
<property name="text">
<string>Flip back edge</string>
</property>
</item>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QComboBox" name="combo_generalOperation">
<item>
<property name="text">
<string>- select operation -</string>
</property>
</item>
<item>
<property name="text">
<string>Create empty map</string>
</property>
</item>
<item>
<property name="text">
<string>Create new face</string>
</property>
</item>
<item>
<property name="text">
<string>Add cube</string>
</property>
</item>
<item>
<property name="text">
<string>Fill hole</string>
</property>
</item>
<item>
<property name="text">
<string>Delete connected component</string>
</property>
</item>
<item>
<property name="text">
<string>Revolution</string>
</property>
</item>
<item>
<property name="text">
<string>Merge volumes</string>
</property>
</item>
<item>
<property name="text">
<string>Split surface</string>
</property>
</item>
<item>
<property name="text">
<string>Extrude region</string>
</property> </property>
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Operations :</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Vertex selector :</string> <string>Vertex selector :</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="3"> <item row="7" column="3">
<widget class="QComboBox" name="combo_vertexSelector"> <widget class="QPushButton" name="button_applyVertexOperation">
<property name="text">
<string>Apply vertex operation</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="4">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="12" column="3">
<widget class="QPushButton" name="button_cancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="8" column="3">
<widget class="QPushButton" name="button_applyEdgeOperation">
<property name="text">
<string>Apply edge operation</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QPushButton" name="button_start">
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<widget class="QComboBox" name="combo_vertexOperation">
<item> <item>
<property name="text"> <property name="text">
<string>- select selector -</string> <string>- select operation -</string>
</property>
</item>
<item>
<property name="text">
<string>Split vertex</string>
</property>
</item>
<item>
<property name="text">
<string>Delete vertex</string>
</property> </property>
</item> </item>
</widget> </widget>
...@@ -59,8 +184,8 @@ ...@@ -59,8 +184,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" colspan="3"> <item row="1" column="1" colspan="3">
<widget class="QComboBox" name="combo_edgeSelector"> <widget class="QComboBox" name="combo_vertexSelector">
<item> <item>
<property name="text"> <property name="text">
<string>- select selector -</string> <string>- select selector -</string>
...@@ -68,15 +193,8 @@ ...@@ -68,15 +193,8 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="2" column="1" colspan="3">
<widget class="QLabel" name="label_4"> <widget class="QComboBox" name="combo_edgeSelector">
<property name="text">
<string>Face selector :</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QComboBox" name="combo_faceSelector">
<item> <item>
<property name="text"> <property name="text">
<string>- select selector -</string> <string>- select selector -</string>
...@@ -84,6 +202,26 @@ ...@@ -84,6 +202,26 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="13" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Clicks :</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="4"> <item row="4" column="0" colspan="4">
<widget class="Line" name="line"> <widget class="Line" name="line">
<property name="orientation"> <property name="orientation">
...@@ -91,39 +229,101 @@ ...@@ -91,39 +229,101 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="4"> <item row="9" column="3">
<widget class="QPushButton" name="button_createEmptyMap"> <widget class="QPushButton" name="button_applyFaceOperation">
<property name="text"> <property name="text">
<string>Create empty map</string> <string>Apply face operation</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0" colspan="4"> <item row="12" column="1" colspan="2">
<widget class="QPushButton" name="button_addCube"> <widget class="QPushButton" name="button_accept">
<property name="text"> <property name="text">
<string>Add cube</string> <string>Accept</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="4"> <item row="6" column="3">
<widget class="QPushButton" name="button_flipEdge"> <widget class="QPushButton" name="button_applyGeneralOperation">
<property name="text"> <property name="text">
<string>Flip edge</string> <string>Apply general operation</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="2"> <item row="0" column="1" colspan="3">
<spacer name="verticalSpacer"> <widget class="QComboBox" name="combo_positionAttribute">
<property name="orientation"> <property name="sizePolicy">
<enum>Qt::Vertical</enum> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="sizeHint" stdset="0"> <item>
<size> <property name="text">
<width>20</width> <string>- select attribute -</string>
<height>40</height> </property>
</size> </item>
</widget>
</item>
<item row="9" column="0" colspan="3">
<widget class="QComboBox" name="combo_faceOperation">
<item>
<property name="text">
<string>- select operation -</string>
</property>
</item>
<item>
<property name="text">
<string>Split face</string>
</property>
</item>
<item>
<property name="text">
<string>Merge faces</string>
</property>
</item>
<item>
<property name="text">
<string>Delete face</string>
</property>
</item>
<item>
<property name="text">
<string>Sew faces</string>
</property>
</item>
<item>
<property name="text">
<string>Unsew faces</string>
</property>
</item>
<item>
<property name="text">
<string>Extrude face</string>
</property>
</item>
<item>
<property name="text">
<string>Extrude face following a path</string>
</property>
</item>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QComboBox" name="combo_faceSelector">
<item>
<property name="text">
<string>- select selector -</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Face selector :</string>
</property> </property>
</spacer> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
......
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
#include "surface_modelisation_dockTab.h" #include "surface_modelisation_dockTab.h"
#include "mapHandler.h" #include "mapHandler.h"
#include "Utils/drawer.h"
#include "Topology/map/map2.h"
#include <QVector>
#include "QGLViewer/camera.h"
#include "QGLViewer/vec.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -43,12 +48,12 @@ public: ...@@ -43,12 +48,12 @@ public:
virtual bool enable(); virtual bool enable();
virtual void disable(); virtual void disable();
virtual void draw(View *view) {} virtual void draw(View *view);
virtual void drawMap(View* view, MapHandlerGen* map) {} virtual void drawMap(View* view, MapHandlerGen* map);
virtual void keyPress(View* view, QKeyEvent* event) {} virtual void keyPress(View* view, QKeyEvent* event) {}
virtual void keyRelease(View* view, QKeyEvent* event) {} virtual void keyRelease(View* view, QKeyEvent* event) {}
virtual void mousePress(View* view, QMouseEvent* event) {} virtual void mousePress(View* view, QMouseEvent* event);
virtual void mouseRelease(View* view, QMouseEvent* event) {} virtual void mouseRelease(View* view, QMouseEvent* event) {}
virtual void mouseMove(View* view, QMouseEvent* event) {} virtual void mouseMove(View* view, QMouseEvent* event) {}
virtual void wheelEvent(View* view, QWheelEvent* event) {} virtual void wheelEvent(View* view, QWheelEvent* event) {}
...@@ -76,12 +81,40 @@ public slots: ...@@ -76,12 +81,40 @@ public slots:
protected: protected:
void createEmptyMap(); void createEmptyMap();
void addCube(MapHandlerGen* mhg); void createNewFace(MapHandlerGen* mhg);
void addCube(MapHandlerGen* mhg);
void fillHole(MapHandlerGen* mhg);
void deleteCC(MapHandlerGen* mhg);
void revolution(MapHandlerGen* mhg);
void mergeVolumes(MapHandlerGen* mhg);
void splitSurface(MapHandlerGen* mhg);
void extrudeRegion(MapHandlerGen* mhg);
void splitVertex(MapHandlerGen* mhg);
void deleteVertex(MapHandlerGen* mhg);
void cutEdge(MapHandlerGen* mhg);
void uncutEdge(MapHandlerGen* mhg);
void flipEdge(MapHandlerGen* mhg); void flipEdge(MapHandlerGen* mhg);
void flipBackEdge(MapHandlerGen* mhg);
void collapseEdge(MapHandlerGen* mhg);
void splitFace(MapHandlerGen* mhg);
void mergeFaces(MapHandlerGen* mhg);
void deleteFace(MapHandlerGen* mhg);
void sewFaces(MapHandlerGen* mhg);
void unsewFaces(MapHandlerGen* mhg);
void extrudeFace(MapHandlerGen* mhg);
void pathExtrudeFace(MapHandlerGen *mhg);
protected: protected:
Surface_Modelisation_DockTab* m_dockTab; Surface_Modelisation_DockTab* m_dockTab;
QHash<MapHandlerGen*, MapParameters> h_parameterSet; QHash<MapHandlerGen*, MapParameters> h_parameterSet;
Utils::Drawer* m_drawer;
bool collect;
std::vector<PFP2::VEC3> collectedVertices;
}; };
} // namespace SCHNApps } // namespace SCHNApps
......
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
#define _SURFACE_MODELISATION_DOCK_TAB_H_ #define _SURFACE_MODELISATION_DOCK_TAB_H_
#include "ui_surface_modelisation.h" #include "ui_surface_modelisation.h"
#include "QString"
//#include "mapHandler.h"
//#include "Utils/drawer.h"
//#include "Topology/map/map2.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -27,15 +32,27 @@ private: ...@@ -27,15 +32,27 @@ private:
Surface_Modelisation_Plugin* m_plugin; Surface_Modelisation_Plugin* m_plugin;
bool b_updatingUI; bool b_updatingUI;
QStringList generalOperations;
QStringList vertexOperations;
QStringList edgeOperations;
QStringList faceOperations;
private slots: private slots:
void positionAttributeChanged(int index); void positionAttributeChanged(int index);
void vertexSelectorChanged(int index); void vertexSelectorChanged(int index);
void edgeSelectorChanged(int index); void edgeSelectorChanged(int index);
void faceSelectorChanged(int index); void faceSelectorChanged(int index);
void createEmptyMapButtonClicked(); //void operationChanged(const QString &text);
void addCubeButtonClicked();
void flipEdgeButtonClicked(); void applyGeneralOperationButtonClicked();
void applyVertexOperationButtonClicked();
void applyEdgeOperationButtonClicked();
void applyFaceOperationButtonClicked();
void startButtonClicked();
void acceptButtonClicked();
void cancelButtonClicked();
private: private:
void addVertexAttribute(const QString& name); void addVertexAttribute(const QString& name);
......
...@@ -16,19 +16,27 @@ Surface_Modelisation_DockTab::Surface_Modelisation_DockTab(SCHNApps* s, Surface_ ...@@ -16,19 +16,27 @@ Surface_Modelisation_DockTab::Surface_Modelisation_DockTab(SCHNApps* s, Surface_
{ {
setupUi(this); setupUi(this);
generalOperations << "Create empty map" << "Create new face" << "Add cube" << "Fill hole" << "Delete connected component"
<< "Revolution" << "Merge volumes" << "Split surface" << "Extrude region";
vertexOperations << "Split vertex" << "Delete vertex";
edgeOperations << "Cut edge" << "Uncut edge" << "Collapse edge" << "Flip edge" << "Flip back edge";
faceOperations << "Split face" << "Merge faces" << "Delete face" << "Sew faces" << "Unsew faces" << "Extrude face" << "Extrude face following a path";
connect(combo_positionAttribute, SIGNAL(currentIndexChanged(int)), this, SLOT(positionAttributeChanged(int))); connect(combo_positionAttribute, SIGNAL(currentIndexChanged(int)), this, SLOT(positionAttributeChanged(int)));
connect(combo_vertexSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(vertexSelectorChanged(int))); connect(combo_vertexSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(vertexSelectorChanged(int)));
connect(combo_edgeSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(edgeSelectorChanged(int))); connect(combo_edgeSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(edgeSelectorChanged(int)));
connect(combo_faceSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(faceSelectorChanged(int))); connect(combo_faceSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(faceSelectorChanged(int)));
connect(button_createEmptyMap, SIGNAL(clicked()), this, SLOT(createEmptyMapButtonClicked())); //connect(combo_operation, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(operationChanged(const QString&)));
connect(button_addCube, SIGNAL(clicked()), this, SLOT(addCubeButtonClicked())); connect(button_applyGeneralOperation, SIGNAL(clicked()), this, SLOT(applyGeneralOperationButtonClicked()));
connect(button_flipEdge, SIGNAL(clicked()), this, SLOT(flipEdgeButtonClicked())); connect(button_applyVertexOperation, SIGNAL(clicked()), this, SLOT(applyVertexOperationButtonClicked()));
connect(button_applyEdgeOperation, SIGNAL(clicked()), this, SLOT(applyEdgeOperationButtonClicked()));
connect(button_applyFaceOperation, SIGNAL(clicked()), this, SLOT(applyFaceOperationButtonClicked()));
connect(button_start, SIGNAL(clicked()), this, SLOT(startButtonClicked()));
connect(button_accept, SIGNAL(clicked()), this, SLOT(acceptButtonClicked()));
connect(button_cancel, SIGNAL