Commit b8c1a242 authored by Pierre Kraemer's avatar Pierre Kraemer

update initAllOrbitsEmbedding to work on non-embedded orbit

parent 7825825d
...@@ -14,43 +14,48 @@ ...@@ -14,43 +14,48 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="13" column="1" colspan="2">
<widget class="QLabel" name="label_2"> <widget class="QPushButton" name="button_accept">
<property name="text"> <property name="text">
<string>Position :</string> <string>Accept</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0" colspan="3"> <item row="5" column="0">
<widget class="QComboBox" name="combo_edgeOperation"> <widget class="QLabel" name="label_5">
<item> <property name="text">
<property name="text"> <string>Operations :</string>
<string>- select operation -</string> </property>
</property> </widget>
</item> </item>
<item> <item row="1" column="1" colspan="3">
<property name="text"> <widget class="QComboBox" name="combo_vertexSelector">
<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> <item>
<property name="text"> <property name="text">
<string>Flip edge</string> <string>- select selector -</string>
</property> </property>
</item> </item>
</widget>
</item>
<item row="7" column="3">
<widget class="QPushButton" name="button_applyVertexOperation">
<property name="text">
<string>Apply vertex operation</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="4">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QComboBox" name="combo_edgeSelector">
<item> <item>
<property name="text"> <property name="text">
<string>Flip back edge</string> <string>- select selector -</string>
</property> </property>
</item> </item>
</widget> </widget>
...@@ -77,21 +82,6 @@ ...@@ -77,21 +82,6 @@
<string>Add cube</string> <string>Add cube</string>
</property> </property>
</item> </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> <item>
<property name="text"> <property name="text">
<string>Merge volumes</string> <string>Merge volumes</string>
...@@ -109,13 +99,6 @@ ...@@ -109,13 +99,6 @@
</item> </item>
</widget> </widget>
</item> </item>
<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"> <item row="1" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
...@@ -123,43 +106,51 @@ ...@@ -123,43 +106,51 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="3"> <item row="0" column="0">
<widget class="QPushButton" name="button_applyVertexOperation"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Apply vertex operation</string> <string>Position :</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0" colspan="4"> <item row="3" column="0">
<widget class="Line" name="line_2"> <widget class="QLabel" name="label_4">
<property name="orientation"> <property name="text">
<enum>Qt::Horizontal</enum> <string>Face selector :</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="3"> <item row="4" column="0" colspan="4">
<widget class="QPushButton" name="button_cancel"> <widget class="Line" name="line">
<property name="text"> <property name="orientation">
<string>Cancel</string> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="3"> <item row="0" column="1" colspan="3">
<widget class="QPushButton" name="button_applyEdgeOperation"> <widget class="QComboBox" name="combo_positionAttribute">
<property name="text"> <property name="sizePolicy">
<string>Apply edge operation</string> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<item>
<property name="text">
<string>- select attribute -</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="12" column="0"> <item row="12" column="0">
<widget class="QPushButton" name="button_start"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Start</string> <string>Clicks :</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="3"> <item row="8" column="0" colspan="3">
<widget class="QComboBox" name="combo_vertexOperation"> <widget class="QComboBox" name="combo_edgeOperation">
<item> <item>
<property name="text"> <property name="text">
<string>- select operation -</string> <string>- select operation -</string>
...@@ -167,66 +158,55 @@ ...@@ -167,66 +158,55 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Split vertex</string> <string>Cut edge</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Delete vertex</string> <string>Uncut edge</string>
</property> </property>
</item> </item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Edge selector :</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="combo_vertexSelector">
<item> <item>
<property name="text"> <property name="text">
<string>- select selector -</string> <string>Collapse edge</string>
</property> </property>
</item> </item>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QComboBox" name="combo_edgeSelector">
<item> <item>
<property name="text"> <property name="text">
<string>- select selector -</string> <string>Flip edge</string>
</property>
</item>
<item>
<property name="text">
<string>Flip back edge</string>
</property> </property>
</item> </item>
</widget> </widget>
</item> </item>
<item row="13" column="1"> <item row="6" column="3">
<spacer name="verticalSpacer"> <widget class="QPushButton" name="button_applyGeneralOperation">
<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"> <property name="text">
<string>Clicks :</string> <string>Apply general operation</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="4"> <item row="7" column="0" colspan="3">
<widget class="Line" name="line"> <widget class="QComboBox" name="combo_vertexOperation">
<property name="orientation"> <item>
<enum>Qt::Horizontal</enum> <property name="text">
</property> <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> </widget>
</item> </item>
<item row="9" column="3"> <item row="9" column="3">
...@@ -236,33 +216,25 @@ ...@@ -236,33 +216,25 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="1" colspan="2"> <item row="13" column="3">
<widget class="QPushButton" name="button_accept"> <widget class="QPushButton" name="button_cancel">
<property name="text"> <property name="text">
<string>Accept</string> <string>Cancel</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="3"> <item row="2" column="0">
<widget class="QPushButton" name="button_applyGeneralOperation"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Apply general operation</string> <string>Edge selector :</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" colspan="3"> <item row="13" column="0">
<widget class="QComboBox" name="combo_positionAttribute"> <widget class="QPushButton" name="button_start">
<property name="sizePolicy"> <property name="text">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <string>Start</string>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<item>
<property name="text">
<string>- select attribute -</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="9" column="0" colspan="3"> <item row="9" column="0" colspan="3">
...@@ -309,6 +281,13 @@ ...@@ -309,6 +281,13 @@
</item> </item>
</widget> </widget>
</item> </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="3" column="1" colspan="3"> <item row="3" column="1" colspan="3">
<widget class="QComboBox" name="combo_faceSelector"> <widget class="QComboBox" name="combo_faceSelector">
<item> <item>
...@@ -318,12 +297,18 @@ ...@@ -318,12 +297,18 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="14" column="1">
<widget class="QLabel" name="label_4"> <spacer name="verticalSpacer">
<property name="text"> <property name="orientation">
<string>Face selector :</string> <enum>Qt::Vertical</enum>
</property> </property>
</widget> <property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</widget> </widget>
......
...@@ -83,9 +83,6 @@ protected: ...@@ -83,9 +83,6 @@ protected:
void createEmptyMap(); void createEmptyMap();
void createNewFace(MapHandlerGen* mhg); void createNewFace(MapHandlerGen* mhg);
void addCube(MapHandlerGen* mhg); void addCube(MapHandlerGen* mhg);
void fillHole(MapHandlerGen* mhg);
void deleteCC(MapHandlerGen* mhg);
void revolution(MapHandlerGen* mhg);
void mergeVolumes(MapHandlerGen* mhg); void mergeVolumes(MapHandlerGen* mhg);
void splitSurface(MapHandlerGen* mhg); void splitSurface(MapHandlerGen* mhg);
void extrudeRegion(MapHandlerGen* mhg); void extrudeRegion(MapHandlerGen* mhg);
...@@ -112,9 +109,10 @@ protected: ...@@ -112,9 +109,10 @@ 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; Utils::Drawer* m_drawer;
bool collect;
std::vector<PFP2::VEC3> collectedVertices;
std::vector<PFP2::VEC3> collectedVertices;
bool collect;
int mapNumber;
}; };
} // namespace SCHNApps } // namespace SCHNApps
......
...@@ -4,10 +4,6 @@ ...@@ -4,10 +4,6 @@
#include "ui_surface_modelisation.h" #include "ui_surface_modelisation.h"
#include "QString" #include "QString"
//#include "mapHandler.h"
//#include "Utils/drawer.h"
//#include "Topology/map/map2.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -44,8 +40,6 @@ private slots: ...@@ -44,8 +40,6 @@ private slots:
void edgeSelectorChanged(int index); void edgeSelectorChanged(int index);
void faceSelectorChanged(int index); void faceSelectorChanged(int index);
//void operationChanged(const QString &text);
void applyGeneralOperationButtonClicked(); void applyGeneralOperationButtonClicked();
void applyVertexOperationButtonClicked(); void applyVertexOperationButtonClicked();
void applyEdgeOperationButtonClicked(); void applyEdgeOperationButtonClicked();
......
...@@ -39,6 +39,8 @@ bool Surface_Modelisation_Plugin::enable() ...@@ -39,6 +39,8 @@ bool Surface_Modelisation_Plugin::enable()
m_drawer = new Utils::Drawer(); m_drawer = new Utils::Drawer();
registerShader(m_drawer->getShader()); registerShader(m_drawer->getShader());
mapNumber = 1;
return true; return true;
} }
...@@ -73,7 +75,7 @@ void Surface_Modelisation_Plugin::drawMap(View* view, MapHandlerGen* map) ...@@ -73,7 +75,7 @@ void Surface_Modelisation_Plugin::drawMap(View* view, MapHandlerGen* map)
void Surface_Modelisation_Plugin::mousePress(View* view, QMouseEvent* event) void Surface_Modelisation_Plugin::mousePress(View* view, QMouseEvent* event)
{ {
if(collect) if(collect && (event->button() == Qt::LeftButton))
{ {
qglviewer::Vec point(event->x(), event->y(), 0.5); qglviewer::Vec point(event->x(), event->y(), 0.5);
qglviewer::Vec vertex = view->camera()->unprojectedCoordinatesOf(point); qglviewer::Vec vertex = view->camera()->unprojectedCoordinatesOf(point);
...@@ -207,16 +209,17 @@ void Surface_Modelisation_Plugin::changeFaceSelector(const QString& map, const Q ...@@ -207,16 +209,17 @@ void Surface_Modelisation_Plugin::changeFaceSelector(const QString& map, const Q
void Surface_Modelisation_Plugin::createEmptyMap() void Surface_Modelisation_Plugin::createEmptyMap()
{ {
MapHandlerGen* mhg = m_schnapps->addMap("map", 2); QString mapName = "map_" + QString::number(mapNumber);
MapHandlerGen* mhg = m_schnapps->addMap(mapName, 2);
if(mhg) if(mhg)
{ {
MapHandler<PFP2>* mh = static_cast<MapHandler<PFP2>*>(mhg); MapHandler<PFP2>* mh = static_cast<MapHandler<PFP2>*>(mhg);
// add vertex position attribute // add vertex position attribute
VertexAttribute<PFP2::VEC3> position = mh->addAttribute<PFP2::VEC3, VERTEX>("position"); VertexAttribute<PFP2::VEC3> position = mh->addAttribute<PFP2::VEC3, VERTEX>("position");
// update corresponding VBO & emit attribute update signal // update corresponding VBO & emit attribute update signal
mh->notifyAttributeModification(position); mh->notifyAttributeModification(position);
mapNumber++;
} }
} }
...@@ -241,7 +244,6 @@ void Surface_Modelisation_Plugin::createNewFace(MapHandlerGen* mhg) ...@@ -241,7 +244,6 @@ void Surface_Modelisation_Plugin::createNewFace(MapHandlerGen* mhg)
mh->notifyConnectivityModification(); mh->notifyConnectivityModification();
mh->notifyAttributeModification(position); mh->notifyAttributeModification(position);
mh->updateBB(position); mh->updateBB(position);
collectedVertices.clear(); collectedVertices.clear();
} }
...@@ -258,11 +260,10 @@ void Surface_Modelisation_Plugin::addCube(MapHandlerGen *mhg) ...@@ -258,11 +260,10 @@ void Surface_Modelisation_Plugin::addCube(MapHandlerGen *mhg)
{ {
VertexAttribute<PFP2::VEC3>& position = h_parameterSet[mhg].positionAttribute; VertexAttribute<PFP2::VEC3>& position = h_parameterSet[mhg].positionAttribute;
Algo::Surface::Modelisation::embedPrism<PFP2>(*map, position, 4, false, 0.7f, 0.7f, 1.0f); Algo::Surface::Modelisation::embedPrism<PFP2>(*map, position, 4, true, 0.7f, 0.7f, 1.0f);
mh->notifyAttributeModification(position); mh->notifyAttributeModification(position);
mh->notifyConnectivityModification(); mh->notifyConnectivityModification();
// compute map bounding box // compute map bounding box
mh->updateBB(position); mh->updateBB(position);
} }
...@@ -274,32 +275,61 @@ void Surface_Modelisation_Plugin::mergeVolumes(MapHandlerGen* mhg) ...@@ -274,32 +275,61 @@ void Surface_Modelisation_Plugin::mergeVolumes(MapHandlerGen* mhg)
PFP2::MAP* map = mh->getMap(); PFP2::MAP* map = mh->getMap();
const MapParameters& p = h_parameterSet[mhg]; const MapParameters& p = h_parameterSet[mhg];
if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty() && (p.edgeSelector->getSelectedCells().size() == 2)) if(p.edgeSelector && !p.edgeSelector->getSelectedCells().empty() && (p.edgeSelector->getSelectedCells().size() == 2) &&