Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
David Cazier
CGoGN
Commits
c9c01aed
Commit
c9c01aed
authored
Jul 09, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
schnapps_selection update
parent
208dd6f9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
186 additions
and
67 deletions
+186
-67
SCHNApps/Plugins/surface_selection/forms/surface_selection.ui
...Apps/Plugins/surface_selection/forms/surface_selection.ui
+83
-51
SCHNApps/Plugins/surface_selection/src/surface_selection.cpp
SCHNApps/Plugins/surface_selection/src/surface_selection.cpp
+10
-11
SCHNApps/Plugins/surface_selection/src/surface_selection_dockTab.cpp
...ugins/surface_selection/src/surface_selection_dockTab.cpp
+43
-0
SCHNApps/include/mapHandler.h
SCHNApps/include/mapHandler.h
+1
-5
SCHNApps/include/mapHandler.hpp
SCHNApps/include/mapHandler.hpp
+25
-0
SCHNApps/src/controlDock_mapTab.cpp
SCHNApps/src/controlDock_mapTab.cpp
+22
-0
SCHNApps/src/schnapps.cpp
SCHNApps/src/schnapps.cpp
+2
-0
No files found.
SCHNApps/Plugins/surface_selection/forms/surface_selection.ui
View file @
c9c01aed
...
...
@@ -14,10 +14,30 @@
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"5"
column=
"0"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"button_clear"
>
<item
row=
"9"
column=
"0"
colspan=
"2"
>
<widget
class=
"QSlider"
name=
"slider_verticesScaleFactor"
>
<property
name=
"value"
>
<number>
50
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"tickPosition"
>
<enum>
QSlider::NoTicks
</enum>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
colspan=
"2"
>
<widget
class=
"Line"
name=
"line"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Clear current selection
</string>
<string>
Normal :
</string>
</property>
</widget>
</item>
...
...
@@ -30,10 +50,10 @@
</item>
</widget>
</item>
<item
row=
"
1
"
column=
"0"
>
<widget
class=
"Q
Label"
name=
"label
"
>
<item
row=
"
6
"
column=
"0"
colspan=
"2"
>
<widget
class=
"Q
PushButton"
name=
"button_clear
"
>
<property
name=
"text"
>
<string>
Normal :
</string>
<string>
Clear current selection
</string>
</property>
</widget>
</item>
...
...
@@ -62,40 +82,6 @@
</item>
</widget>
</item>
<item
row=
"2"
column=
"0"
colspan=
"2"
>
<widget
class=
"Line"
name=
"line"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item
row=
"8"
column=
"0"
colspan=
"2"
>
<widget
class=
"QSlider"
name=
"slider_verticesScaleFactor"
>
<property
name=
"value"
>
<number>
50
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"tickPosition"
>
<enum>
QSlider::NoTicks
</enum>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position :
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
colspan=
"2"
>
<widget
class=
"Line"
name=
"line_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"combo_positionAttribute"
>
<property
name=
"sizePolicy"
>
...
...
@@ -111,10 +97,10 @@
</item>
</widget>
</item>
<item
row=
"
7
"
column=
"0"
colspan=
"2"
>
<widget
class=
"
QLabel
"
name=
"l
abel_4
"
>
<property
name=
"
text
"
>
<
string>
Selected vertice size
</string
>
<item
row=
"
5
"
column=
"0"
colspan=
"2"
>
<widget
class=
"
Line
"
name=
"l
ine_2
"
>
<property
name=
"
orientation
"
>
<
enum>
Qt::Horizontal
</enum
>
</property>
</widget>
</item>
...
...
@@ -125,14 +111,35 @@
</property>
</widget>
</item>
<item
row=
"9"
column=
"0"
colspan=
"2"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position :
</string>
</property>
</widget>
</item>
<item
row=
"8"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"label_4"
>
<property
name=
"text"
>
<string>
Selected vertice size
</string>
</property>
</widget>
</item>
<item
row=
"10"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"label_5"
>
<property
name=
"text"
>
<string>
Selected vertices color
</string>
</property>
</widget>
</item>
<item
row=
"14"
column=
"1"
>
<item
row=
"7"
column=
"0"
colspan=
"2"
>
<widget
class=
"Line"
name=
"line_3"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item
row=
"15"
column=
"1"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
...
...
@@ -145,13 +152,38 @@
</property>
</spacer>
</item>
<item
row=
"1
0
"
column=
"0"
colspan=
"2"
>
<item
row=
"1
1
"
column=
"0"
colspan=
"2"
>
<widget
class=
"ColorComboBox"
name=
"combo_color"
/>
</item>
<item
row=
"6"
column=
"0"
colspan=
"2"
>
<widget
class=
"Line"
name=
"line_3"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
<item
row=
"4"
column=
"1"
>
<widget
class=
"QDoubleSpinBox"
name=
"spin_angle_radius"
>
<property
name=
"toolTip"
>
<string
notr=
"true"
/>
</property>
<property
name=
"toolTipDuration"
>
<number>
1
</number>
</property>
<property
name=
"statusTip"
>
<string/>
</property>
<property
name=
"whatsThis"
>
<string/>
</property>
<property
name=
"readOnly"
>
<bool>
true
</bool>
</property>
<property
name=
"buttonSymbols"
>
<enum>
QAbstractSpinBox::NoButtons
</enum>
</property>
<property
name=
"maximum"
>
<double>
999999999.000000000000000
</double>
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_angle_radius"
>
<property
name=
"text"
>
<string/>
</property>
</widget>
</item>
...
...
SCHNApps/Plugins/surface_selection/src/surface_selection.cpp
View file @
c9c01aed
...
...
@@ -24,7 +24,7 @@ Surface_Selection_Plugin::Surface_Selection_Plugin() :
m_selectedFaces_dirty
(
false
),
m_selectionRadiusBase
(
1
),
m_selectionRadiusCoeff
(
1
),
m_normalAngleThreshold
(
10
)
m_normalAngleThreshold
(
float
(
10
*
M_PI
/
180
)
)
{}
bool
Surface_Selection_Plugin
::
enable
()
...
...
@@ -89,8 +89,11 @@ void Surface_Selection_Plugin::disable()
delete
m_selectionSphereVBO
;
disconnect
(
m_schnapps
,
SIGNAL
(
selectedViewChanged
(
View
*
,
View
*
)),
this
,
SLOT
(
selectedViewChanged
(
View
*
,
View
*
)));
disconnect
(
m_schnapps
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapRemoved
(
MapHandlerGen
*
)));
//disconnect(m_schnapps, SIGNAL(selectedViewChanged(View*, View*)), this, SLOT(selectedViewChanged(View*, View*)));
//disconnect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
disconnect
(
m_schnapps
,
SIGNAL
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)),
this
,
SLOT
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)));
disconnect
(
m_schnapps
,
SIGNAL
(
selectedCellSelectorChanged
(
CellSelectorGen
*
)),
this
,
SLOT
(
updateSelectedCellsRendering
()));
}
void
Surface_Selection_Plugin
::
drawMap
(
View
*
view
,
MapHandlerGen
*
map
)
...
...
@@ -115,13 +118,11 @@ void Surface_Selection_Plugin::drawMap(View* view, MapHandlerGen* map)
{
if
(
m_selectedVertices_dirty
)
updateSelectedCellsRendering
();
m_pointSprite
->
setAttributePosition
(
m_selectedVerticesVBO
);
const
QColor
&
col
=
p
.
color
;
m_pointSprite
->
setColor
(
Geom
::
Vec4f
(
col
.
redF
(),
col
.
greenF
(),
col
.
blueF
(),
0.0
f
));
m_pointSprite
->
setLightPosition
(
CGoGN
::
Geom
::
Vec3f
(
0.0
f
,
0.0
f
,
1.0
f
));
m_pointSprite
->
setSize
(
p
.
basePSradius
*
p
.
verticesScaleFactor
);
m_pointSprite
->
enableVertexAttribs
();
glDrawArrays
(
GL_POINTS
,
0
,
selector
->
getNbSelectedCells
());
m_pointSprite
->
disableVertexAttribs
();
...
...
@@ -132,11 +133,9 @@ void Surface_Selection_Plugin::drawMap(View* view, MapHandlerGen* map)
std
::
vector
<
PFP2
::
VEC3
>
selectionPoint
;
selectionPoint
.
push_back
(
p
.
positionAttribute
[
m_selectingVertex
]);
m_selectionSphereVBO
->
updateData
(
selectionPoint
);
m_pointSprite
->
setAttributePosition
(
m_selectionSphereVBO
);
m_pointSprite
->
setColor
(
CGoGN
::
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
1.0
f
,
0.5
f
));
m_pointSprite
->
setLightPosition
(
CGoGN
::
Geom
::
Vec3f
(
0.0
f
,
0.0
f
,
1.0
f
));
switch
(
p
.
selectionMethod
)
{
case
NormalAngle
:
...
...
@@ -147,7 +146,6 @@ void Surface_Selection_Plugin::drawMap(View* view, MapHandlerGen* map)
m_pointSprite
->
setSize
(
m_selectionRadiusBase
*
m_selectionRadiusCoeff
);
break
;
}
m_pointSprite
->
enableVertexAttribs
();
glEnable
(
GL_BLEND
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
...
...
@@ -502,14 +500,16 @@ void Surface_Selection_Plugin::wheelEvent(View* view, QWheelEvent* event)
else
m_selectionRadiusCoeff
*=
1.1
f
;
view
->
updateGL
();
m_dockTab
->
spin_angle_radius
->
setValue
(
m_selectionRadiusBase
*
m_selectionRadiusCoeff
);
break
;
}
case
NormalAngle
:
{
if
(
event
->
delta
()
>
0
)
m_normalAngleThreshold
*
=
0.9
f
;
m_normalAngleThreshold
-
=
CGoGN
::
PFP_SCHNAPPS
::
REAL
(
M_PI
/
180
)
;
else
m_normalAngleThreshold
*
=
1.1
f
;
m_normalAngleThreshold
+
=
CGoGN
::
PFP_SCHNAPPS
::
REAL
(
M_PI
/
180
)
;
// view->displayMessage(QString("Angle threshold : ") + m_normalAngleThreshold);
m_dockTab
->
spin_angle_radius
->
setValue
(
m_normalAngleThreshold
/
M_PI
*
180
);
break
;
}
}
...
...
@@ -573,7 +573,6 @@ void Surface_Selection_Plugin::updateSelectedCellsRendering()
m_selectedEdgesDrawer
->
newList
(
GL_COMPILE
);
m_selectedEdgesDrawer
->
lineWidth
(
3.0
f
);
// m_selectedEdgesDrawer->color3f(1.0f, 0.0f, 0.0f);
m_selectedEdgesDrawer
->
color3f
(
p
.
color
.
redF
(),
p
.
color
.
greenF
(),
p
.
color
.
blueF
());
m_selectedEdgesDrawer
->
begin
(
GL_LINES
);
for
(
std
::
vector
<
Edge
>::
const_iterator
e
=
selectedCells
.
begin
();
e
!=
selectedCells
.
end
();
++
e
)
...
...
SCHNApps/Plugins/surface_selection/src/surface_selection_dockTab.cpp
View file @
c9c01aed
...
...
@@ -43,6 +43,7 @@ void Surface_Selection_DockTab::positionAttributeChanged(int index)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
map
);
m_plugin
->
h_parameterSet
[
map
].
positionAttribute
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
combo_positionAttribute
->
currentText
());
m_plugin
->
updateSelectedCellsRendering
();
m_plugin
->
pythonRecording
(
"changePositionAttribute"
,
""
,
map
->
getName
(),
combo_positionAttribute
->
currentText
());
}
}
...
...
@@ -57,6 +58,7 @@ void Surface_Selection_DockTab::normalAttributeChanged(int index)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
map
);
m_plugin
->
h_parameterSet
[
map
].
normalAttribute
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
combo_normalAttribute
->
currentText
());
m_plugin
->
updateSelectedCellsRendering
();
m_plugin
->
pythonRecording
(
"changeNormalAttribute"
,
""
,
map
->
getName
(),
combo_normalAttribute
->
currentText
());
}
}
...
...
@@ -72,6 +74,26 @@ void Surface_Selection_DockTab::selectionMethodChanged(int index)
m_plugin
->
h_parameterSet
[
map
].
selectionMethod
=
SelectionMethod
(
index
);
m_plugin
->
pythonRecording
(
"changeSelectionMethod"
,
""
,
map
->
getName
(),
index
);
}
switch
(
index
)
{
case
0
:
this
->
spin_angle_radius
->
setHidden
(
true
);
this
->
label_angle_radius
->
setText
(
QString
());
break
;
case
1
:
this
->
spin_angle_radius
->
setHidden
(
false
);
this
->
spin_angle_radius
->
setValue
(
m_plugin
->
m_selectionRadiusBase
*
m_plugin
->
m_selectionRadiusCoeff
);
this
->
label_angle_radius
->
setText
(
QString
(
"Radius:"
));
break
;
case
2
:
this
->
spin_angle_radius
->
setHidden
(
false
);
this
->
spin_angle_radius
->
setValue
(
m_plugin
->
m_normalAngleThreshold
/
M_PI
*
180
);
this
->
label_angle_radius
->
setText
(
QString
(
"Angle:"
));
break
;
default:
break
;
}
}
}
...
...
@@ -204,6 +226,27 @@ void Surface_Selection_DockTab::updateMapParameters()
combo_color
->
setColor
(
p
.
color
);
slider_verticesScaleFactor
->
setValue
(
int
(
50.0
*
p
.
verticesScaleFactor
));
switch
(
p
.
selectionMethod
)
{
case
0
:
this
->
spin_angle_radius
->
setHidden
(
true
);
this
->
label_angle_radius
->
setText
(
QString
());
break
;
case
1
:
this
->
spin_angle_radius
->
setHidden
(
false
);
this
->
spin_angle_radius
->
setValue
(
m_plugin
->
m_selectionRadiusBase
*
m_plugin
->
m_selectionRadiusCoeff
);
this
->
label_angle_radius
->
setText
(
QString
(
"Radius:"
));
break
;
case
2
:
this
->
spin_angle_radius
->
setHidden
(
false
);
this
->
spin_angle_radius
->
setValue
(
m_plugin
->
m_normalAngleThreshold
/
M_PI
*
180
);
this
->
label_angle_radius
->
setText
(
QString
(
"Angle:"
));
break
;
default:
break
;
}
}
b_updatingUI
=
false
;
...
...
SCHNApps/include/mapHandler.h
View file @
c9c01aed
...
...
@@ -409,11 +409,7 @@ public:
MapHandlerGen
(
name
,
s
,
map
)
{}
~
MapHandler
()
{
if
(
m_map
)
delete
m_map
;
}
~
MapHandler
();
inline
MAP
*
getMap
()
{
return
static_cast
<
MAP
*>
(
m_map
);
}
...
...
SCHNApps/include/mapHandler.hpp
View file @
c9c01aed
...
...
@@ -9,6 +9,8 @@ namespace CGoGN
namespace
SCHNApps
{
inline
void
MapHandlerGen
::
registerAttribute
(
const
AttributeHandlerGen
&
ah
)
{
m_attribs
[
ah
.
getOrbit
()].
insert
(
QString
::
fromStdString
(
ah
.
name
()),
QString
::
fromStdString
(
ah
.
typeName
()));
...
...
@@ -31,6 +33,29 @@ inline QString MapHandlerGen::getAttributeTypeName(unsigned int orbit, const QSt
template
<
typename
PFP
>
MapHandler
<
PFP
>::~
MapHandler
()
{
// clean the cell selector
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
{
foreach
(
CellSelectorGen
*
cs
,
m_cellSelectors
[
orbit
])
{
if
(
cs
)
{
emit
(
cellSelectorRemoved
(
orbit
,
cs
->
getName
()));
disconnect
(
cs
,
SIGNAL
(
selectedCellsChanged
()),
this
,
SLOT
(
selectedCellsChanged
()));
delete
cs
;
}
}
m_cellSelectors
[
orbit
].
clear
();
}
if
(
m_map
)
delete
m_map
;
}
template
<
typename
PFP
>
unsigned
int
MapHandler
<
PFP
>::
getNbDarts
()
{
...
...
SCHNApps/src/controlDock_mapTab.cpp
View file @
c9c01aed
...
...
@@ -324,9 +324,31 @@ void ControlDock_MapTab::mapRemoved(MapHandlerGen* m)
if
(
!
items
.
empty
())
{
b_updatingUI
=
true
;
delete
items
[
0
];
if
(
m_schnapps
->
getSelectedMap
()
==
m
)
{
std
::
cout
<<
"Unselecting"
<<
std
::
endl
;
m_selectedSelector
[
DART
]
=
NULL
;
foreach
(
QListWidgetItem
*
item
,
list_dartSelectors
->
selectedItems
())
item
->
setSelected
(
false
);
m_selectedSelector
[
VERTEX
]
=
NULL
;
foreach
(
QListWidgetItem
*
item
,
list_vertexSelectors
->
selectedItems
())
item
->
setSelected
(
false
);
m_selectedSelector
[
EDGE
]
=
NULL
;
foreach
(
QListWidgetItem
*
item
,
list_edgeSelectors
->
selectedItems
())
item
->
setSelected
(
false
);
m_selectedSelector
[
FACE
]
=
NULL
;
foreach
(
QListWidgetItem
*
item
,
list_faceSelectors
->
selectedItems
())
item
->
setSelected
(
false
);
m_selectedSelector
[
VOLUME
]
=
NULL
;
foreach
(
QListWidgetItem
*
item
,
list_volumeSelectors
->
selectedItems
())
item
->
setSelected
(
false
);
}
b_updatingUI
=
false
;
}
}
...
...
SCHNApps/src/schnapps.cpp
View file @
c9c01aed
...
...
@@ -1319,6 +1319,8 @@ void SCHNApps::cleanAll()
Camera
::
cameraCount
=
1
;
View
::
viewCount
=
1
;
m_pluginDock
->
setVisible
(
false
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment