Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Cazier
CGoGN
Commits
95cf4074
Commit
95cf4074
authored
Jan 29, 2014
by
Sylvain Thery
Browse files
Merge branch 'master' of cgogn:~cgogn/CGoGN
parents
734ba6e6
b8c1a242
Changes
6
Hide whitespace changes
Inline
Side-by-side
SCHNApps/Plugins/surface_modelisation/forms/surface_modelisation.ui
View file @
95cf4074
...
...
@@ -14,43 +14,48 @@
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"
0
"
column=
"
0
"
>
<widget
class=
"Q
Label"
name=
"label_2
"
>
<item
row=
"
13
"
column=
"
1"
colspan=
"2
"
>
<widget
class=
"Q
PushButton"
name=
"button_accept
"
>
<property
name=
"text"
>
<string>
Position :
</string>
<string>
Accept
</string>
</property>
</widget>
</item>
<item
row=
"8"
column=
"0"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"combo_edgeOperation"
>
<item>
<property
name=
"text"
>
<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
row=
"5"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_5"
>
<property
name=
"text"
>
<string>
Operations :
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"combo_vertexSelector"
>
<item>
<property
name=
"text"
>
<string>
Flip edge
</string>
<string>
- select selector -
</string>
</property>
</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>
<property
name=
"text"
>
<string>
Flip back edge
</string>
<string>
- select selector -
</string>
</property>
</item>
</widget>
...
...
@@ -77,21 +82,6 @@
<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>
...
...
@@ -109,13 +99,6 @@
</item>
</widget>
</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"
>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"text"
>
...
...
@@ -123,43 +106,51 @@
</property>
</widget>
</item>
<item
row=
"
7
"
column=
"
3
"
>
<widget
class=
"Q
PushButton"
name=
"button_applyVertexOperation
"
>
<item
row=
"
0
"
column=
"
0
"
>
<widget
class=
"Q
Label"
name=
"label_2
"
>
<property
name=
"text"
>
<string>
Apply vertex opera
tion
</string>
<string>
Posi
tion
:
</string>
</property>
</widget>
</item>
<item
row=
"
10
"
column=
"0"
colspan=
"4"
>
<widget
class=
"
Line
"
name=
"l
ine_2
"
>
<property
name=
"
orientation
"
>
<
enum>
Qt::Horizontal
</enum
>
<item
row=
"
3
"
column=
"0"
>
<widget
class=
"
QLabel
"
name=
"l
abel_4
"
>
<property
name=
"
text
"
>
<
string>
Face selector :
</string
>
</property>
</widget>
</item>
<item
row=
"
12
"
column=
"
3
"
>
<widget
class=
"
QPushButton"
name=
"button_cancel
"
>
<property
name=
"
text
"
>
<
string>
Cancel
</string
>
<item
row=
"
4
"
column=
"
0"
colspan=
"4
"
>
<widget
class=
"
Line"
name=
"line
"
>
<property
name=
"
orientation
"
>
<
enum>
Qt::Horizontal
</enum
>
</property>
</widget>
</item>
<item
row=
"8"
column=
"3"
>
<widget
class=
"QPushButton"
name=
"button_applyEdgeOperation"
>
<property
name=
"text"
>
<string>
Apply edge operation
</string>
<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>
<property
name=
"text"
>
<string>
- select attribute -
</string>
</property>
</item>
</widget>
</item>
<item
row=
"12"
column=
"0"
>
<widget
class=
"Q
PushButton"
name=
"button_start
"
>
<widget
class=
"Q
Label"
name=
"label_6
"
>
<property
name=
"text"
>
<string>
Start
</string>
<string>
Clicks :
</string>
</property>
</widget>
</item>
<item
row=
"
7
"
column=
"0"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"combo_
vertex
Operation"
>
<item
row=
"
8
"
column=
"0"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"combo_
edge
Operation"
>
<item>
<property
name=
"text"
>
<string>
- select operation -
</string>
...
...
@@ -167,66 +158,55 @@
</item>
<item>
<property
name=
"text"
>
<string>
Split vertex
</string>
<string>
Cut edge
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Delete vertex
</string>
<string>
Uncut edge
</string>
</property>
</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>
<property
name=
"text"
>
<string>
- select selector -
</string>
<string>
Collapse edge
</string>
</property>
</item>
</widget>
</item>
<item
row=
"2"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"combo_edgeSelector"
>
<item>
<property
name=
"text"
>
<string>
- select selector -
</string>
<string>
Flip edge
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Flip back edge
</string>
</property>
</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"
>
<item
row=
"6"
column=
"3"
>
<widget
class=
"QPushButton"
name=
"button_applyGeneralOperation"
>
<property
name=
"text"
>
<string>
Clicks :
</string>
<string>
Apply general operation
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
colspan=
"4"
>
<widget
class=
"Line"
name=
"line"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<item
row=
"7"
column=
"0"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"combo_vertexOperation"
>
<item>
<property
name=
"text"
>
<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>
</item>
<item
row=
"9"
column=
"3"
>
...
...
@@ -236,33 +216,25 @@
</property>
</widget>
</item>
<item
row=
"1
2
"
column=
"
1"
colspan=
"2
"
>
<widget
class=
"QPushButton"
name=
"button_
accept
"
>
<item
row=
"1
3
"
column=
"
3
"
>
<widget
class=
"QPushButton"
name=
"button_
cancel
"
>
<property
name=
"text"
>
<string>
Accept
</string>
<string>
Cancel
</string>
</property>
</widget>
</item>
<item
row=
"
6
"
column=
"
3
"
>
<widget
class=
"Q
PushButton"
name=
"button_applyGeneralOperation
"
>
<item
row=
"
2
"
column=
"
0
"
>
<widget
class=
"Q
Label"
name=
"label
"
>
<property
name=
"text"
>
<string>
Apply general operation
</string>
<string>
Edge selector :
</string>
</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>
<item
row=
"13"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"button_start"
>
<property
name=
"text"
>
<string>
Start
</string>
</property>
<item>
<property
name=
"text"
>
<string>
- select attribute -
</string>
</property>
</item>
</widget>
</item>
<item
row=
"9"
column=
"0"
colspan=
"3"
>
...
...
@@ -309,6 +281,13 @@
</item>
</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=
"3"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"combo_faceSelector"
>
<item>
...
...
@@ -318,12 +297,18 @@
</item>
</widget>
</item>
<item
row=
"
3
"
column=
"
0
"
>
<
widget
class=
"QLabel"
name=
"label_4
"
>
<property
name=
"
text
"
>
<
string>
Face selector :
</string
>
<item
row=
"
14
"
column=
"
1
"
>
<
spacer
name=
"verticalSpacer
"
>
<property
name=
"
orientation
"
>
<
enum>
Qt::Vertical
</enum
>
</property>
</widget>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
...
...
SCHNApps/Plugins/surface_modelisation/include/surface_modelisation.h
View file @
95cf4074
...
...
@@ -83,9 +83,6 @@ protected:
void
createEmptyMap
();
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
);
...
...
@@ -112,9 +109,10 @@ protected:
Surface_Modelisation_DockTab
*
m_dockTab
;
QHash
<
MapHandlerGen
*
,
MapParameters
>
h_parameterSet
;
Utils
::
Drawer
*
m_drawer
;
bool
collect
;
std
::
vector
<
PFP2
::
VEC3
>
collectedVertices
;
std
::
vector
<
PFP2
::
VEC3
>
collectedVertices
;
bool
collect
;
int
mapNumber
;
};
}
// namespace SCHNApps
...
...
SCHNApps/Plugins/surface_modelisation/include/surface_modelisation_dockTab.h
View file @
95cf4074
...
...
@@ -4,10 +4,6 @@
#include
"ui_surface_modelisation.h"
#include
"QString"
//#include "mapHandler.h"
//#include "Utils/drawer.h"
//#include "Topology/map/map2.h"
namespace
CGoGN
{
...
...
@@ -44,8 +40,6 @@ private slots:
void
edgeSelectorChanged
(
int
index
);
void
faceSelectorChanged
(
int
index
);
//void operationChanged(const QString &text);
void
applyGeneralOperationButtonClicked
();
void
applyVertexOperationButtonClicked
();
void
applyEdgeOperationButtonClicked
();
...
...
SCHNApps/Plugins/surface_modelisation/src/surface_modelisation.cpp
View file @
95cf4074
...
...
@@ -39,6 +39,8 @@ bool Surface_Modelisation_Plugin::enable()
m_drawer
=
new
Utils
::
Drawer
();
registerShader
(
m_drawer
->
getShader
());
mapNumber
=
1
;
return
true
;
}
...
...
@@ -73,7 +75,7 @@ void Surface_Modelisation_Plugin::drawMap(View* view, MapHandlerGen* map)
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
vertex
=
view
->
camera
()
->
unprojectedCoordinatesOf
(
point
);
...
...
@@ -207,16 +209,17 @@ void Surface_Modelisation_Plugin::changeFaceSelector(const QString& map, const Q
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
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
mhg
);
// add vertex position attribute
VertexAttribute
<
PFP2
::
VEC3
>
position
=
mh
->
addAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
"position"
);
// update corresponding VBO & emit attribute update signal
mh
->
notifyAttributeModification
(
position
);
mapNumber
++
;
}
}
...
...
@@ -241,7 +244,6 @@ void Surface_Modelisation_Plugin::createNewFace(MapHandlerGen* mhg)
mh
->
notifyConnectivityModification
();
mh
->
notifyAttributeModification
(
position
);
mh
->
updateBB
(
position
);
collectedVertices
.
clear
();
}
...
...
@@ -258,11 +260,10 @@ void Surface_Modelisation_Plugin::addCube(MapHandlerGen *mhg)
{
VertexAttribute
<
PFP2
::
VEC3
>&
position
=
h_parameterSet
[
mhg
].
positionAttribute
;
Algo
::
Surface
::
Modelisation
::
embedPrism
<
PFP2
>
(
*
map
,
position
,
4
,
fals
e
,
0.7
f
,
0.7
f
,
1.0
f
);
Algo
::
Surface
::
Modelisation
::
embedPrism
<
PFP2
>
(
*
map
,
position
,
4
,
tru
e
,
0.7
f
,
0.7
f
,
1.0
f
);
mh
->
notifyAttributeModification
(
position
);
mh
->
notifyConnectivityModification
();
// compute map bounding box
mh
->
updateBB
(
position
);
}
...
...
@@ -274,32 +275,61 @@ void Surface_Modelisation_Plugin::mergeVolumes(MapHandlerGen* mhg)
PFP2
::
MAP
*
map
=
mh
->
getMap
();
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
)
&&
p
.
faceSelector
&&
!
p
.
faceSelector
->
getSelectedCells
().
empty
()
&&
(
p
.
faceSelector
->
getSelectedCells
().
size
()
==
2
))
{
const
std
::
vector
<
Dart
>&
selectedDarts
=
p
.
edgeSelector
->
getSelectedCells
();
const
std
::
vector
<
Dart
>&
selectedFaces
=
p
.
faceSelector
->
getSelectedCells
();
Dart
d
=
selectedDarts
[
0
];
Dart
e
=
selectedDarts
[
1
];
int
i
=
1
;
int
j
=
1
;
Dart
d1
=
selectedDarts
[
0
];
Dart
d2
=
selectedDarts
[
1
];
Dart
f1
=
selectedFaces
[
0
];
Dart
f2
=
selectedFaces
[
1
];
int
i
=
1
,
j
=
1
;
bool
isWellSelected
=
true
;
while
(
map
->
phi1
(
d
)
!=
selectedDarts
[
0
]
)
if
(
!
(
map
->
sameFace
(
d1
,
f1
)
&&
(
map
->
sameFace
(
d2
,
f2
)))
)
{
i
++
;
d
=
map
->
phi1
(
d
);
}
while
(
map
->
phi1
(
e
)
!=
selectedDarts
[
1
])
{
j
++
;
e
=
map
->
phi1
(
e
);
if
(
!
(
map
->
sameFace
(
d1
,
f2
)
&&
(
map
->
sameFace
(
d2
,
f1
))))
{
if
((
map
->
sameFace
(
map
->
phi2
(
d1
),
f1
))
||
(
map
->
sameFace
(
map
->
phi2
(
d1
),
f2
)))
d1
=
map
->
phi2
(
d1
);
if
((
map
->
sameFace
(
map
->
phi2
(
d2
),
f1
))
||
(
map
->
sameFace
(
map
->
phi2
(
d2
),
f2
)))
d2
=
map
->
phi2
(
d2
);
if
(
map
->
sameFace
(
d1
,
d2
)
||
!
((
map
->
sameFace
(
d1
,
f1
)
&&
(
map
->
sameFace
(
d2
,
f2
)))
||
(
map
->
sameFace
(
d1
,
f2
)
&&
(
map
->
sameFace
(
d2
,
f1
)))))
isWellSelected
=
false
;
}
}
if
(
d
==
e
)
if
(
isWellSelected
)
{
map
->
mergeVolumes
(
selectedDarts
[
0
],
selectedDarts
[
1
]);
mh
->
notifyConnectivityModification
();
Dart
it
=
map
->
phi1
(
d1
);
do
{
it
=
map
->
phi1
(
it
);
i
++
;
}
while
(
it
!=
d1
);
it
=
map
->
phi1
(
d2
);
do
{
it
=
map
->
phi1
(
it
);
j
++
;
}
while
(
it
!=
d2
);
if
(
i
==
j
)
{
map
->
mergeVolumes
(
d1
,
d2
);
mh
->
notifyConnectivityModification
();
}
else
QMessageBox
::
information
(
0
,
"Attention"
,
"Selected faces should have the same number of edges"
);
}
else
QMessageBox
::
information
(
0
,
"Attention"
,
"Selected faces should have the same number of edges"
);
}
}
...
...
@@ -308,17 +338,58 @@ void Surface_Modelisation_Plugin::splitSurface(MapHandlerGen* mhg)
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
mhg
);
PFP2
::
MAP
*
map
=
mh
->
getMap
();
const
MapParameters
&
p
=
h_parameterSet
[
mhg
];
MapParameters
&
p
=
h_parameterSet
[
mhg
];
if
(
p
.
edgeSelector
&&
!
p
.
edgeSelector
->
getSelectedCells
().
empty
())
{
std
::
vector
<
Dart
>
selectedDarts
=
p
.
edgeSelector
->
getSelectedCells
();
std
::
vector
<
Dart
>
path
=
selectedDarts
;
bool
isPath
=
true
;
unsigned
int
i
=
0
;
if
(
!
(
map
->
sameVertex
(
path
[
0
],
map
->
phi1
(
path
[
path
.
size
()
-
1
]))
||
map
->
sameVertex
(
path
[
0
],
map
->
phi_1
(
path
[
path
.
size
()
-
1
]))))
{
if
(
map
->
sameVertex
(
map
->
phi2
(
path
[
0
]),
map
->
phi1
(
path
[
path
.
size
()
-
1
]))
||
map
->
sameVertex
(
map
->
phi2
(
path
[
0
]),
map
->
phi_1
(
path
[
path
.
size
()
-
1
])))
path
[
0
]
=
map
->
phi2
(
path
[
0
]);
else
isPath
=
false
;
}
if
(
isPath
)
{
for
(
std
::
vector
<
Dart
>::
iterator
it
=
path
.
begin
()
;
it
!=
path
.
end
()
-
1
;
++
it
)
{
if
(
isPath
)
{
CellMarker
<
VERTEX
>*
vm
=
new
CellMarker
<
VERTEX
>
(
*
map
);
if
(
vm
->
isMarked
(
*
it
))
isPath
=
false
;
vm
->
mark
(
*
it
);
std
::
vector
<
Dart
>::
iterator
next
;
next
=
it
+
1
;
if
(
!
map
->
sameVertex
(
map
->
phi1
(
*
it
),
*
next
))
{
if
(
map
->
sameVertex
(
map
->
phi1
(
*
it
),
map
->
phi2
(
*
next
)))
{
path
[
i
+
1
]
=
map
->
phi2
(
*
next
);
}
else
isPath
=
false
;
}
i
++
;
}
else
break
;
}
}
if