Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
4266a0c6
Commit
4266a0c6
authored
Sep 02, 2013
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add plugin surface_differentialProperties
parent
79d7fc0c
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
134 additions
and
164 deletions
+134
-164
README.TXT
README.TXT
+1
-1
SCHNApps/Plugins/CMakeLists.txt
SCHNApps/Plugins/CMakeLists.txt
+1
-0
SCHNApps/Plugins/surface_differentialProperties/CMakeLists.txt
...pps/Plugins/surface_differentialProperties/CMakeLists.txt
+4
-4
SCHNApps/Plugins/surface_differentialProperties/forms/dialog_computeCurvature.ui
...e_differentialProperties/forms/dialog_computeCurvature.ui
+5
-5
SCHNApps/Plugins/surface_differentialProperties/forms/dialog_computeNormal.ui
...face_differentialProperties/forms/dialog_computeNormal.ui
+5
-5
SCHNApps/Plugins/surface_differentialProperties/include/dialog_computeCurvature.h
..._differentialProperties/include/dialog_computeCurvature.h
+7
-7
SCHNApps/Plugins/surface_differentialProperties/include/dialog_computeNormal.h
...ace_differentialProperties/include/dialog_computeNormal.h
+7
-7
SCHNApps/Plugins/surface_differentialProperties/include/surface_differentialProperties.h
...entialProperties/include/surface_differentialProperties.h
+21
-26
SCHNApps/Plugins/surface_differentialProperties/src/dialog_computeCurvature.cpp
...ce_differentialProperties/src/dialog_computeCurvature.cpp
+20
-40
SCHNApps/Plugins/surface_differentialProperties/src/dialog_computeNormal.cpp
...rface_differentialProperties/src/dialog_computeNormal.cpp
+20
-26
SCHNApps/Plugins/surface_differentialProperties/src/surface_differentialProperties.cpp
...erentialProperties/src/surface_differentialProperties.cpp
+33
-33
SCHNApps/Plugins/surface_import/include/surface_import.h
SCHNApps/Plugins/surface_import/include/surface_import.h
+5
-5
SCHNApps/Plugins/surface_import/src/surface_import.cpp
SCHNApps/Plugins/surface_import/src/surface_import.cpp
+5
-5
No files found.
README.TXT
View file @
4266a0c6
...
...
@@ -80,7 +80,7 @@ To compile CGoGN:
WITH_QT (T)
-> to minimize dependencies and compilation time
FORCE_MR (
1
)
FORCE_MR (
0
)
-> allows the compilation in 2 modes: mono-resolution(0), multi-resolution(1)
ONELIB (F)
...
...
SCHNApps/Plugins/CMakeLists.txt
View file @
4266a0c6
...
...
@@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 2.8)
ADD_SUBDIRECTORY
(
surface_import
)
ADD_SUBDIRECTORY
(
surface_render
)
ADD_SUBDIRECTORY
(
surface_differentialProperties
)
SCHNApps/Plugins/surface_differentialProperties/CMakeLists.txt
View file @
4266a0c6
...
...
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8)
SET
(
PLUGIN_NAME DifferentialProperties
)
SET
(
PLUGIN_ROOT_DIR
${
SCHNApps_ROOT_DIR
}
/Plugins/differentialProperties
)
SET
(
PLUGIN_ROOT_DIR
${
SCHNApps_ROOT_DIR
}
/Plugins/
surface_
differentialProperties
)
INCLUDE_DIRECTORIES
(
${
PLUGIN_ROOT_DIR
}
/include
...
...
@@ -25,9 +25,9 @@ file(
SET
(
PLUGIN_QOBJECT_FILES
${
PLUGIN_ROOT_DIR
}
/include/differentialProperties.h
${
PLUGIN_ROOT_DIR
}
/include/
computeNormalDialog
.h
${
PLUGIN_ROOT_DIR
}
/include/
computeCurvatureDialog
.h
${
PLUGIN_ROOT_DIR
}
/include/
surface_
differentialProperties.h
${
PLUGIN_ROOT_DIR
}
/include/
dialog_computeNormal
.h
${
PLUGIN_ROOT_DIR
}
/include/
dialog_computeCurvature
.h
)
include
(
${
SCHNApps_ROOT_DIR
}
/Plugins/plugins_cmake.txt
)
SCHNApps/Plugins/surface_differentialProperties/forms/
computeCurvatureDialog
.ui
→
SCHNApps/Plugins/surface_differentialProperties/forms/
dialog_computeCurvature
.ui
View file @
4266a0c6
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
ComputeCurvatureDialog
</class>
<widget
class=
"QDialog"
name=
"
ComputeCurvatureDialog
"
>
<class>
Dialog_ComputeCurvature
</class>
<widget
class=
"QDialog"
name=
"
Dialog_ComputeCurvature
"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
...
...
@@ -15,7 +15,7 @@
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout_2"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QListWidget"
name=
"
mapList
"
/>
<widget
class=
"QListWidget"
name=
"
list_maps
"
/>
</item>
<item
row=
"1"
column=
"0"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
...
...
@@ -321,7 +321,7 @@
<connection>
<sender>
button_ok
</sender>
<signal>
clicked()
</signal>
<receiver>
ComputeCurvatureDialog
</receiver>
<receiver>
Dialog_ComputeCurvature
</receiver>
<slot>
accept()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
...
...
@@ -337,7 +337,7 @@
<connection>
<sender>
button_cancel
</sender>
<signal>
clicked()
</signal>
<receiver>
ComputeCurvatureDialog
</receiver>
<receiver>
Dialog_ComputeCurvature
</receiver>
<slot>
reject()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
...
...
SCHNApps/Plugins/surface_differentialProperties/forms/
computeNormalDialog
.ui
→
SCHNApps/Plugins/surface_differentialProperties/forms/
dialog_computeNormal
.ui
View file @
4266a0c6
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
ComputeNormalDialog
</class>
<widget
class=
"QDialog"
name=
"
ComputeNormalDialog
"
>
<class>
Dialog_ComputeNormal
</class>
<widget
class=
"QDialog"
name=
"
Dialog_ComputeNormal
"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
...
...
@@ -15,7 +15,7 @@
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<item>
<widget
class=
"QListWidget"
name=
"
mapList
"
/>
<widget
class=
"QListWidget"
name=
"
list_maps
"
/>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
...
...
@@ -110,7 +110,7 @@
<connection>
<sender>
button_ok
</sender>
<signal>
clicked()
</signal>
<receiver>
ComputeNormalDialog
</receiver>
<receiver>
Dialog_ComputeNormal
</receiver>
<slot>
accept()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
...
...
@@ -126,7 +126,7 @@
<connection>
<sender>
button_cancel
</sender>
<signal>
clicked()
</signal>
<receiver>
ComputeNormalDialog
</receiver>
<receiver>
Dialog_ComputeNormal
</receiver>
<slot>
reject()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
...
...
SCHNApps/Plugins/surface_differentialProperties/include/
computeCurvatureDialog
.h
→
SCHNApps/Plugins/surface_differentialProperties/include/
dialog_computeCurvature
.h
View file @
4266a0c6
#ifndef _
COMPUTECURVATURE_DIALOG
_H_
#define _
COMPUTECURVATURE_DIALOG
_H_
#ifndef _
DIALOG_COMPUTECURVATURE
_H_
#define _
DIALOG_COMPUTECURVATURE
_H_
#include "ui_
computeCurvatureDialog
.h"
#include "ui_
dialog_computeCurvature
.h"
namespace
CGoGN
{
...
...
@@ -9,18 +9,18 @@ namespace CGoGN
namespace
SCHNApps
{
class
Window
;
class
SCHNApps
;
class
MapHandlerGen
;
class
ComputeCurvatureDialog
:
public
QDialog
,
public
Ui
::
ComputeCurvatureDialog
class
Dialog_ComputeCurvature
:
public
QDialog
,
public
Ui
::
Dialog_ComputeCurvature
{
Q_OBJECT
public:
ComputeCurvatureDialog
(
Window
*
w
);
Dialog_ComputeCurvature
(
SCHNApps
*
s
);
private:
Window
*
m_window
;
SCHNApps
*
m_schnapps
;
MapHandlerGen
*
m_selectedMap
;
public
slots
:
...
...
SCHNApps/Plugins/surface_differentialProperties/include/
computeNormalDialog
.h
→
SCHNApps/Plugins/surface_differentialProperties/include/
dialog_computeNormal
.h
View file @
4266a0c6
#ifndef _
COMPUTENORMAL_DIALOG
_H_
#define _
COMPUTENORMAL_DIALOG
_H_
#ifndef _
DIALOG_COMPUTENORMAL
_H_
#define _
DIALOG_COMPUTENORMAL
_H_
#include "ui_
computeNormalDialog
.h"
#include "ui_
dialog_computeNormal
.h"
namespace
CGoGN
{
...
...
@@ -9,18 +9,18 @@ namespace CGoGN
namespace
SCHNApps
{
class
Window
;
class
SCHNApps
;
class
MapHandlerGen
;
class
ComputeNormalDialog
:
public
QDialog
,
public
Ui
::
ComputeNormalDialog
class
Dialog_ComputeNormal
:
public
QDialog
,
public
Ui
::
Dialog_ComputeNormal
{
Q_OBJECT
public:
ComputeNormalDialog
(
Window
*
w
);
Dialog_ComputeNormal
(
SCHNApps
*
s
);
private:
Window
*
m_window
;
SCHNApps
*
m_schnapps
;
MapHandlerGen
*
m_selectedMap
;
public
slots
:
...
...
SCHNApps/Plugins/surface_differentialProperties/include/differentialProperties.h
→
SCHNApps/Plugins/surface_differentialProperties/include/
surface_
differentialProperties.h
View file @
4266a0c6
#ifndef _DIFFERENTIALPROPERTIES_PLUGIN_H_
#define _DIFFERENTIALPROPERTIES_PLUGIN_H_
#ifndef _
SURFACE_
DIFFERENTIALPROPERTIES_PLUGIN_H_
#define _
SURFACE_
DIFFERENTIALPROPERTIES_PLUGIN_H_
#include "plugin.h"
#include "plugin
_processing
.h"
#include "
computeNormalDialog
.h"
#include "
computeCurvatureDialog
.h"
#include "
dialog_computeNormal
.h"
#include "
dialog_computeCurvature
.h"
namespace
CGoGN
{
using
namespace
CGoGN
;
using
namespace
SCHNApps
;
namespace
SCHNApps
{
class
DifferentialPropertiesPlugin
:
public
Plugin
class
Surface_DifferentialProperties_Plugin
:
public
PluginProcessing
{
Q_OBJECT
Q_INTERFACES
(
CGoGN
::
SCHNApps
::
Plugin
)
public:
DifferentialPropertiesPlugin
()
{
setProvidesRendering
(
false
);
}
Surface_DifferentialProperties_Plugin
()
{}
~
DifferentialProperties
Plugin
()
~
Surface_DifferentialProperties_
Plugin
()
{}
virtual
bool
enable
();
virtual
void
disable
()
{}
virtual
void
redraw
(
View
*
view
)
{}
virtual
void
keyPress
(
View
*
view
,
QKeyEvent
*
event
)
{}
virtual
void
keyRelease
(
View
*
view
,
QKeyEvent
*
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
)
{}
public
slots
:
private
slots
:
void
mapAdded
(
MapHandlerGen
*
map
);
void
mapRemoved
(
MapHandlerGen
*
map
);
void
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
);
...
...
@@ -48,6 +38,7 @@ public slots:
void
computeNormalFromDialog
();
void
computeCurvatureFromDialog
();
public
slots
:
void
computeNormal
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
,
const
QString
&
normalAttributeName
=
"normal"
,
...
...
@@ -68,8 +59,8 @@ public slots:
);
private:
ComputeNormalDialog
*
m_computeNormalDialog
;
ComputeCurvatureDialog
*
m_computeCurvatureDialog
;
Dialog_ComputeNormal
*
m_computeNormalDialog
;
Dialog_ComputeCurvature
*
m_computeCurvatureDialog
;
QAction
*
m_computeNormalAction
;
QAction
*
m_computeCurvatureAction
;
...
...
@@ -111,4 +102,8 @@ private:
QHash
<
QString
,
ComputeCurvatureParameters
>
computeCurvatureLastParameters
;
};
}
// namespace SCHNApps
}
// namespace CGoGN
#endif
SCHNApps/Plugins/surface_differentialProperties/src/
computeCurvatureDialog
.cpp
→
SCHNApps/Plugins/surface_differentialProperties/src/
dialog_computeCurvature
.cpp
View file @
4266a0c6
#include "
computeCurvatureDialog
.h"
#include "
dialog_computeCurvature
.h"
#include "differentialProperties.h"
#include "
window
.h"
#include "
surface_
differentialProperties.h"
#include "
schnapps
.h"
#include "mapHandler.h"
namespace
CGoGN
...
...
@@ -10,8 +10,8 @@ namespace CGoGN
namespace
SCHNApps
{
ComputeCurvatureDialog
::
ComputeCurvatureDialog
(
Window
*
w
)
:
m_
window
(
w
),
Dialog_ComputeCurvature
::
Dialog_ComputeCurvature
(
SCHNApps
*
s
)
:
m_
schnapps
(
s
),
m_selectedMap
(
NULL
)
{
setupUi
(
this
);
...
...
@@ -22,25 +22,24 @@ ComputeCurvatureDialog::ComputeCurvatureDialog(Window* w) :
kminAttributeName
->
setText
(
"kmin"
);
KnormalAttributeName
->
setText
(
"Knormal"
);
connect
(
m_
window
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
addMapToList
(
MapHandlerGen
*
)));
connect
(
m_
window
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
removeMapFromList
(
MapHandlerGen
*
)));
connect
(
m_
schnapps
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
addMapToList
(
MapHandlerGen
*
)));
connect
(
m_
schnapps
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
removeMapFromList
(
MapHandlerGen
*
)));
connect
(
mapList
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
selectedMapChanged
()));
connect
(
list_maps
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
selectedMapChanged
()));
const
QList
<
MapHandlerGen
*>&
maps
=
m_window
->
getMapsList
();
foreach
(
MapHandlerGen
*
map
,
maps
)
foreach
(
MapHandlerGen
*
map
,
m_schnapps
->
getMapSet
().
values
())
{
QListWidgetItem
*
item
=
new
QListWidgetItem
(
map
->
getName
(),
mapList
);
QListWidgetItem
*
item
=
new
QListWidgetItem
(
map
->
getName
(),
list_maps
);
item
->
setCheckState
(
Qt
::
Unchecked
);
}
}
void
ComputeCurvatureDialog
::
selectedMapChanged
()
void
Dialog_ComputeCurvature
::
selectedMapChanged
()
{
if
(
m_selectedMap
)
disconnect
(
m_selectedMap
,
SIGNAL
(
attributeAdded
(
unsigned
int
,
const
QString
&
)),
this
,
SLOT
(
addAttributeToList
(
unsigned
int
,
const
QString
&
)));
QList
<
QListWidgetItem
*>
currentItems
=
mapList
->
selectedItems
();
QList
<
QListWidgetItem
*>
currentItems
=
list_maps
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
combo_positionAttribute
->
clear
();
...
...
@@ -52,49 +51,30 @@ void ComputeCurvatureDialog::selectedMapChanged()
combo_kminAttribute
->
clear
();
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandlerGen
*
mh
=
m_
window
->
getMap
(
mapname
);
MapHandlerGen
*
mh
=
m_
schnapps
->
getMap
(
mapname
);
QString
vec3TypeName
=
QString
::
fromStdString
(
nameOfType
(
PFP2
::
VEC3
()));
QString
realTypeName
=
QString
::
fromStdString
(
nameOfType
(
PFP2
::
REAL
()));
unsigned
int
j
=
0
;
unsigned
int
k
=
0
;
const
Attribute
Hash
&
attribs
=
mh
->
getAttributesLis
t
(
VERTEX
);
for
(
Attribute
Hash
::
const_iterator
i
=
attribs
.
constBegin
();
i
!=
attribs
.
constEnd
();
++
i
)
const
Attribute
Set
&
attribs
=
mh
->
getAttributeSe
t
(
VERTEX
);
for
(
Attribute
Set
::
const_iterator
i
=
attribs
.
constBegin
();
i
!=
attribs
.
constEnd
();
++
i
)
{
if
(
i
.
value
()
==
vec3TypeName
)
{
combo_positionAttribute
->
addItem
(
i
.
key
());
if
(
i
.
key
()
==
"position"
)
// try to select a position attribute named "position"
combo_positionAttribute
->
setCurrentIndex
(
j
);
combo_normalAttribute
->
addItem
(
i
.
key
());
if
(
i
.
key
()
==
"normal"
)
// try to select a normal attribute named "normal"
combo_normalAttribute
->
setCurrentIndex
(
j
);
combo_KmaxAttribute
->
addItem
(
i
.
key
());
if
(
i
.
key
()
==
"Kmax"
)
// try to select a normal attribute named "Kmax"
combo_KmaxAttribute
->
setCurrentIndex
(
j
);
combo_KminAttribute
->
addItem
(
i
.
key
());
if
(
i
.
key
()
==
"Kmin"
)
// try to select a normal attribute named "Kmin"
combo_KminAttribute
->
setCurrentIndex
(
j
);
combo_KnormalAttribute
->
addItem
(
i
.
key
());
if
(
i
.
key
()
==
"Knormal"
)
// try to select a normal attribute named "Knormal"
combo_KnormalAttribute
->
setCurrentIndex
(
j
);
++
j
;
}
else
if
(
i
.
value
()
==
realTypeName
)
{
combo_kmaxAttribute
->
addItem
(
i
.
key
());
if
(
i
.
key
()
==
"kmax"
)
// try to select a normal attribute named "kmax"
combo_kmaxAttribute
->
setCurrentIndex
(
k
);
combo_kminAttribute
->
addItem
(
i
.
key
());
if
(
i
.
key
()
==
"kmin"
)
// try to select a normal attribute named "kmin"
combo_kminAttribute
->
setCurrentIndex
(
k
);
++
k
;
}
...
...
@@ -107,15 +87,15 @@ void ComputeCurvatureDialog::selectedMapChanged()
m_selectedMap
=
NULL
;
}
void
ComputeCurvatureDialog
::
addMapToList
(
MapHandlerGen
*
m
)
void
Dialog_ComputeCurvature
::
addMapToList
(
MapHandlerGen
*
m
)
{
QListWidgetItem
*
item
=
new
QListWidgetItem
(
m
->
getName
(),
mapList
);
QListWidgetItem
*
item
=
new
QListWidgetItem
(
m
->
getName
(),
list_maps
);
item
->
setCheckState
(
Qt
::
Unchecked
);
}
void
ComputeCurvatureDialog
::
removeMapFromList
(
MapHandlerGen
*
m
)
void
Dialog_ComputeCurvature
::
removeMapFromList
(
MapHandlerGen
*
m
)
{
QList
<
QListWidgetItem
*>
items
=
mapList
->
findItems
(
m
->
getName
(),
Qt
::
MatchExactly
);
QList
<
QListWidgetItem
*>
items
=
list_maps
->
findItems
(
m
->
getName
(),
Qt
::
MatchExactly
);
if
(
!
items
.
empty
())
delete
items
[
0
];
...
...
@@ -126,7 +106,7 @@ void ComputeCurvatureDialog::removeMapFromList(MapHandlerGen* m)
}
}
void
ComputeCurvatureDialog
::
addAttributeToList
(
unsigned
int
orbit
,
const
QString
&
nameAttr
)
void
Dialog_ComputeCurvature
::
addAttributeToList
(
unsigned
int
orbit
,
const
QString
&
nameAttr
)
{
QString
vec3TypeName
=
QString
::
fromStdString
(
nameOfType
(
PFP2
::
VEC3
()));
QString
realTypeName
=
QString
::
fromStdString
(
nameOfType
(
PFP2
::
REAL
()));
...
...
SCHNApps/Plugins/surface_differentialProperties/src/
computeNormalDialog
.cpp
→
SCHNApps/Plugins/surface_differentialProperties/src/
dialog_computeNormal
.cpp
View file @
4266a0c6
#include "
computeNormalDialog
.h"
#include "
dialog_computeNormal
.h"
#include "differentialProperties.h"
#include "
window
.h"
#include "
surface_
differentialProperties.h"
#include "
schnapps
.h"
#include "mapHandler.h"
namespace
CGoGN
...
...
@@ -10,56 +10,50 @@ namespace CGoGN
namespace
SCHNApps
{
ComputeNormalDialog
::
ComputeNormalDialog
(
Window
*
w
)
:
m_
window
(
w
),
Dialog_ComputeNormal
::
Dialog_ComputeNormal
(
SCHNApps
*
s
)
:
m_
schnapps
(
s
),
m_selectedMap
(
NULL
)
{
setupUi
(
this
);
normalAttributeName
->
setText
(
"normal"
);
connect
(
m_
window
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
addMapToList
(
MapHandlerGen
*
)));
connect
(
m_
window
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
removeMapFromList
(
MapHandlerGen
*
)));
connect
(
m_
schnapps
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
addMapToList
(
MapHandlerGen
*
)));
connect
(
m_
schnapps
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
removeMapFromList
(
MapHandlerGen
*
)));
connect
(
mapList
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
selectedMapChanged
()));
connect
(
list_maps
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
selectedMapChanged
()));
const
QList
<
MapHandlerGen
*>&
maps
=
m_window
->
getMapsList
();
foreach
(
MapHandlerGen
*
map
,
maps
)
foreach
(
MapHandlerGen
*
map
,
m_schnapps
->
getMapSet
().
values
())
{
QListWidgetItem
*
item
=
new
QListWidgetItem
(
map
->
getName
(),
mapList
);
QListWidgetItem
*
item
=
new
QListWidgetItem
(
map
->
getName
(),
list_maps
);
item
->
setCheckState
(
Qt
::
Unchecked
);
}
}
void
ComputeNormalDialog
::
selectedMapChanged
()
void
Dialog_ComputeNormal
::
selectedMapChanged
()
{
if
(
m_selectedMap
)
disconnect
(
m_selectedMap
,
SIGNAL
(
attributeAdded
(
unsigned
int
,
const
QString
&
)),
this
,
SLOT
(
addAttributeToList
(
unsigned
int
,
const
QString
&
)));
QList
<
QListWidgetItem
*>
currentItems
=
mapList
->
selectedItems
();
QList
<
QListWidgetItem
*>
currentItems
=
list_maps
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
combo_positionAttribute
->
clear
();
combo_normalAttribute
->
clear
();
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandlerGen
*
mh
=
m_
window
->
getMap
(
mapname
);
MapHandlerGen
*
mh
=
m_
schnapps
->
getMap
(
mapname
);
QString
vec3TypeName
=
QString
::
fromStdString
(
nameOfType
(
PFP2
::
VEC3
()));
unsigned
int
j
=
0
;
const
Attribute
Hash
&
attribs
=
mh
->
getAttributesLis
t
(
VERTEX
);
for
(
Attribute
Hash
::
const_iterator
i
=
attribs
.
constBegin
();
i
!=
attribs
.
constEnd
();
++
i
)
const
Attribute
Set
&
attribs
=
mh
->
getAttributeSe
t
(
VERTEX
);
for
(
Attribute
Set
::
const_iterator
i
=
attribs
.
constBegin
();
i
!=
attribs
.
constEnd
();
++
i
)
{
if
(
i
.
value
()
==
vec3TypeName
)
{
combo_positionAttribute
->
addItem
(
i
.
key
());
if
(
i
.
key
()
==
"position"
)
// try to select a position attribute named "position"
combo_positionAttribute
->
setCurrentIndex
(
j
);
combo_normalAttribute
->
addItem
(
i
.
key
());
if
(
i
.
key
()
==
"normal"
)
// try to select a normal attribute named "normal"
combo_normalAttribute
->
setCurrentIndex
(
j
);
++
j
;
}
...
...
@@ -72,15 +66,15 @@ void ComputeNormalDialog::selectedMapChanged()
m_selectedMap
=
NULL
;
}
void
ComputeNormalDialog
::
addMapToList
(
MapHandlerGen
*
m
)
void
Dialog_ComputeNormal
::
addMapToList
(
MapHandlerGen
*
m
)
{
QListWidgetItem
*
item
=
new
QListWidgetItem
(
m
->
getName
(),
mapList
);
QListWidgetItem
*
item
=
new
QListWidgetItem
(
m
->
getName
(),
list_maps
);
item
->
setCheckState
(
Qt
::
Unchecked
);
}
void
ComputeNormalDialog
::
removeMapFromList
(
MapHandlerGen
*
m
)
void
Dialog_ComputeNormal
::
removeMapFromList
(
MapHandlerGen
*
m
)
{
QList
<
QListWidgetItem
*>
items
=
mapList
->
findItems
(
m
->
getName
(),
Qt
::
MatchExactly
);
QList
<
QListWidgetItem
*>
items
=
list_maps
->
findItems
(
m
->
getName
(),
Qt
::
MatchExactly
);
if
(
!
items
.
empty
())
delete
items
[
0
];
...
...
@@ -91,7 +85,7 @@ void ComputeNormalDialog::removeMapFromList(MapHandlerGen* m)
}
}
void
ComputeNormalDialog
::
addAttributeToList
(
unsigned
int
orbit
,
const
QString
&
nameAttr
)
void
Dialog_ComputeNormal
::
addAttributeToList
(
unsigned
int
orbit
,
const
QString
&
nameAttr
)
{
QString
vec3TypeName
=
QString
::
fromStdString
(
nameOfType
(
PFP2
::
VEC3
()));
...
...
SCHNApps/Plugins/surface_differentialProperties/src/differentialProperties.cpp
→
SCHNApps/Plugins/surface_differentialProperties/src/
surface_
differentialProperties.cpp
View file @
4266a0c6
#include "differentialProperties.h"
#include "
surface_
differentialProperties.h"
#include "mapHandler.h"
#include "Algo/Geometry/normal.h"
#include "Algo/Geometry/curvature.h"
bool
DifferentialPropertiesPlugin
::
enable
()
namespace
CGoGN
{
m_computeNormalDialog
=
new
ComputeNormalDialog
(
m_window
);
m_computeCurvatureDialog
=
new
ComputeCurvatureDialog
(
m_window
);
namespace
SCHNApps
{
bool
Surface_DifferentialProperties_Plugin
::
enable
()
{
m_computeNormalDialog
=
new
Dialog_ComputeNormal
(
m_schnapps
);
m_computeCurvatureDialog
=
new
Dialog_ComputeCurvature
(
m_schnapps
);
m_computeNormalAction
=
new
QAction
(
"Compute Normal"
,
this
);
m_computeCurvatureAction
=
new
QAction
(
"Compute Curvature"
,
this
);
addMenuAction
(
"Surface;Differential Properties;Compute Normal"
,
m_computeNormalAction
);
addMenuAction
(
"Surface;Differential Properties;Compute Curvature"
,
m_computeCurvatureAction
);
m_schnapps
->
addMenuAction
(
this
,
"Surface;Differential Properties;Compute Normal"
,
m_computeNormalAction
);
m_schnapps
->
addMenuAction
(
this
,
"Surface;Differential Properties;Compute Curvature"
,
m_computeCurvatureAction
);
connect
(
m_computeNormalAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
openComputeNormalDialog
()));
connect
(
m_computeCurvatureAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
openComputeCurvatureDialog
()));
...
...
@@ -25,23 +31,23 @@ bool DifferentialPropertiesPlugin::enable()
connect
(
m_computeCurvatureDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
computeCurvatureFromDialog
()));
connect
(
m_computeCurvatureDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
computeCurvatureFromDialog
()));
connect
(
m_
window
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapAdded
(
MapHandlerGen
*
)));
connect
(
m_
window
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapRemoved
(
MapHandlerGen
*
)));
connect
(
m_
schnapps
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapAdded
(
MapHandlerGen
*
)));
connect
(
m_
schnapps
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapRemoved
(
MapHandlerGen
*
)));
return
true
;
}
void
DifferentialProperties
Plugin
::
mapAdded
(
MapHandlerGen
*
map
)
void
Surface_DifferentialProperties_
Plugin
::
mapAdded
(
MapHandlerGen
*
map
)
{
connect
(
map
,
SIGNAL
(
attributeModified
(
unsigned
int
,
QString
)),
this
,
SLOT
(
attributeModified
(
unsigned
int
,
QString
)));
}
void
DifferentialProperties
Plugin
::
mapRemoved
(
MapHandlerGen
*
map
)
void
Surface_DifferentialProperties_
Plugin
::
mapRemoved
(
MapHandlerGen
*
map
)
{
disconnect
(
map
,
SIGNAL
(
attributeModified
(
unsigned
int
,
QString
)),
this
,
SLOT
(
attributeModified
(
unsigned
int
,
QString
)));
}
void
DifferentialProperties
Plugin
::
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
)
void
Surface_DifferentialProperties_
Plugin
::
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
)
{
if
(
orbit
==
VERTEX
)
{
...
...
@@ -66,19 +72,19 @@ void DifferentialPropertiesPlugin::attributeModified(unsigned int orbit, QString
}
}
void
DifferentialProperties
Plugin
::
openComputeNormalDialog
()
void
Surface_DifferentialProperties_
Plugin
::
openComputeNormalDialog
()
{
m_computeNormalDialog
->
show
();
}
void
DifferentialProperties
Plugin
::
openComputeCurvatureDialog
()
void
Surface_DifferentialProperties_
Plugin
::
openComputeCurvatureDialog
()
{
m_computeCurvatureDialog
->
show
();
}
void
DifferentialProperties
Plugin
::
computeNormalFromDialog
()
void
Surface_DifferentialProperties_
Plugin
::
computeNormalFromDialog
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_computeNormalDialog
->
mapList
->
selectedItems
();
QList
<
QListWidgetItem
*>
currentItems
=
m_computeNormalDialog
->
list_maps
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
const
QString
&
mapName
=
currentItems
[
0
]
->
text
();
...
...
@@ -97,9 +103,9 @@ void DifferentialPropertiesPlugin::computeNormalFromDialog()
}
}
void
DifferentialProperties
Plugin
::
computeCurvatureFromDialog
()
void
Surface_DifferentialProperties_
Plugin
::
computeCurvatureFromDialog
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_computeCurvatureDialog
->
mapList
->
selectedItems
();
QList
<
QListWidgetItem
*>
currentItems
=
m_computeCurvatureDialog
->
list_maps
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
const
QString
&
mapName
=
currentItems
[
0
]
->
text
();
...
...
@@ -151,13 +157,13 @@ void DifferentialPropertiesPlugin::computeCurvatureFromDialog()
}
}
void
DifferentialProperties
Plugin
::
computeNormal
(
void
Surface_DifferentialProperties_
Plugin
::
computeNormal
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
,
const
QString
&
normalAttributeName
,
bool
autoUpdate
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_
window
->
getMap
(
mapName
));
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_
schnapps
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
return
;
...
...
@@ -175,12 +181,10 @@ void DifferentialPropertiesPlugin::computeNormal(
computeNormalLastParameters
[
mapName
]
=
ComputeNormalParameters
(
positionAttributeName
,
normalAttributeName
,
autoUpdate
);
mh
->
createVBO
(
normal
);
mh
->
notifyAttributeModification
(
normal
);
}
void
DifferentialProperties
Plugin
::
computeCurvature
(
void
Surface_DifferentialProperties_
Plugin
::
computeCurvature
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
,
const
QString
&
normalAttributeName
,
...
...
@@ -193,7 +197,7 @@ void DifferentialPropertiesPlugin::computeCurvature(
bool
compute_kgaussian
,
bool
autoUpdate
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_
window
->
getMap
(
mapName
));
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_
schnapps
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
return
;
...
...
@@ -239,12 +243,6 @@ void DifferentialPropertiesPlugin::computeCurvature(
KmaxAttributeName
,
kmaxAttributeName
,
KminAttributeName
,
kminAttributeName
,
KnormalAttributeName
,
compute_kmean
,
compute_kgaussian
,
autoUpdate
);
mh
->
createVBO
(
Kmax
);
mh
->
createVBO
(
kmax
);
mh
->
createVBO
(
Kmin
);
mh
->
createVBO
(
kmin
);
mh
->
createVBO
(
Knormal
);
mh
->
notifyAttributeModification
(
Kmax
);
mh
->
notifyAttributeModification
(
kmax
);
mh
->
notifyAttributeModification
(
Kmin
);
...
...
@@ -260,7 +258,6 @@ void DifferentialPropertiesPlugin::computeCurvature(
for
(
unsigned
int
i
=
kmin
.
begin
();
i
!=
kmin
.
end
();
kmin
.
next
(
i
))
kmean
[
i
]
=
(
kmin
[
i
]
+
kmax
[
i
])
/
2.0
;
mh
->
createVBO
(
kmean
);
mh
->
notifyAttributeModification
(
kmean
);
}
...
...
@@ -273,13 +270,16 @@ void DifferentialPropertiesPlugin::computeCurvature(
for
(
unsigned
int
i
=
kmin
.
begin
();
i
!=
kmin
.
end
();
kmin
.
next
(
i
))
kgaussian
[
i
]
=
kmin
[
i
]
*
kmax
[
i
];
mh
->
createVBO
(
kgaussian
);
mh
->
notifyAttributeModification
(
kgaussian
);
}
}
#ifndef DEBUG
Q_EXPORT_PLUGIN2
(
DifferentialPropertiesPlugin
,
DifferentialProperties
Plugin
)
Q_EXPORT_PLUGIN2
(
Surface_DifferentialProperties_Plugin
,
Surface_DifferentialProperties_
Plugin
)
#else
Q_EXPORT_PLUGIN2
(
DifferentialPropertiesPluginD
,
DifferentialProperties
Plugin
)
Q_EXPORT_PLUGIN2
(
Surface_DifferentialProperties_PluginD
,
Surface_DifferentialProperties_
Plugin
)
#endif
}
// namespace SCHNApps
}
// namespace CGoGN
SCHNApps/Plugins/surface_import/include/surface_import.h