Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
13852a54
Commit
13852a54
authored
Apr 02, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove/duplicate maps in schnapps
parent
b5f3f45d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
289 additions
and
39 deletions
+289
-39
CGoGN/include/Algo/Modelisation/subdivision.hpp
CGoGN/include/Algo/Modelisation/subdivision.hpp
+1
-1
SCHNApps/Plugins/surface_subdivision/forms/dialog_surface_subdivision.ui
...s/surface_subdivision/forms/dialog_surface_subdivision.ui
+40
-26
SCHNApps/Plugins/surface_subdivision/include/surface_subdivision.h
...Plugins/surface_subdivision/include/surface_subdivision.h
+14
-6
SCHNApps/Plugins/surface_subdivision/src/surface_subdivision.cpp
...s/Plugins/surface_subdivision/src/surface_subdivision.cpp
+71
-5
SCHNApps/forms/controlDock_MapTabWidget.ui
SCHNApps/forms/controlDock_MapTabWidget.ui
+28
-0
SCHNApps/include/controlDock_mapTab.h
SCHNApps/include/controlDock_mapTab.h
+4
-0
SCHNApps/include/mapHandler.h
SCHNApps/include/mapHandler.h
+14
-0
SCHNApps/include/mapHandler.hpp
SCHNApps/include/mapHandler.hpp
+1
-1
SCHNApps/include/schnapps.h
SCHNApps/include/schnapps.h
+3
-0
SCHNApps/src/controlDock_mapTab.cpp
SCHNApps/src/controlDock_mapTab.cpp
+58
-0
SCHNApps/src/mapHandler.cpp
SCHNApps/src/mapHandler.cpp
+1
-0
SCHNApps/src/schnapps.cpp
SCHNApps/src/schnapps.cpp
+54
-0
No files found.
CGoGN/include/Algo/Modelisation/subdivision.hpp
View file @
13852a54
...
...
@@ -442,7 +442,7 @@ void CatmullClarkInterpolSubdivision(typename PFP::MAP& map, EMBV& attributs)
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
EMBV
::
DATA_TYPE
EMB
;
VertexAutoAttribute
<
EMB
,
PFP
::
MAP
>
facesAverage
(
map
);
VertexAutoAttribute
<
EMB
,
typename
PFP
::
MAP
>
facesAverage
(
map
);
std
::
vector
<
Dart
>
l_vertices
;
std
::
vector
<
Dart
>
l_edges
;
...
...
SCHNApps/Plugins/surface_subdivision/forms/dialog_surface_subdivision.ui
View file @
13852a54
...
...
@@ -6,25 +6,18 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
327
</width>
<height>
230
</height>
<width>
282
</width>
<height>
334
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Subdivide surface
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"
0"
colspan=
"5
"
>
<item
row=
"0"
column=
"
7"
colspan=
"4
"
>
<widget
class=
"QListWidget"
name=
"list_maps"
/>
</item>
<item
row=
"1"
column=
"0"
colspan=
"3"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position attribute :
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"3"
colspan=
"2"
>
<item
row=
"2"
column=
"10"
>
<widget
class=
"QComboBox"
name=
"combo_positionAttribute"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Fixed"
>
...
...
@@ -34,45 +27,66 @@
</property>
</widget>
</item>
<item
row=
"
2"
column=
"
0"
>
<widget
class=
"QRadioButton"
name=
"radio_
Loop
"
>
<item
row=
"
3"
column=
"1
0"
>
<widget
class=
"QRadioButton"
name=
"radio_
trianguleFaces
"
>
<property
name=
"text"
>
<string>
Loop
</string>
<string>
Triangule
</string>
</property>
</widget>
</item>
<item
row=
"
2"
column=
"1"
colspan=
"3
"
>
<widget
class=
"QRadioButton"
name=
"radio_
CC
"
>
<item
row=
"
3"
column=
"7"
colspan=
"2
"
>
<widget
class=
"QRadioButton"
name=
"radio_
Loop
"
>
<property
name=
"text"
>
<string>
Catmull-Clark
</string>
<string>
Loop
</string>
</property>
</widget>
</item>
<item
row=
"
2"
column=
"4
"
>
<widget
class=
"QRadioButton"
name=
"radio_
tri
anguleFaces"
>
<item
row=
"
4"
column=
"10
"
>
<widget
class=
"QRadioButton"
name=
"radio_
quadr
anguleFaces"
>
<property
name=
"text"
>
<string>
Triangule faces
</string>
<string>
Quadrangule
</string>
</property>
</widget>
</item>
<item
row=
"
3"
column=
"0"
colspan=
"2
"
>
<widget
class=
"Q
PushButton"
name=
"button_cancel
"
>
<item
row=
"
2"
column=
"7
"
>
<widget
class=
"Q
Label"
name=
"label_2
"
>
<property
name=
"text"
>
<string>
Cancel
</string>
<string>
Position attribute :
</string>
</property>
</widget>
</item>
<item
row=
"
3"
column=
"2"
colspan=
"2
"
>
<item
row=
"
6"
column=
"10
"
>
<widget
class=
"QPushButton"
name=
"button_apply"
>
<property
name=
"text"
>
<string>
Apply
</string>
</property>
</widget>
</item>
<item
row=
"
3"
column=
"4
"
>
<item
row=
"
6"
column=
"7
"
>
<widget
class=
"QPushButton"
name=
"button_ok"
>
<property
name=
"text"
>
<string>
OK
</string>
<string>
Close
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"7"
>
<widget
class=
"QRadioButton"
name=
"radio_DoSabin"
>
<property
name=
"text"
>
<string>
Do-Sabin
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"7"
>
<widget
class=
"QRadioButton"
name=
"radio_CC"
>
<property
name=
"text"
>
<string>
Catmull-Clark
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"8"
>
<widget
class=
"QCheckBox"
name=
"check_interp"
>
<property
name=
"text"
>
<string>
Interp
</string>
</property>
</widget>
</item>
...
...
SCHNApps/Plugins/surface_subdivision/include/surface_subdivision.h
View file @
13852a54
...
...
@@ -36,16 +36,24 @@ private slots:
public
slots
:
void
loopSubdivision
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
);
const
QString
&
positionAttributeName
=
"position"
);
void
CCSubdivision
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
);
const
QString
&
positionAttributeName
=
"position"
,
bool
interp
=
false
);
void
DoSabinSubdivision
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
);
void
trianguleFaces
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
);
const
QString
&
positionAttributeName
=
"position"
);
void
quadranguleFaces
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
);
private:
Dialog_Surface_Subdivision
*
m_subdivisionDialog
;
...
...
SCHNApps/Plugins/surface_subdivision/src/surface_subdivision.cpp
View file @
13852a54
...
...
@@ -26,6 +26,7 @@ bool Surface_Subdivision_Plugin::enable()
connect
(
m_subdivisionDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
subdivideFromDialog
()));
connect
(
m_subdivisionDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
subdivideFromDialog
()));
connect
(
m_subdivisionDialog
->
button_ok
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
schnappsClosing
()));
connect
(
m_schnapps
,
SIGNAL
(
schnappsClosing
()),
this
,
SLOT
(
schnappsClosing
()));
return
true
;
...
...
@@ -56,10 +57,20 @@ void Surface_Subdivision_Plugin::subdivideFromDialog()
if
(
m_subdivisionDialog
->
radio_Loop
->
isChecked
())
loopSubdivision
(
mapName
,
positionName
);
else
if
(
m_subdivisionDialog
->
radio_CC
->
isChecked
())
CCSubdivision
(
mapName
,
positionName
);
else
if
(
m_subdivisionDialog
->
radio_CC
->
isChecked
())
{
if
(
m_subdivisionDialog
->
check_interp
->
isChecked
())
CCSubdivision
(
mapName
,
positionName
,
true
);
else
CCSubdivision
(
mapName
,
positionName
,
false
);
}
else
if
(
m_subdivisionDialog
->
radio_DoSabin
->
isChecked
())
DoSabinSubdivision
(
mapName
,
positionName
);
else
if
(
m_subdivisionDialog
->
radio_trianguleFaces
->
isChecked
())
trianguleFaces
(
mapName
,
positionName
);
else
if
(
m_subdivisionDialog
->
radio_quadranguleFaces
->
isChecked
())
quadranguleFaces
(
mapName
,
positionName
);
}
}
...
...
@@ -89,7 +100,7 @@ void Surface_Subdivision_Plugin::loopSubdivision(
void
Surface_Subdivision_Plugin
::
CCSubdivision
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
)
const
QString
&
positionAttributeName
,
bool
interp
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_schnapps
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
...
...
@@ -99,10 +110,38 @@ void Surface_Subdivision_Plugin::CCSubdivision(
if
(
!
position
.
isValid
())
return
;
pythonRecording
(
"CCSubdivision"
,
""
,
mapName
,
positionAttributeName
);
pythonRecording
(
"CCSubdivision"
,
""
,
mapName
,
positionAttributeName
,
interp
);
PFP2
::
MAP
*
map
=
mh
->
getMap
();
if
(
interp
)
Algo
::
Surface
::
Modelisation
::
CatmullClarkInterpolSubdivision
<
PFP2
>
(
*
map
,
position
);
else
Algo
::
Surface
::
Modelisation
::
CatmullClarkSubdivision
<
PFP2
>
(
*
map
,
position
);
mh
->
notifyAttributeModification
(
position
);
mh
->
notifyConnectivityModification
();
foreach
(
View
*
view
,
mh
->
getLinkedViews
())
view
->
updateGL
();
}
void
Surface_Subdivision_Plugin
::
DoSabinSubdivision
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_schnapps
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
return
;
VertexAttribute
<
PFP2
::
VEC3
,
PFP2
::
MAP
>
position
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionAttributeName
);
if
(
!
position
.
isValid
())
return
;
pythonRecording
(
"DoSabinSubdivision"
,
""
,
mapName
,
positionAttributeName
);
PFP2
::
MAP
*
map
=
mh
->
getMap
();
Algo
::
Surface
::
Modelisation
::
CatmullClarkSubdivisio
n
<
PFP2
>
(
*
map
,
position
);
Algo
::
Surface
::
Modelisation
::
DooSabi
n
<
PFP2
>
(
*
map
,
position
);
mh
->
notifyAttributeModification
(
position
);
mh
->
notifyConnectivityModification
();
...
...
@@ -111,6 +150,7 @@ void Surface_Subdivision_Plugin::CCSubdivision(
view
->
updateGL
();
}
void
Surface_Subdivision_Plugin
::
trianguleFaces
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
)
...
...
@@ -135,6 +175,32 @@ void Surface_Subdivision_Plugin::trianguleFaces(
view
->
updateGL
();
}
void
Surface_Subdivision_Plugin
::
quadranguleFaces
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_schnapps
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
return
;
VertexAttribute
<
PFP2
::
VEC3
,
PFP2
::
MAP
>
position
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionAttributeName
);
if
(
!
position
.
isValid
())
return
;
pythonRecording
(
"quadranguleFaces"
,
""
,
mapName
,
positionAttributeName
);
PFP2
::
MAP
*
map
=
mh
->
getMap
();
Algo
::
Surface
::
Modelisation
::
quadranguleFaces
<
PFP2
>
(
*
map
,
position
);
mh
->
notifyAttributeModification
(
position
);
mh
->
notifyConnectivityModification
();
foreach
(
View
*
view
,
mh
->
getLinkedViews
())
view
->
updateGL
();
}
void
Surface_Subdivision_Plugin
::
schnappsClosing
()
{
m_subdivisionDialog
->
close
();
...
...
SCHNApps/forms/controlDock_MapTabWidget.ui
View file @
13852a54
...
...
@@ -44,6 +44,16 @@
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QCheckBox"
name=
"check_drawBB"
>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
...
...
@@ -63,6 +73,24 @@
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QPushButton"
name=
"button_remove"
>
<property
name=
"text"
>
<string>
remove
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_duplicate"
>
<property
name=
"text"
>
<string>
duplicate
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget
class=
"QTabWidget"
name=
"tabWidget_mapInfo"
>
<property
name=
"sizePolicy"
>
...
...
SCHNApps/include/controlDock_mapTab.h
View file @
13852a54
...
...
@@ -40,6 +40,10 @@ private slots:
// slots called from UI actions
void
selectedMapChanged
();
void
duplicateCurrentMap
();
void
removeCurrentMap
();
void
showBBChanged
(
bool
b
);
void
bbVertexAttributeChanged
(
int
index
);
void
vertexAttributeCheckStateChanged
(
QListWidgetItem
*
item
);
...
...
SCHNApps/include/mapHandler.h
View file @
13852a54
...
...
@@ -82,6 +82,19 @@ private slots:
*********************************************************/
public
slots
:
void
showBB
(
bool
b
)
{
m_showBB
=
b
;
foreach
(
View
*
view
,
l_views
)
view
->
updateGL
();
}
bool
isBBshown
()
const
{
return
m_showBB
;
}
void
setBBVertexAttribute
(
const
QString
&
name
)
{
m_bbVertexAttribute
=
m_map
->
getAttributeVectorGen
(
VERTEX
,
name
.
toStdString
());
...
...
@@ -118,6 +131,7 @@ public slots:
virtual
bool
transformedBB
(
qglviewer
::
Vec
&
bbMin
,
qglviewer
::
Vec
&
bbMax
)
=
0
;
protected:
bool
m_showBB
;
virtual
void
updateBB
()
=
0
;
/*********************************************************
...
...
SCHNApps/include/mapHandler.hpp
View file @
13852a54
...
...
@@ -87,7 +87,7 @@ void MapHandler<PFP>::draw(Utils::GLSLShader* shader, int primitive)
template
<
typename
PFP
>
void
MapHandler
<
PFP
>::
drawBB
()
{
if
(
m_bbDrawer
)
if
(
m_
showBB
&&
m_
bbDrawer
)
m_bbDrawer
->
callList
();
}
...
...
SCHNApps/include/schnapps.h
View file @
13852a54
...
...
@@ -99,6 +99,9 @@ private slots:
public
slots
:
MapHandlerGen
*
addMap
(
const
QString
&
name
,
unsigned
int
dim
);
void
removeMap
(
const
QString
&
name
);
MapHandlerGen
*
duplicateMap
(
const
QString
&
name
,
bool
properties
);
void
setSelectedMap
(
const
QString
&
mapName
);
MapHandlerGen
*
getMap
(
const
QString
&
name
)
const
;
...
...
SCHNApps/src/controlDock_mapTab.cpp
View file @
13852a54
...
...
@@ -21,6 +21,10 @@ ControlDock_MapTab::ControlDock_MapTab(SCHNApps* s) :
connect
(
list_maps
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
selectedMapChanged
()));
connect
(
button_duplicate
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
duplicateCurrentMap
()));
connect
(
button_remove
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
removeCurrentMap
()));
connect
(
check_drawBB
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
showBBChanged
(
bool
)));
connect
(
combo_bbVertexAttribute
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
bbVertexAttributeChanged
(
int
)));
connect
(
list_vertexAttributes
,
SIGNAL
(
itemChanged
(
QListWidgetItem
*
)),
this
,
SLOT
(
vertexAttributeCheckStateChanged
(
QListWidgetItem
*
)));
...
...
@@ -79,6 +83,7 @@ void ControlDock_MapTab::setSelectedMap(const QString& mapName)
items
[
0
]
->
setSelected
(
false
);
m_selectedMap
=
NULL
;
}
updateSelectedMapInfo
();
return
;
}
...
...
@@ -133,6 +138,57 @@ void ControlDock_MapTab::selectedMapChanged()
}
}
void
ControlDock_MapTab
::
showBBChanged
(
bool
b
)
{
if
(
!
b_updatingUI
)
{
if
(
m_selectedMap
)
{
m_selectedMap
->
showBB
(
b
);
// RECORDING
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
m_selectedMap
->
getName
()
<<
".showBB(
\"
"
<<
b
<<
"
\"
);"
<<
endl
;
}
}
}
void
ControlDock_MapTab
::
duplicateCurrentMap
()
{
if
(
!
b_updatingUI
)
{
if
(
m_selectedMap
)
{
m_schnapps
->
duplicateMap
(
m_selectedMap
->
getName
(),
true
);
// RECORDING
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
"schnapps.duplicateMap("
<<
m_selectedMap
->
getName
()
<<
".getName(),1);"
<<
endl
;
}
}
}
void
ControlDock_MapTab
::
removeCurrentMap
()
{
if
(
!
b_updatingUI
)
{
if
(
m_selectedMap
)
{
m_schnapps
->
removeMap
(
m_selectedMap
->
getName
());
// RECORDING
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
"schnapps.removeMap("
<<
m_selectedMap
->
getName
()
<<
".getName());"
<<
endl
;
setSelectedMap
(
"NONE"
);
}
}
}
void
ControlDock_MapTab
::
bbVertexAttributeChanged
(
int
index
)
{
if
(
!
b_updatingUI
)
...
...
@@ -319,6 +375,8 @@ void ControlDock_MapTab::updateSelectedMapInfo()
for
(
unsigned
int
orbit
=
DART
;
orbit
<=
VOLUME
;
++
orbit
)
{
check_drawBB
->
setChecked
(
m_selectedMap
->
isBBshown
());
unsigned
int
nbc
=
m
->
getNbCells
(
orbit
);
QListWidget
*
selectorList
=
NULL
;
...
...
SCHNApps/src/mapHandler.cpp
View file @
13852a54
...
...
@@ -7,6 +7,7 @@ namespace SCHNApps
{
MapHandlerGen
::
MapHandlerGen
(
const
QString
&
name
,
SCHNApps
*
s
,
GenericMap
*
map
)
:
m_showBB
(
true
),
m_name
(
name
),
m_schnapps
(
s
),
m_map
(
map
),
...
...
SCHNApps/src/schnapps.cpp
View file @
13852a54
...
...
@@ -543,6 +543,60 @@ void SCHNApps::disablePluginTabWidgets(PluginInteraction* plugin)
* MANAGE MAPS
*********************************************************/
MapHandlerGen
*
SCHNApps
::
duplicateMap
(
const
QString
&
name
,
bool
properties
)
{
if
(
!
m_maps
.
contains
(
name
))
return
NULL
;
QString
newName
=
name
+
"_copy"
;
if
(
m_maps
.
contains
(
newName
))
return
NULL
;
MapHandlerGen
*
maph
=
m_maps
[
name
];
MapHandlerGen
*
new_mh
;
unsigned
int
dim
=
maph
->
getGenericMap
()
->
dimension
();
switch
(
dim
)
{
case
2
:
{
PFP2
::
MAP
*
map
=
new
PFP2
::
MAP
();
map
->
copyFrom
(
*
(
maph
->
getGenericMap
()));
new_mh
=
new
MapHandler
<
PFP2
>
(
newName
,
this
,
map
);
break
;
}
case
3
:
{
PFP3
::
MAP
*
map
=
new
PFP3
::
MAP
();
map
->
copyFrom
(
*
(
maph
->
getGenericMap
()));
new_mh
=
new
MapHandler
<
PFP3
>
(
newName
,
this
,
map
);
break
;
}
}
m_maps
.
insert
(
newName
,
new_mh
);
DEBUG_EMIT
(
"mapAdded"
);
emit
(
mapAdded
(
new_mh
));
if
(
properties
)
{
// BB
new_mh
->
setBBVertexAttribute
(
maph
->
getBBVertexAttributeName
());
//VBOs
const
VBOSet
&
vbos
=
maph
->
getVBOSet
();
foreach
(
QString
s
,
vbos
.
keys
())
{
new_mh
->
createVBO
(
s
);
}
}
return
new_mh
;
}
MapHandlerGen
*
SCHNApps
::
addMap
(
const
QString
&
name
,
unsigned
int
dim
)
{
if
(
m_maps
.
contains
(
name
))
...
...
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