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
KennethVanhoey
CGoGN
Commits
4b478c61
Commit
4b478c61
authored
Jan 23, 2013
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert subdivideSurface Plugin from dockTab to Dialog
parent
0f2569ca
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
452 additions
and
307 deletions
+452
-307
SCHNApps/CMakeLists.txt
SCHNApps/CMakeLists.txt
+9
-20
SCHNApps/Plugins/differentialProperties/include/differentialProperties.h
...s/differentialProperties/include/differentialProperties.h
+2
-2
SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp
...ins/differentialProperties/src/differentialProperties.cpp
+7
-6
SCHNApps/Plugins/importSurface/importSurface.cpp
SCHNApps/Plugins/importSurface/importSurface.cpp
+8
-4
SCHNApps/Plugins/importSurface/importSurface.h
SCHNApps/Plugins/importSurface/importSurface.h
+2
-1
SCHNApps/Plugins/render/render.ui
SCHNApps/Plugins/render/render.ui
+1
-1
SCHNApps/Plugins/subdivideSurface/CMakeLists.txt
SCHNApps/Plugins/subdivideSurface/CMakeLists.txt
+6
-4
SCHNApps/Plugins/subdivideSurface/forms/subdivideSurfaceDialog.ui
.../Plugins/subdivideSurface/forms/subdivideSurfaceDialog.ui
+95
-0
SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h
SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h
+12
-17
SCHNApps/Plugins/subdivideSurface/include/subdivideSurfaceDialog.h
...Plugins/subdivideSurface/include/subdivideSurfaceDialog.h
+33
-0
SCHNApps/Plugins/subdivideSurface/src/subdivideSurface.cpp
SCHNApps/Plugins/subdivideSurface/src/subdivideSurface.cpp
+78
-0
SCHNApps/Plugins/subdivideSurface/src/subdivideSurfaceDialog.cpp
...s/Plugins/subdivideSurface/src/subdivideSurfaceDialog.cpp
+61
-0
SCHNApps/Plugins/subdivideSurface/subdivideSurface.cpp
SCHNApps/Plugins/subdivideSurface/subdivideSurface.cpp
+0
-150
SCHNApps/Release/CMakeLists.txt
SCHNApps/Release/CMakeLists.txt
+0
-4
SCHNApps/forms/window.ui
SCHNApps/forms/window.ui
+7
-1
SCHNApps/include/mapHandler.h
SCHNApps/include/mapHandler.h
+2
-0
SCHNApps/include/plugin.h
SCHNApps/include/plugin.h
+1
-1
SCHNApps/include/view.h
SCHNApps/include/view.h
+4
-0
SCHNApps/include/window.h
SCHNApps/include/window.h
+31
-53
SCHNApps/src/dialogs/cameraViewDialog.cpp
SCHNApps/src/dialogs/cameraViewDialog.cpp
+1
-3
SCHNApps/src/dialogs/mapsViewDialog.cpp
SCHNApps/src/dialogs/mapsViewDialog.cpp
+2
-4
SCHNApps/src/dialogs/pluginsViewDialog.cpp
SCHNApps/src/dialogs/pluginsViewDialog.cpp
+2
-4
SCHNApps/src/main.cpp
SCHNApps/src/main.cpp
+13
-7
SCHNApps/src/plugin.cpp
SCHNApps/src/plugin.cpp
+1
-4
SCHNApps/src/window.cpp
SCHNApps/src/window.cpp
+54
-16
apps_cmake.txt
apps_cmake.txt
+20
-5
No files found.
SCHNApps/CMakeLists.txt
View file @
4b478c61
...
...
@@ -14,17 +14,6 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
SET
(
CGoGN_ROOT_DIR
${
CMAKE_SOURCE_DIR
}
/.. CACHE STRING
"CGoGN root dir"
)
INCLUDE
(
${
CGoGN_ROOT_DIR
}
/apps_cmake.txt
)
find_package
(
Qt4 REQUIRED
)
#=======QGLViewer=========#
find_package
(
QGLViewer REQUIRED
)
#=======Python=========#
find_package
(
PythonLibs REQUIRED
)
#======SCHNApps=======#
SET
(
SCHNApps_ROOT_DIR
${
CGoGN_ROOT_DIR
}
/SCHNApps
)
...
...
@@ -38,12 +27,12 @@ ENDIF (NOT WIN32)
#======Documentation=======#
find_package
(
Doxygen
)
if
(
DOXYGEN_FOUND
)
configure_file
(
${
CMAKE_SOURCE_DIR
}
/doc/Doxyfile.in
${
CMAKE_CURRENT_BINARY_DIR
}
/Doxyfile @ONLY
)
add_custom_target
(
doc
${
DOXYGEN_EXECUTABLE
}
${
CMAKE_CURRENT_BINARY_DIR
}
/Doxyfile
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/Doc
COMMENT
"Generating API documentation with Doxygen"
VERBATIM
)
endif
(
DOXYGEN_FOUND
)
#
find_package(Doxygen)
#
if(DOXYGEN_FOUND)
#
configure_file(${CMAKE_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
#
add_custom_target(doc
#
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
#
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/Doc
#
COMMENT "Generating API documentation with Doxygen" VERBATIM
#
)
#
endif(DOXYGEN_FOUND)
SCHNApps/Plugins/differentialProperties/include/differentialProperties.h
View file @
4b478c61
...
...
@@ -55,8 +55,8 @@ private:
ComputeNormalDialog
*
m_computeNormalDialog
;
ComputeCurvatureDialog
*
m_computeCurvatureDialog
;
QAction
*
computeNormalAction
;
QAction
*
computeCurvatureAction
;
QAction
*
m_
computeNormalAction
;
QAction
*
m_
computeCurvatureAction
;
};
#endif
SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp
View file @
4b478c61
...
...
@@ -11,14 +11,14 @@ bool DifferentialPropertiesPlugin::enable()
m_computeNormalDialog
=
new
ComputeNormalDialog
(
m_window
);
m_computeCurvatureDialog
=
new
ComputeCurvatureDialog
(
m_window
);
computeNormalAction
=
new
QAction
(
"Compute Normal"
,
this
);
computeCurvatureAction
=
new
QAction
(
"Compute Curvature"
,
this
);
m_
computeNormalAction
=
new
QAction
(
"Compute Normal"
,
this
);
m_
computeCurvatureAction
=
new
QAction
(
"Compute Curvature"
,
this
);
addMenuAction
(
"Surface;Differential Properties;Compute Normal"
,
computeNormalAction
);
addMenuAction
(
"Surface;Differential Properties;Compute Curvature"
,
computeCurvatureAction
);
addMenuAction
(
"Surface;Differential Properties;Compute Normal"
,
m_
computeNormalAction
);
addMenuAction
(
"Surface;Differential Properties;Compute Curvature"
,
m_
computeCurvatureAction
);
connect
(
computeNormalAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cb_openComputeNormalDialog
()));
connect
(
computeCurvatureAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cb_openComputeCurvatureDialog
()));
connect
(
m_
computeNormalAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cb_openComputeNormalDialog
()));
connect
(
m_
computeCurvatureAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cb_openComputeCurvatureDialog
()));
connect
(
m_computeNormalDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
cb_computeNormal
()));
connect
(
m_computeNormalDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_computeNormal
()));
...
...
@@ -56,6 +56,7 @@ void DifferentialPropertiesPlugin::cb_computeNormal()
normalName
=
m_computeNormalDialog
->
combo_normalAttribute
->
currentText
().
toUtf8
().
constData
();
else
normalName
=
m_computeNormalDialog
->
normalAttributeName
->
text
().
toUtf8
().
constData
();
VertexAttribute
<
PFP2
::
VEC3
>
position
=
map
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionName
);
VertexAttribute
<
PFP2
::
VEC3
>
normal
=
map
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
normalName
);
if
(
!
normal
.
isValid
())
...
...
SCHNApps/Plugins/importSurface/importSurface.cpp
View file @
4b478c61
...
...
@@ -11,15 +11,13 @@ bool ImportSurfacePlugin::enable()
{
importAction
=
new
QAction
(
"import"
,
this
);
addMenuAction
(
"Surface;Import"
,
importAction
);
connect
(
importAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cb_
import
()));
connect
(
importAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
import
FromFileDialog
()));
return
true
;
}
void
ImportSurfacePlugin
::
cb_
import
(
)
void
ImportSurfacePlugin
::
import
FromFile
(
const
QString
&
fileName
)
{
QString
fileName
=
QFileDialog
::
getOpenFileName
(
m_window
,
"Import file"
,
m_window
->
getAppPath
(),
"Mesh Files (*.ply *.off *.trian)"
);
QFileInfo
fi
(
fileName
);
if
(
fi
.
exists
())
{
GenericMap
*
m
=
m_window
->
createMap
(
2
);
...
...
@@ -47,6 +45,12 @@ void ImportSurfacePlugin::cb_import()
}
}
void
ImportSurfacePlugin
::
importFromFileDialog
()
{
QString
fileName
=
QFileDialog
::
getOpenFileName
(
m_window
,
"Import file"
,
m_window
->
getAppPath
(),
"Mesh Files (*.ply *.off *.trian)"
);
importFromFile
(
fileName
);
}
#ifndef DEBUG
Q_EXPORT_PLUGIN2
(
ImportSurfacePlugin
,
ImportSurfacePlugin
)
#else
...
...
SCHNApps/Plugins/importSurface/importSurface.h
View file @
4b478c61
...
...
@@ -42,7 +42,8 @@ public:
virtual
void
mapUnlinked
(
View
*
view
,
MapHandlerGen
*
m
)
{}
public
slots
:
void
cb_import
();
void
importFromFile
(
const
QString
&
fileName
);
void
importFromFileDialog
();
private:
QAction
*
importAction
;
...
...
SCHNApps/Plugins/render/render.ui
View file @
4b478c61
...
...
@@ -7,7 +7,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
174
</width>
<height>
5
53
</height>
<height>
5
47
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
SCHNApps/Plugins/subdivideSurface/CMakeLists.txt
View file @
4b478c61
...
...
@@ -2,20 +2,22 @@ cmake_minimum_required(VERSION 2.8)
INCLUDE_DIRECTORIES
(
${
SCHNApps_ROOT_DIR
}
/include
${
SCHNApps_ROOT_DIR
}
/Plugins/subdivideSurface
${
SCHNApps_ROOT_DIR
}
/Plugins/subdivideSurface
/include
${
CMAKE_CURRENT_BINARY_DIR
}
)
SET
(
PLUGIN_SRC
${
SCHNApps_ROOT_DIR
}
/Plugins/subdivideSurface/subdivideSurface.cpp
${
SCHNApps_ROOT_DIR
}
/Plugins/subdivideSurface/src/subdivideSurface.cpp
${
SCHNApps_ROOT_DIR
}
/Plugins/subdivideSurface/src/subdivideSurfaceDialog.cpp
)
SET
(
PLUGIN_H
${
SCHNApps_ROOT_DIR
}
/Plugins/subdivideSurface/subdivideSurface.h
${
SCHNApps_ROOT_DIR
}
/Plugins/subdivideSurface/include/subdivideSurface.h
${
SCHNApps_ROOT_DIR
}
/Plugins/subdivideSurface/include/subdivideSurfaceDialog.h
)
SET
(
PLUGIN_FORM
${
SCHNApps_ROOT_DIR
}
/Plugins/subdivideSurface/subdivideSurface.ui
${
SCHNApps_ROOT_DIR
}
/Plugins/subdivideSurface/
forms/
subdivideSurface
Dialog
.ui
)
IF
(
${
CMAKE_BUILD_TYPE
}
STREQUAL Debug
)
...
...
SCHNApps/Plugins/subdivideSurface/subdivideSurface.ui
→
SCHNApps/Plugins/subdivideSurface/
forms/
subdivideSurface
Dialog
.ui
View file @
4b478c61
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
SubdivideSurface
Widget
</class>
<widget
class=
"Q
Widget
"
name=
"SubdivideSurface
Widget
"
>
<class>
SubdivideSurface
Dialog
</class>
<widget
class=
"Q
Dialog
"
name=
"SubdivideSurface
Dialog
"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
176
</width>
<height>
427
</height>
<width>
314
</width>
<height>
230
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
<string>
Subdivide surface
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
...
...
@@ -22,14 +22,14 @@
<item>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position :
</string>
<string>
Position
attribute
:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"combo_positionAttribute"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"
MinimumExpanding
"
vsizetype=
"Fixed"
>
<sizepolicy
hsizetype=
"
Preferred
"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
...
...
@@ -39,38 +39,54 @@
</layout>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_loopSubdivision"
>
<property
name=
"text"
>
<string>
Loop subdivision
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_CCSubdivision"
>
<property
name=
"text"
>
<string>
Catmull-Clark subdivision
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_trianguleFaces"
>
<property
name=
"text"
>
<string>
Triangule Faces
</string>
</property>
</widget>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QRadioButton"
name=
"radio_Loop"
>
<property
name=
"text"
>
<string>
Loop
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QRadioButton"
name=
"radio_CC"
>
<property
name=
"text"
>
<string>
Catmull-Clark
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QRadioButton"
name=
"radio_trianguleFaces"
>
<property
name=
"text"
>
<string>
Triangule faces
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
156
</width>
<height>
161
</height>
</size>
</property>
</spacer>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<item>
<widget
class=
"QPushButton"
name=
"button_cancel"
>
<property
name=
"text"
>
<string>
Cancel
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_apply"
>
<property
name=
"text"
>
<string>
Apply
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_ok"
>
<property
name=
"text"
>
<string>
OK
</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
...
...
SCHNApps/Plugins/subdivideSurface/subdivideSurface.h
→
SCHNApps/Plugins/subdivideSurface/
include/
subdivideSurface.h
View file @
4b478c61
...
...
@@ -2,20 +2,14 @@
#define _SUBDIVIDESURFACE_PLUGIN_H_
#include "plugin.h"
#include "ui_subdivideSurface.h"
#include "subdivideSurfaceDialog.h"
using
namespace
CGoGN
;
using
namespace
SCHNApps
;
class
SubdivideSurfaceDockTab
:
public
QWidget
,
public
Ui
::
SubdivideSurfaceWidget
{
public:
SubdivideSurfaceDockTab
()
{
setupUi
(
this
);
}
};
class
SubdivideSurfacePlugin
:
public
Plugin
{
Q_OBJECT
...
...
@@ -49,17 +43,18 @@ public:
virtual
void
mapLinked
(
View
*
view
,
MapHandlerGen
*
m
)
{}
virtual
void
mapUnlinked
(
View
*
view
,
MapHandlerGen
*
m
)
{}
protected:
SubdivideSurfaceDockTab
*
m_dockTab
;
public
slots
:
void
cb_addMapToList
(
MapHandlerGen
*
m
);
void
cb_removeMapFromList
(
MapHandlerGen
*
m
);
void
cb_selectedMapChanged
();
void
cb_openSubdivideSurfaceDialog
();
void
cb_subdivideSurface
();
void
loopSubdivision
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
);
void
CCSubdivision
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
);
void
trianguleFaces
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
);
private:
SubdivideSurfaceDialog
*
m_subdivideSurfaceDialog
;
void
cb_loopSubdivision
();
void
cb_CCSubdivision
();
void
cb_trianguleFaces
();
QAction
*
m_subdivideSurfaceAction
;
};
#endif
SCHNApps/Plugins/subdivideSurface/include/subdivideSurfaceDialog.h
0 → 100644
View file @
4b478c61
#ifndef _SUBDIVIDESURFACE_DIALOG_H_
#define _SUBDIVIDESURFACE_DIALOG_H_
#include "ui_subdivideSurfaceDialog.h"
namespace
CGoGN
{
namespace
SCHNApps
{
class
Window
;
class
SubdivideSurfaceDialog
:
public
QDialog
,
public
Ui
::
SubdivideSurfaceDialog
{
Q_OBJECT
public:
SubdivideSurfaceDialog
(
Window
*
w
);
void
init
();
public
slots
:
void
cb_selectedMapChanged
();
private:
Window
*
m_window
;
};
}
// namespace SCHNApps
}
// namespace CGoGN
#endif
SCHNApps/Plugins/subdivideSurface/src/subdivideSurface.cpp
0 → 100644
View file @
4b478c61
#include "subdivideSurface.h"
#include "mapHandler.h"
#include "Algo/Modelisation/subdivision.h"
bool
SubdivideSurfacePlugin
::
enable
()
{
m_subdivideSurfaceDialog
=
new
SubdivideSurfaceDialog
(
m_window
);
m_subdivideSurfaceAction
=
new
QAction
(
"Subdivide surface"
,
this
);
addMenuAction
(
"Surface;Subdivide"
,
m_subdivideSurfaceAction
);
connect
(
m_subdivideSurfaceAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cb_openSubdivideSurfaceDialog
()));
connect
(
m_subdivideSurfaceDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
cb_subdivideSurface
()));
connect
(
m_subdivideSurfaceDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_subdivideSurface
()));
return
true
;
}
void
SubdivideSurfacePlugin
::
cb_openSubdivideSurfaceDialog
()
{
m_subdivideSurfaceDialog
->
init
();
m_subdivideSurfaceDialog
->
show
();
}
void
SubdivideSurfacePlugin
::
cb_subdivideSurface
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_subdivideSurfaceDialog
->
mapList
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_window
->
getMap
(
mapname
));
PFP2
::
MAP
*
map
=
mh
->
getMap
();
std
::
string
positionName
=
m_subdivideSurfaceDialog
->
combo_positionAttribute
->
currentText
().
toUtf8
().
constData
();
VertexAttribute
<
PFP2
::
VEC3
>
position
=
map
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionName
);
if
(
m_subdivideSurfaceDialog
->
radio_Loop
->
isChecked
())
loopSubdivision
(
map
,
position
);
else
if
(
m_subdivideSurfaceDialog
->
radio_CC
->
isChecked
())
CCSubdivision
(
map
,
position
);
else
if
(
m_subdivideSurfaceDialog
->
radio_trianguleFaces
->
isChecked
())
trianguleFaces
(
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
=
mh
->
getLinkedViews
();
foreach
(
View
*
view
,
views
)
view
->
updateGL
();
}
}
void
SubdivideSurfacePlugin
::
loopSubdivision
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
)
{
Algo
::
Surface
::
Modelisation
::
LoopSubdivision
<
PFP2
>
(
*
map
,
position
);
}
void
SubdivideSurfacePlugin
::
CCSubdivision
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
)
{
Algo
::
Surface
::
Modelisation
::
CatmullClarkSubdivision
<
PFP2
>
(
*
map
,
position
);
}
void
SubdivideSurfacePlugin
::
trianguleFaces
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
)
{
Algo
::
Surface
::
Modelisation
::
trianguleFaces
<
PFP2
>
(
*
map
,
position
);
}
#ifndef DEBUG
Q_EXPORT_PLUGIN2
(
SubdivideSurfacePlugin
,
SubdivideSurfacePlugin
)
#else
Q_EXPORT_PLUGIN2
(
SubdivideSurfacePluginD
,
SubdivideSurfacePlugin
)
#endif
SCHNApps/Plugins/subdivideSurface/src/subdivideSurfaceDialog.cpp
0 → 100644
View file @
4b478c61
#include "subdivideSurfaceDialog.h"
#include "subdivideSurface.h"
#include "window.h"
#include "mapHandler.h"
namespace
CGoGN
{
namespace
SCHNApps
{
SubdivideSurfaceDialog
::
SubdivideSurfaceDialog
(
Window
*
w
)
:
m_window
(
w
)
{
setupUi
(
this
);
connect
(
mapList
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
cb_selectedMapChanged
()));
}
void
SubdivideSurfaceDialog
::
init
()
{
mapList
->
clear
();
combo_positionAttribute
->
clear
();
const
QList
<
MapHandlerGen
*>&
maps
=
m_window
->
getMapsList
();
foreach
(
MapHandlerGen
*
map
,
maps
)
mapList
->
addItem
(
map
->
getName
());
}
void
SubdivideSurfaceDialog
::
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
;
std
::
vector
<
std
::
string
>
types
;
cont
.
getAttributesNames
(
names
);
cont
.
getAttributesTypes
(
types
);
std
::
string
vec3TypeName
=
nameOfType
(
PFP2
::
VEC3
());
unsigned
int
j
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
names
.
size
();
++
i
)
{
if
(
types
[
i
]
==
vec3TypeName
)
{
combo_positionAttribute
->
addItem
(
QString
::
fromStdString
(
names
[
i
]));
if
(
names
[
i
]
==
"position"
)
// try to select a position attribute named "position"
combo_positionAttribute
->
setCurrentIndex
(
j
);
++
j
;
}
}
}
}
}
// namespace SCHNApps
}
// namespace CGoGN
SCHNApps/Plugins/subdivideSurface/subdivideSurface.cpp
deleted
100644 → 0
View file @
0f2569ca
#include "subdivideSurface.h"
#include "mapHandler.h"
#include "Algo/Modelisation/subdivision.h"
bool
SubdivideSurfacePlugin
::
enable
()
{
m_dockTab
=
new
SubdivideSurfaceDockTab
();
addTabInDock
(
m_dockTab
,
"SubdivideSurface"
);
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
()));
connect
(
m_dockTab
->
button_loopSubdivision
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_loopSubdivision
()));
connect
(
m_dockTab
->
button_CCSubdivision
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_CCSubdivision
()));
QList
<
MapHandlerGen
*>
maps
=
m_window
->
getMapsList
();
foreach
(
MapHandlerGen
*
m
,
maps
)
m_dockTab
->
mapList
->
addItem
(
m
->
getName
());
return
true
;
}
void
SubdivideSurfacePlugin
::
cb_addMapToList
(
MapHandlerGen
*
m
)
{
m_dockTab
->
mapList
->
addItem
(
m
->
getName
());
}
void
SubdivideSurfacePlugin
::
cb_removeMapFromList
(
MapHandlerGen
*
m
)
{
for
(
int
i
=
0
;
i
<
m_dockTab
->
mapList
->
count
();
++
i
)
{
if
(
m_dockTab
->
mapList
->
item
(
i
)
->
text
()
==
m
->
getName
())
{
delete
m_dockTab
->
mapList
->
item
(
i
);
return
;
}
}
}
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
=
nameOfType
(
PFP2
::
VEC3
());
unsigned
int
j
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
names
.
size
();
++
i
)
{
if
(
types
[
i
]
==
vec3TypeName
)
{
m_dockTab
->
combo_positionAttribute
->
addItem
(
QString
::
fromStdString
(
names
[
i
]));
if
(
names
[
i
]
==
"position"
)
// try to select an attribute named "position"
m_dockTab
->
combo_positionAttribute
->
setCurrentIndex
(
j
);
++
j
;
}
}
}
}
void
SubdivideSurfacePlugin
::
cb_loopSubdivision
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_dockTab
->
mapList
->
selectedItems
();
if
(
!
currentItems
.
empty
())