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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
17a666b7
Commit
17a666b7
authored
Apr 24, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
traversor & foreach macros tutos
parent
29130379
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
2067 additions
and
13 deletions
+2067
-13
Apps/SandBox/test_traversor2.cpp
Apps/SandBox/test_traversor2.cpp
+32
-1
Apps/Tuto/Traversals/CMakeLists.txt
Apps/Tuto/Traversals/CMakeLists.txt
+48
-0
Apps/Tuto/Traversals/show_traversors.cpp
Apps/Tuto/Traversals/show_traversors.cpp
+695
-0
Apps/Tuto/Traversals/show_traversors.h
Apps/Tuto/Traversals/show_traversors.h
+144
-0
Apps/Tuto/Traversals/show_traversors.ui
Apps/Tuto/Traversals/show_traversors.ui
+269
-0
Apps/Tuto/Traversals/test_traversor2.cpp
Apps/Tuto/Traversals/test_traversor2.cpp
+447
-0
Apps/Tuto/Traversals/test_traversor2.h
Apps/Tuto/Traversals/test_traversor2.h
+126
-0
Apps/Tuto/Traversals/traverse_cells.cpp
Apps/Tuto/Traversals/traverse_cells.cpp
+112
-0
Apps/Tuto/Traversals/traverse_neighbour.cpp
Apps/Tuto/Traversals/traverse_neighbour.cpp
+86
-0
Apps/Tuto/Traversals/traverse_neighbours.cpp
Apps/Tuto/Traversals/traverse_neighbours.cpp
+96
-0
include/Algo/Render/GL2/explodeVolumeRender.hpp
include/Algo/Render/GL2/explodeVolumeRender.hpp
+12
-12
No files found.
Apps/SandBox/test_traversor2.cpp
View file @
17a666b7
...
...
@@ -29,6 +29,7 @@
#include "Algo/Import/import.h"
#include "Algo/Export/export.h"
#include "Topology/generic/cells_macros.h"
using
namespace
CGoGN
;
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -59,6 +60,17 @@ int main(int argc, char **argv)
return
app
.
exec
();
}
void
fonct
(
const
Cell
<
VERTEX
>&
v
)
{
std
::
cout
<<
v
.
dart
<<
std
::
endl
;
}
void
fonct2
(
Dart
d
)
{
std
::
cout
<<
d
<<
std
::
endl
;
}
void
MyQT
::
traversors
(
int
x
)
{
// update all color to grey
...
...
@@ -72,16 +84,31 @@ void MyQT::traversors(int x)
{
case
0
:
{
// TRAVERSE2_ADJACENT(VERTEX,EDGE,m_selected, b, MAP, myMap)
// m_render_topo->setDartColor(b,0.0f,1.0f,0.0f);
Vertex
v
(
m_selected
);
Edge
e
(
m_selected
);
fonct
(
v
);
fonct2
(
e
);
fonct
(
m_selected
);
v
=
m_selected
;
/*
Traversor2VVaE<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f);
*/
}
break
;
case
1
:
{
foreachAdjacent2
(
VERTEX
,
FACE
,
m_selected
,
b
,
MAP
,
myMap
)
m_render_topo
->
setDartColor
(
b
,
0.0
f
,
1.0
f
,
0.0
f
);
/*
Traversor2VVaF<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f);
*/
}
break
;
case
2
:
...
...
@@ -150,9 +177,13 @@ void MyQT::traversors(int x)
break
;
case
11
:
{
Traversor2VF
<
MAP
>
trav
(
myMap
,
m_selected
);
/*
Traversor2VF<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f);
*/
foreachIncident2
(
VERTEX
,
m_selected
,
FACE
,
b
,
MAP
,
myMap
)
m_render_topo
->
setDartColor
(
b
,
0.0
f
,
1.0
f
,
0.0
f
);
}
break
;
default:
...
...
Apps/Tuto/Traversals/CMakeLists.txt
0 → 100644
View file @
17a666b7
cmake_minimum_required
(
VERSION 2.8
)
project
(
Tuto_Traversals
)
SET
(
CMAKE_BUILD_TYPE Debug
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DNOTOPOWARNING"
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
${
CGoGN_ROOT_DIR
}
/include
${
CGoGN_EXT_INCLUDES
}
)
# define libs path
IF
(
WIN32
)
link_directories
(
${
CGoGN_ROOT_DIR
}
/lib/$
(
ConfigurationName
)
${
Boost_LIBRARY_DIRS
}
)
ELSE
(
WIN32
)
link_directories
(
${
CGoGN_ROOT_DIR
}
/lib/Release
${
CGoGN_ROOT_DIR
}
/lib/Debug
)
ENDIF
(
WIN32
)
#define exec to compile
#QT4_WRAP_CPP(tuto1_moc tuto1.h)
#add_executable( tuto1 tuto1.cpp ${tuto1_moc})
#target_link_libraries( tuto1
# ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
#QT4_WRAP_UI( tuto2_ui tuto2.ui )
#QT4_WRAP_CPP(tuto2_moc tuto2.h)
#add_executable( tuto2 tuto2.cpp tuto2.h ${tuto2_ui} ${tuto2_moc})
#target_link_libraries( tuto2
# ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
add_executable
(
traverse_cells traverse_cells.cpp
)
target_link_libraries
(
traverse_cells
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
add_executable
(
traverse_neighbours traverse_neighbours.cpp
)
target_link_libraries
(
traverse_neighbours
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
QT4_WRAP_UI
(
show_traversors_ui show_traversors.ui
)
QT4_WRAP_CPP
(
show_traversors_moc show_traversors.h
)
add_executable
(
show_traversors show_traversors.cpp
${
show_traversors_ui
}
${
show_traversors_moc
}
)
target_link_libraries
(
show_traversors
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
Apps/Tuto/Traversals/show_traversors.cpp
0 → 100644
View file @
17a666b7
This diff is collapsed.
Click to expand it.
Apps/Tuto/Traversals/show_traversors.h
0 → 100644
View file @
17a666b7
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __SHOW_TRAVERSORS_
#define __SHOW_TRAVERSORS_
#include <iostream>
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap3.h"
#include "Geometry/vector_gen.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Algo/Render/GL2/topo3Render.h"
#include "Topology/generic/cellmarker.h"
#include "Utils/text3d.h"
#include "Utils/pointSprite.h"
#include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/cgognStream.h"
#include "Utils/drawer.h"
#include "Utils/Qt/qtSimple.h"
#include "ui_show_traversors.h"
// inclure qtui.h juste après le ui_xxx.h
#include "Utils/Qt/qtui.h"
using
namespace
CGoGN
;
struct
PFP
:
public
PFP_STANDARD
{
// definition de la carte
typedef
EmbeddedMap3
MAP
;
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
/**
* Utilisation de designer-qt4:
* Faire un DockWiget (laisser le nom par defaut
* dans le Contents ajouter le layout choisi (vertical classiquement)
* Ajouter les widgets necessaires, mettre des noms clairs pour
* les utiliser dans le .cpp (pour les call back principalement)
*/
class
MyQT
:
public
Utils
::
QT
::
SimpleQT
{
Q_OBJECT
Algo
::
Render
::
GL2
::
Topo3RenderMap
<
PFP
>*
m_render_topo
;
bool
m_showTopo
;
unsigned
int
m_first3
;
unsigned
int
m_ajd_or_inci3
;
unsigned
int
m_second3
;
unsigned
int
m_first2
;
unsigned
int
m_ajd_or_inci2
;
unsigned
int
m_second2
;
float
m_expl
;
unsigned
int
m_last
;
public:
MyQT
()
:
m_render_topo
(
NULL
),
m_showTopo
(
true
),
m_first3
(
0
),
m_ajd_or_inci3
(
0
),
m_second3
(
1
),
m_first2
(
0
),
m_ajd_or_inci2
(
0
),
m_second2
(
1
),
m_expl
(
0.8
f
),
m_last
(
2
),
m_selected
(
NIL
),
m_dm_topo
(
NULL
)
{}
Dart
m_selected
;
std
::
vector
<
Dart
>
m_affDarts
;
Utils
::
Drawer
m_drawer
;
DartMarker
<
MAP
>*
m_dm_topo
;
protected:
void
storeVerticesInfo
();
void
cb_redraw
();
void
cb_initGL
();
void
cb_Save
();
void
cb_mousePress
(
int
button
,
int
x
,
int
y
);
template
<
unsigned
int
ORBIT
>
void
colorizeCell
(
Dart
d
,
float
r
,
float
g
,
float
b
);
void
traverse2
();
void
traverse3
();
void
dynamicMarkOrbit
(
unsigned
int
orb
);
// void dyn_trav3XXaY(unsigned int first, unsigned int second);
// slots locaux
public
slots
:
void
cb_combo1
(
int
x
);
void
cb_combo2
(
int
x
);
void
cb_combo3
(
int
x
);
void
cb_combo4
(
int
x
);
void
cb_combo5
(
int
x
);
void
cb_combo6
(
int
x
);
void
cb_checkTopo
(
bool
b
);
void
cb_explode
(
int
x
);
};
#endif
Apps/Tuto/Traversals/show_traversors.ui
0 → 100644
View file @
17a666b7
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
DockWidget
</class>
<widget
class=
"QDockWidget"
name=
"DockWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
150
</width>
<height>
417
</height>
</rect>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
150
</width>
<height>
250
</height>
</size>
</property>
<property
name=
"windowTitle"
>
<string>
Interface
</string>
</property>
<widget
class=
"QWidget"
name=
"dockWidgetContents"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
150
</width>
<height>
200
</height>
</size>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"margin"
>
<number>
2
</number>
</property>
<property
name=
"spacing"
>
<number>
4
</number>
</property>
<item
row=
"1"
column=
"0"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Traversor2
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"combo4"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<item>
<property
name=
"text"
>
<string>
Vertex
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Edge
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Face
</string>
</property>
</item>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"combo5"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<item>
<property
name=
"text"
>
<string>
incident to
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
adjacent by
</string>
</property>
</item>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"combo6"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<property
name=
"currentIndex"
>
<number>
1
</number>
</property>
<item>
<property
name=
"text"
>
<string>
Vertex
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Edge
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Face
</string>
</property>
</item>
</widget>
</item>
<item>
<widget
class=
"Line"
name=
"line"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Traversor3
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"combo1"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<item>
<property
name=
"text"
>
<string>
Vertex
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Edge
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Face
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Volume
</string>
</property>
</item>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"combo2"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<item>
<property
name=
"text"
>
<string>
incident to
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
adjacent by
</string>
</property>
</item>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"combo3"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<property
name=
"currentIndex"
>
<number>
1
</number>
</property>
<item>
<property
name=
"text"
>
<string>
Vertex
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Edge
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Face
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Volume
</string>
</property>
</item>
</widget>
</item>
<item>
<widget
class=
"Line"
name=
"line_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item>
<widget
class=
"QSlider"
name=
"explodeSlider"
>
<property
name=
"minimum"
>
<number>
1
</number>
</property>
<property
name=
"maximum"
>
<number>
100
</number>
</property>
<property
name=
"sliderPosition"
>
<number>
80
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item>
<widget
class=
"Line"
name=
"line_3"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"checkTopo"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<property
name=
"text"
>
<string>
show topo
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
Apps/Tuto/Traversals/test_traversor2.cpp
0 → 100644
View file @
17a666b7
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "test_traversor2.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Tiling/Surface/square.h"
#include "Algo/Geometry/centroid.h"
#include "Algo/Import/import.h"
#include "Algo/Export/export.h"
#include "Topology/generic/cells_macros.h"
using
namespace
CGoGN
;
int
main
(
int
argc
,
char
**
argv
)
{
// // interface
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
sqt
.
setDock
(
&
sqt
.
dock
);
sqt
.
setCallBack
(
sqt
.
dock
.
listTravers
,
SIGNAL
(
currentRowChanged
(
int
)),
SLOT
(
traversors
(
int
))
);
sqt
.
setCallBack
(
sqt
.
dock
.
withBoundary
,
SIGNAL
(
clicked
()),
SLOT
(
updateMap
())
);
sqt
.
setCallBack
(
sqt
.
dock
.
svg
,
SIGNAL
(
clicked
()),
SLOT
(
svg
())
);
sqt
.
setCallBack
(
sqt
.
dock
.
widthSlider
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
width
(
int
))
);
int
n
=
3
;
if
(
argc
==
2
)
n
=
atoi
(
argv
[
1
]);
// example code itself
sqt
.
createMap
(
n
);
sqt
.
width
(
5
);
// set help message in menu
sqt
.
setHelpMsg
(
"First Tuto:
\n
Create two faces
\n
sew them
\n
and affect positions"
);
// final show for redraw
sqt
.
show
();
// and wait for the end
return
app
.
exec
();
}
void
fonct
(
const
Cell
<
VERTEX
>&
v
)
{
std
::
cout
<<
v
.
dart
<<
std
::
endl
;
}
void
fonct2
(
Dart
d
)
{
std
::
cout
<<
d
<<
std
::
endl
;
}
void
MyQT
::
traversors
(
int
x
)
{
// update all color to grey
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
colorDarts
[
d
]
=
Geom
::
Vec3f
(
0.5
f
,
0.5
f
,
0.5
f
);
m_render_topo
->
setDartColor
(
d
,
0.5
f
,
0.5
f
,
0.5
f
);
}
switch
(
x
)
{