Commit 7a944a44 authored by Thery Sylvain's avatar Thery Sylvain

Merge cgogn:~cgogn/CGoGN

parents 29b2672a 11eb6cfd
......@@ -42,3 +42,7 @@ TARGET_LINK_LIBRARIES( SCHNAppsD
ADD_SUBDIRECTORY(${SCHNApps_ROOT_DIR}/Plugins PluginsD)
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 @@
<rect>
<x>0</x>
<y>0</y>
<width>345</width>
<width>385</width>
<height>600</height>
</rect>
</property>
......@@ -21,33 +21,158 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="combo_positionAttribute">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="8" column="0" colspan="3">
<widget class="QComboBox" name="combo_edgeOperation">
<item>
<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>
</item>
</widget>
</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">
<property name="text">
<string>Vertex selector :</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="combo_vertexSelector">
<item row="7" column="3">
<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>
<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>
</item>
</widget>
......@@ -59,8 +184,8 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QComboBox" name="combo_edgeSelector">
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="combo_vertexSelector">
<item>
<property name="text">
<string>- select selector -</string>
......@@ -68,15 +193,8 @@
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Face selector :</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QComboBox" name="combo_faceSelector">
<item row="2" column="1" colspan="3">
<widget class="QComboBox" name="combo_edgeSelector">
<item>
<property name="text">
<string>- select selector -</string>
......@@ -84,6 +202,26 @@
</item>
</widget>
</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">
<widget class="Line" name="line">
<property name="orientation">
......@@ -91,39 +229,101 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="4">
<widget class="QPushButton" name="button_createEmptyMap">
<item row="9" column="3">
<widget class="QPushButton" name="button_applyFaceOperation">
<property name="text">
<string>Create empty map</string>
<string>Apply face operation</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="4">
<widget class="QPushButton" name="button_addCube">
<item row="12" column="1" colspan="2">
<widget class="QPushButton" name="button_accept">
<property name="text">
<string>Add cube</string>
<string>Accept</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="4">
<widget class="QPushButton" name="button_flipEdge">
<item row="6" column="3">
<widget class="QPushButton" name="button_applyGeneralOperation">
<property name="text">
<string>Flip edge</string>
<string>Apply general operation</string>
</property>
</widget>
</item>
<item row="8" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="combo_positionAttribute">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
<item>
<property name="text">
<string>- select attribute -</string>
</property>
</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>
</spacer>
</widget>
</item>
</layout>
</widget>
......
......@@ -5,6 +5,11 @@
#include "surface_modelisation_dockTab.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
{
......@@ -43,12 +48,12 @@ public:
virtual bool enable();
virtual void disable();
virtual void draw(View *view) {}
virtual void drawMap(View* view, MapHandlerGen* map) {}
virtual void draw(View *view);
virtual void drawMap(View* view, MapHandlerGen* map);
virtual void keyPress(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 mouseMove(View* view, QMouseEvent* event) {}
virtual void wheelEvent(View* view, QWheelEvent* event) {}
......@@ -76,12 +81,40 @@ public slots:
protected:
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 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:
Surface_Modelisation_DockTab* m_dockTab;
QHash<MapHandlerGen*, MapParameters> h_parameterSet;
Utils::Drawer* m_drawer;
bool collect;
std::vector<PFP2::VEC3> collectedVertices;
};
} // namespace SCHNApps
......
......@@ -2,6 +2,11 @@
#define _SURFACE_MODELISATION_DOCK_TAB_H_
#include "ui_surface_modelisation.h"
#include "QString"
//#include "mapHandler.h"
//#include "Utils/drawer.h"
//#include "Topology/map/map2.h"
namespace CGoGN
{
......@@ -27,15 +32,27 @@ private:
Surface_Modelisation_Plugin* m_plugin;
bool b_updatingUI;
QStringList generalOperations;
QStringList vertexOperations;
QStringList edgeOperations;
QStringList faceOperations;
private slots:
void positionAttributeChanged(int index);
void vertexSelectorChanged(int index);
void edgeSelectorChanged(int index);
void faceSelectorChanged(int index);
void createEmptyMapButtonClicked();
void addCubeButtonClicked();
void flipEdgeButtonClicked();
//void operationChanged(const QString &text);
void applyGeneralOperationButtonClicked();
void applyVertexOperationButtonClicked();
void applyEdgeOperationButtonClicked();
void applyFaceOperationButtonClicked();
void startButtonClicked();
void acceptButtonClicked();
void cancelButtonClicked();
private:
void addVertexAttribute(const QString& name);
......
......@@ -16,19 +16,27 @@ Surface_Modelisation_DockTab::Surface_Modelisation_DockTab(SCHNApps* s, Surface_
{
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_vertexSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(vertexSelectorChanged(int)));
connect(combo_edgeSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(edgeSelectorChanged(int)));
connect(combo_faceSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(faceSelectorChanged(int)));
connect(button_createEmptyMap, SIGNAL(clicked()), this, SLOT(createEmptyMapButtonClicked()));
connect(button_addCube, SIGNAL(clicked()), this, SLOT(addCubeButtonClicked()));
connect(button_flipEdge, SIGNAL(clicked()), this, SLOT(flipEdgeButtonClicked()));
//connect(combo_operation, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(operationChanged(const QString&)));
connect(button_applyGeneralOperation, SIGNAL(clicked()), this, SLOT(applyGeneralOperationButtonClicked()));
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(clicked()), this, SLOT(cancelButtonClicked()));
}
/* -------------------------- Position and selectors -----------------------------------*/
void Surface_Modelisation_DockTab::positionAttributeChanged(int index)
{
if(!b_updatingUI)
......@@ -69,38 +77,6 @@ void Surface_Modelisation_DockTab::faceSelectorChanged(int index)
}
}
void Surface_Modelisation_DockTab::createEmptyMapButtonClicked()
{
if(!b_updatingUI)
{
m_plugin->createEmptyMap();
}
}
void Surface_Modelisation_DockTab::addCubeButtonClicked()
{
if(!b_updatingUI)
{
MapHandlerGen* map = m_schnapps->getSelectedMap();
if(map)
m_plugin->addCube(map);
}
}
void Surface_Modelisation_DockTab::flipEdgeButtonClicked()
{
if(!b_updatingUI)
{
MapHandlerGen* map = m_schnapps->getSelectedMap();
if(map)
m_plugin->flipEdge(map);
}
}
void Surface_Modelisation_DockTab::addVertexAttribute(const QString& nameAttr)
{
b_updatingUI = true;
......@@ -108,7 +84,7 @@ void Surface_Modelisation_DockTab::addVertexAttribute(const QString& nameAttr)
const QString& typeAttr = m_schnapps->getSelectedMap()->getAttributeTypeName(VERTEX, nameAttr);
if(typeAttr == vec3TypeName)
combo_positionAttribute->addItem(nameAttr);
b_updatingUI = false;
b_updatingUI = false;
}
void Surface_Modelisation_DockTab::addVertexSelector(const QString& name)
......@@ -165,6 +141,172 @@ void Surface_Modelisation_DockTab::removeFaceSelector(const QString& name)
b_updatingUI = false;
}
/* -------------------------------- Operations -----------------------------------------*/
void Surface_Modelisation_DockTab::applyGeneralOperationButtonClicked()
{
if(!b_updatingUI)
{
if (generalOperations.indexOf(combo_generalOperation->currentText()) == 0) // Create empty map
m_plugin->createEmptyMap();
else
{
MapHandlerGen* map = m_schnapps->getSelectedMap();
if(map)
{
switch ( generalOperations.indexOf(combo_generalOperation->currentText()) )
{
case 1: // Create new face
m_plugin->createNewFace(map);
break;
case 2: // Add cube
m_plugin->addCube(map);
break;
case 3: // Fill hole
m_plugin->fillHole(map);
break;
case 4: // Delete connected component
m_plugin->deleteCC(map);
break;
case 5: // Revolution
m_plugin->revolution(map);
break;
case 6: // Merge volumes
m_plugin->mergeVolumes(map);
break;
case 7: // Split surface
m_plugin->splitSurface(map);
break;
case 8 : // Extrude region
m_plugin->extrudeRegion(map);
break;
}
}
}
}
}