Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
David Cazier
CGoGN
Commits
4bbd6fba
Commit
4bbd6fba
authored
Dec 21, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCHNApps: compute normals in differential properties plugin ok
parent
e4868c57
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
137 additions
and
147 deletions
+137
-147
SCHNApps/Plugins/differentialProperties/CMakeLists.txt
SCHNApps/Plugins/differentialProperties/CMakeLists.txt
+6
-4
SCHNApps/Plugins/differentialProperties/forms/computeNormalsDialog.ui
...gins/differentialProperties/forms/computeNormalsDialog.ui
+32
-11
SCHNApps/Plugins/differentialProperties/include/differentialProperties.h
...s/differentialProperties/include/differentialProperties.h
+2
-16
SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp
...ins/differentialProperties/src/differentialProperties.cpp
+3
-32
SCHNApps/Plugins/subdivideSurface/subdivideSurface.cpp
SCHNApps/Plugins/subdivideSurface/subdivideSurface.cpp
+33
-1
SCHNApps/Plugins/subdivideSurface/subdivideSurface.h
SCHNApps/Plugins/subdivideSurface/subdivideSurface.h
+1
-0
SCHNApps/Plugins/subdivideSurface/subdivideSurface.ui
SCHNApps/Plugins/subdivideSurface/subdivideSurface.ui
+22
-1
SCHNApps/forms/mapsDialog.ui
SCHNApps/forms/mapsDialog.ui
+8
-1
SCHNApps/src/dialogs/mapsDialog.cpp
SCHNApps/src/dialogs/mapsDialog.cpp
+2
-1
SCHNApps/src/dialogs/pluginsViewDialog.cpp
SCHNApps/src/dialogs/pluginsViewDialog.cpp
+2
-0
SCHNApps/src/window.cpp
SCHNApps/src/window.cpp
+26
-80
No files found.
SCHNApps/Plugins/differentialProperties/CMakeLists.txt
View file @
4bbd6fba
...
...
@@ -2,20 +2,22 @@ cmake_minimum_required(VERSION 2.8)
INCLUDE_DIRECTORIES
(
${
SCHNApps_ROOT_DIR
}
/include
${
SCHNApps_ROOT_DIR
}
/Plugins/differentialProperties
${
SCHNApps_ROOT_DIR
}
/Plugins/differentialProperties
/include
${
CMAKE_CURRENT_BINARY_DIR
}
)
SET
(
PLUGIN_SRC
${
SCHNApps_ROOT_DIR
}
/Plugins/differentialProperties/differentialProperties.cpp
${
SCHNApps_ROOT_DIR
}
/Plugins/differentialProperties/src/differentialProperties.cpp
${
SCHNApps_ROOT_DIR
}
/Plugins/differentialProperties/src/computeNormalsDialog.cpp
)
SET
(
PLUGIN_H
${
SCHNApps_ROOT_DIR
}
/Plugins/differentialProperties/differentialProperties.h
${
SCHNApps_ROOT_DIR
}
/Plugins/differentialProperties/include/differentialProperties.h
${
SCHNApps_ROOT_DIR
}
/Plugins/differentialProperties/include/computeNormalsDialog.h
)
SET
(
PLUGIN_FORM
${
SCHNApps_ROOT_DIR
}
/Plugins/differentialProperties/computeNormalsDialog.ui
${
SCHNApps_ROOT_DIR
}
/Plugins/differentialProperties/
forms/
computeNormalsDialog.ui
)
IF
(
${
CMAKE_BUILD_TYPE
}
STREQUAL Debug
)
...
...
SCHNApps/Plugins/differentialProperties/computeNormalsDialog.ui
→
SCHNApps/Plugins/differentialProperties/
forms/
computeNormalsDialog.ui
View file @
4bbd6fba
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
400
</width>
<height>
2
23
</height>
<width>
282
</width>
<height>
2
65
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -18,21 +18,32 @@
<widget
class=
"QListWidget"
name=
"mapList"
/>
</item>
<item>
<widget
class=
"QComboBox"
name=
"combo_positionAttribute"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position attribute :
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"combo_positionAttribute"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
A
ttribute name :
</string>
<string>
Normal a
ttribute name :
</string>
</property>
</widget>
</item>
...
...
@@ -41,6 +52,16 @@
</item>
</layout>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"check_createVBO"
>
<property
name=
"text"
>
<string>
create VBO
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"orientation"
>
...
...
SCHNApps/Plugins/differentialProperties/differentialProperties.h
→
SCHNApps/Plugins/differentialProperties/
include/
differentialProperties.h
View file @
4bbd6fba
...
...
@@ -2,7 +2,8 @@
#define _DIFFERENTIALPROPERTIES_PLUGIN_H_
#include "plugin.h"
#include "ui_computeNormalsDialog.h"
#include "computeNormalsDialog.h"
#include "Topology/generic/functor.h"
#include "Topology/generic/parameters.h"
...
...
@@ -23,21 +24,6 @@ typedef PFP::MAP MAP;
typedef
PFP
::
VEC3
VEC3
;
class
ComputeNormalsDialog
:
public
QDialog
,
public
Ui
::
ComputeNormalsDialog
{
Q_OBJECT
public:
ComputeNormalsDialog
(
Window
*
w
);
public
slots
:
void
cb_selectedMapChanged
();
private:
Window
*
m_window
;
};
class
DifferentialPropertiesPlugin
:
public
Plugin
{
Q_OBJECT
...
...
SCHNApps/Plugins/differentialProperties/differentialProperties.cpp
→
SCHNApps/Plugins/differentialProperties/
src/
differentialProperties.cpp
View file @
4bbd6fba
...
...
@@ -5,32 +5,6 @@
#include "Algo/Geometry/normal.h"
ComputeNormalsDialog
::
ComputeNormalsDialog
(
Window
*
w
)
:
m_window
(
w
)
{
setupUi
(
this
);
connect
(
mapList
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
cb_selectedMapChanged
()));
}
void
ComputeNormalsDialog
::
cb_selectedMapChanged
()
{
QList
<
QListWidgetItem
*>
currentItems
=
mapList
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
combo_positionAttribute
->
clear
();
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandlerGen
*
mh
=
m_window
->
getMap
(
mapname
);
GenericMap
*
map
=
mh
->
getGenericMap
();
AttributeContainer
&
cont
=
map
->
getAttributeContainer
<
VERTEX
>
();
std
::
vector
<
std
::
string
>
names
;
cont
.
getAttributesNames
(
names
);
for
(
unsigned
int
i
=
0
;
i
<
names
.
size
();
++
i
)
combo_positionAttribute
->
addItem
(
QString
::
fromStdString
(
names
[
i
]));
}
}
bool
DifferentialPropertiesPlugin
::
enable
()
{
m_computeNormalsDialog
=
new
ComputeNormalsDialog
(
m_window
);
...
...
@@ -46,12 +20,7 @@ bool DifferentialPropertiesPlugin::enable()
void
DifferentialPropertiesPlugin
::
cb_openComputeNormalsDialog
()
{
m_computeNormalsDialog
->
mapList
->
clear
();
m_computeNormalsDialog
->
attributeName
->
setText
(
"normal"
);
const
QList
<
MapHandlerGen
*>&
maps
=
m_window
->
getMapsList
();
foreach
(
MapHandlerGen
*
map
,
maps
)
m_computeNormalsDialog
->
mapList
->
addItem
(
map
->
getName
());
m_computeNormalsDialog
->
init
();
m_computeNormalsDialog
->
show
();
}
...
...
@@ -70,6 +39,8 @@ void DifferentialPropertiesPlugin::cb_computeNormals()
if
(
!
normal
.
isValid
())
normal
=
map
->
addAttribute
<
VEC3
,
VERTEX
>
(
normalName
);
Algo
::
Geometry
::
computeNormalVertices
<
PFP
>
(
*
map
,
position
,
normal
);
if
(
m_computeNormalsDialog
->
check_createVBO
->
checkState
()
==
Qt
::
Checked
)
mh
->
createVBO
(
normal
);
}
}
...
...
SCHNApps/Plugins/subdivideSurface/subdivideSurface.cpp
View file @
4bbd6fba
...
...
@@ -12,6 +12,7 @@ bool SubdivideSurfacePlugin::enable()
connect
(
m_window
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
cb_addMapToList
(
MapHandlerGen
*
)));
connect
(
m_window
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
cb_removeMapFromList
(
MapHandlerGen
*
)));
connect
(
m_dockTab
->
mapList
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
cb_selectedMapChanged
()));
connect
(
m_dockTab
->
button_trianguleFaces
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_trianguleFaces
()));
QList
<
MapHandlerGen
*>
maps
=
m_window
->
getMapsList
();
...
...
@@ -38,6 +39,29 @@ void SubdivideSurfacePlugin::cb_removeMapFromList(MapHandlerGen* m)
}
}
void
SubdivideSurfacePlugin
::
cb_selectedMapChanged
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_dockTab
->
mapList
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
m_dockTab
->
combo_positionAttribute
->
clear
();
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandlerGen
*
mh
=
m_window
->
getMap
(
mapname
);
GenericMap
*
map
=
mh
->
getGenericMap
();
AttributeContainer
&
cont
=
map
->
getAttributeContainer
<
VERTEX
>
();
std
::
vector
<
std
::
string
>
names
;
std
::
vector
<
std
::
string
>
types
;
cont
.
getAttributesNames
(
names
);
cont
.
getAttributesTypes
(
types
);
std
::
string
vec3TypeName
=
VEC3
::
CGoGNnameOfType
();
for
(
unsigned
int
i
=
0
;
i
<
names
.
size
();
++
i
)
{
if
(
types
[
i
]
==
vec3TypeName
)
m_dockTab
->
combo_positionAttribute
->
addItem
(
QString
::
fromStdString
(
names
[
i
]));
}
}
}
void
SubdivideSurfacePlugin
::
cb_trianguleFaces
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_dockTab
->
mapList
->
selectedItems
();
...
...
@@ -46,11 +70,19 @@ void SubdivideSurfacePlugin::cb_trianguleFaces()
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandler
<
PFP
>*
mh
=
reinterpret_cast
<
MapHandler
<
PFP
>*>
(
m_window
->
getMap
(
mapname
));
MAP
*
map
=
mh
->
getMap
();
VertexAttribute
<
VEC3
>
position
=
map
->
getAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
std
::
string
positionName
=
m_dockTab
->
combo_positionAttribute
->
currentText
().
toUtf8
().
constData
();
VertexAttribute
<
VEC3
>
position
=
map
->
getAttribute
<
VEC3
,
VERTEX
>
(
positionName
);
Algo
::
Modelisation
::
trianguleFaces
<
PFP
>
(
*
map
,
position
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
POINTS
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
LINES
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
TRIANGLES
);
mh
->
updateVBO
(
position
);
QList
<
View
*>
views
=
m_window
->
getViewsList
();
foreach
(
View
*
view
,
views
)
{
if
(
view
->
isLinkedToMap
(
mh
))
view
->
updateGL
();
}
}
}
...
...
SCHNApps/Plugins/subdivideSurface/subdivideSurface.h
View file @
4bbd6fba
...
...
@@ -69,6 +69,7 @@ protected:
public
slots
:
void
cb_addMapToList
(
MapHandlerGen
*
m
);
void
cb_removeMapFromList
(
MapHandlerGen
*
m
);
void
cb_selectedMapChanged
();
void
cb_trianguleFaces
();
};
...
...
SCHNApps/Plugins/subdivideSurface/subdivideSurface.ui
View file @
4bbd6fba
...
...
@@ -7,7 +7,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
174
</width>
<height>
331
</height>
<height>
427
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -17,6 +17,27 @@
<item>
<widget
class=
"QListWidget"
name=
"mapList"
/>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position :
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"combo_positionAttribute"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_trianguleFaces"
>
<property
name=
"text"
>
...
...
SCHNApps/forms/mapsDialog.ui
View file @
4bbd6fba
...
...
@@ -27,7 +27,14 @@
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"removeMapButton"
>
<widget
class=
"QPushButton"
name=
"button_refreshMapInfo"
>
<property
name=
"text"
>
<string>
Refresh info
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_removeMap"
>
<property
name=
"text"
>
<string>
Remove
</string>
</property>
...
...
SCHNApps/src/dialogs/mapsDialog.cpp
View file @
4bbd6fba
...
...
@@ -19,7 +19,8 @@ MapsDialog::MapsDialog(Window* window) :
this
->
setupUi
(
this
);
this
->
setModal
(
false
);
connect
(
removeMapButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_removeMap
()));
connect
(
button_removeMap
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_removeMap
()));
connect
(
button_refreshMapInfo
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_selectedMapChanged
()));
connect
(
mapList
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
cb_selectedMapChanged
()));
...
...
SCHNApps/src/dialogs/pluginsViewDialog.cpp
View file @
4bbd6fba
...
...
@@ -46,12 +46,14 @@ void PluginsViewDialog::cb_selectedPluginsChanged()
if
(
pluginList
->
item
(
i
)
->
isSelected
()
&&
!
m_view
->
isLinkedToPlugin
(
plugin
))
{
assert
(
!
plugin
->
isLinkedToView
(
m_view
));
std
::
cout
<<
"link view : "
<<
m_view
->
getName
().
toUtf8
().
constData
()
<<
" to plugin : "
<<
plugin
->
getName
().
toUtf8
().
constData
()
<<
std
::
endl
;
m_view
->
linkPlugin
(
plugin
);
plugin
->
linkView
(
m_view
);
}
else
if
(
!
pluginList
->
item
(
i
)
->
isSelected
()
&&
m_view
->
isLinkedToPlugin
(
plugin
))
{
assert
(
plugin
->
isLinkedToView
(
m_view
));
std
::
cout
<<
"unlink view : "
<<
m_view
->
getName
().
toUtf8
().
constData
()
<<
" from plugin : "
<<
plugin
->
getName
().
toUtf8
().
constData
()
<<
std
::
endl
;
m_view
->
unlinkPlugin
(
plugin
);
plugin
->
unlinkView
(
m_view
);
}
...
...
SCHNApps/src/window.cpp
View file @
4bbd6fba
...
...
@@ -165,86 +165,44 @@ bool Window::addMenuAction(const QString& menuPath, QAction* action)
// for every extracted substring
unsigned
int
i
=
0
;
QMenu
*
lastMenu
;
QAction
*
lastAction
;
QMenu
*
lastMenu
=
NULL
;
foreach
(
QString
step
,
stepNames
)
{
++
i
;
bool
newMenu
=
true
;
// if not last substring (= menu)
if
(
i
<
nbStep
)
if
(
i
<
nbStep
)
// if not last substring (= menu)
{
// if first substring
if
(
i
==
1
)
// try to find an existing submenu with step name
bool
found
=
false
;
QList
<
QAction
*>
actions
;
if
(
i
==
1
)
actions
=
menubar
->
actions
();
else
actions
=
lastMenu
->
actions
();
foreach
(
QAction
*
action
,
actions
)
{
// checking if it's an existing menu or not
QList
<
QAction
*>
actions
=
menubar
->
actions
();
foreach
(
QAction
*
action
,
actions
)
QMenu
*
submenu
=
action
->
menu
();
if
(
submenu
&&
submenu
->
title
()
==
step
)
{
if
(
action
->
menu
()
->
title
()
==
step
)
{
lastAction
=
action
;
newMenu
=
false
;
break
;
}
}
// if new menu: adding it to menubar
if
(
newMenu
)
{
lastMenu
=
menubar
->
addMenu
(
step
);
lastMenu
->
setParent
(
menubar
);
}
// if not: next operation in the already existing corresponding menu
else
{
lastMenu
=
lastAction
->
menu
();
// setting the parent will be useful for the deleting function
lastMenu
->
setParent
(
menubar
);
lastMenu
=
submenu
;
found
=
true
;
break
;
}
}
// if not first substring
else
if
(
!
found
)
{
// same thing: except not operating on the menubar
QList
<
QAction
*>
actions
=
lastMenu
->
actions
();
foreach
(
QAction
*
action
,
actions
)
{
if
(
action
->
menu
()
->
title
()
==
step
)
{
lastAction
=
action
;
newMenu
=
false
;
break
;
}
}
if
(
newMenu
)
{
QMenu
*
tmp
=
lastMenu
;
lastMenu
=
lastMenu
->
addMenu
(
step
);
// setting the parent will be useful for the deleting function
lastMenu
->
setParent
(
tmp
);
}
else
{
QMenu
*
tmp
=
lastMenu
;
lastMenu
=
lastAction
->
menu
();
// setting the parent will be useful for the deleting function
lastMenu
->
setParent
(
tmp
);
}
QMenu
*
newMenu
;
if
(
i
==
1
)
newMenu
=
menubar
->
addMenu
(
step
);
else
newMenu
=
lastMenu
->
addMenu
(
step
);
newMenu
->
setParent
(
lastMenu
);
lastMenu
=
newMenu
;
}
}
// if last substring (= action name)
else
else
// if last substring (= action name)
{
// adding it to the corresponding menu
lastMenu
->
addAction
(
action
);
action
->
setText
(
step
);
// setting the parent will be useful for the deleting function
action
->
setParent
(
lastMenu
);
break
;
}
}
// success
return
true
;
}
...
...
@@ -257,30 +215,18 @@ void Window::removeMenuAction(QAction *action)
// which is an instance of QMenu if the action was created
// using the addMenuActionMethod()
QObject
*
parent
=
action
->
parent
();
// deleting action
delete
action
;
//if parent is an instance of QMenu
if
(
parent
->
inherits
(
"QMenu"
))
while
(
parent
!=
NULL
)
{
// for this menu and all of its parent that are instance of QMenu
// that are also fit for deleting
while
(
parent
!=
NULL
)
QMenu
*
parentMenu
=
dynamic_cast
<
QMenu
*>
(
parent
);
if
(
parentMenu
&&
parentMenu
->
actions
().
empty
())
{
QMenu
*
menuParent
=
(
QMenu
*
)(
parent
);
parent
=
parent
->
parent
();
// if the menu doesn't have any other actions/menus
// it is deleted
if
(
menuParent
->
actions
().
empty
())
delete
menuParent
;
// otherwise: end function
else
break
;
if
(
!
parent
->
inherits
(
"QMenu"
))
parent
=
NULL
;
delete
parentMenu
;
}
else
parent
=
NULL
;
}
}
}
...
...
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