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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
CGoGN
Commits
3cd5f660
Commit
3cd5f660
authored
Sep 16, 2013
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
little improvements & bug fixes
parent
03178203
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
41 deletions
+70
-41
SCHNApps/Plugins/surface_selection/include/surface_selection.h
...pps/Plugins/surface_selection/include/surface_selection.h
+1
-1
SCHNApps/Plugins/surface_selection/src/surface_selection.cpp
SCHNApps/Plugins/surface_selection/src/surface_selection.cpp
+48
-29
SCHNApps/include/cellSelector.h
SCHNApps/include/cellSelector.h
+2
-0
SCHNApps/include/mapHandler.h
SCHNApps/include/mapHandler.h
+1
-7
SCHNApps/src/mapHandler.cpp
SCHNApps/src/mapHandler.cpp
+6
-4
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+12
-0
No files found.
SCHNApps/Plugins/surface_selection/include/surface_selection.h
View file @
3cd5f660
...
...
@@ -47,7 +47,7 @@ public:
virtual
void
mouseMove
(
View
*
view
,
QMouseEvent
*
event
);
virtual
void
wheelEvent
(
View
*
view
,
QWheelEvent
*
event
);
virtual
void
viewLinked
(
View
*
view
)
{}
virtual
void
viewLinked
(
View
*
view
)
;
virtual
void
viewUnlinked
(
View
*
view
)
{}
private
slots
:
...
...
SCHNApps/Plugins/surface_selection/src/surface_selection.cpp
View file @
3cd5f660
...
...
@@ -53,24 +53,6 @@ void Surface_Selection_Plugin::disable()
void
Surface_Selection_Plugin
::
draw
(
View
*
view
)
{
if
(
m_selecting
)
{
std
::
vector
<
PFP2
::
VEC3
>
selectionPoint
;
selectionPoint
.
push_back
(
m_selectionCenter
);
m_selectionSphereVBO
->
updateData
(
selectionPoint
);
m_pointSprite
->
setAttributePosition
(
m_selectionSphereVBO
);
m_pointSprite
->
setSize
(
m_selectionRadius
);
m_pointSprite
->
setColor
(
CGoGN
::
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
1.0
f
,
0.5
f
));
m_pointSprite
->
setLightPosition
(
CGoGN
::
Geom
::
Vec3f
(
0.0
f
,
0.0
f
,
1.0
f
));
m_pointSprite
->
enableVertexAttribs
();
glEnable
(
GL_BLEND
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
glDrawArrays
(
GL_POINTS
,
0
,
1
);
glDisable
(
GL_BLEND
);
m_pointSprite
->
disableVertexAttribs
();
}
}
void
Surface_Selection_Plugin
::
drawMap
(
View
*
view
,
MapHandlerGen
*
map
)
...
...
@@ -96,6 +78,25 @@ void Surface_Selection_Plugin::drawMap(View* view, MapHandlerGen* map)
m_drawer
->
endList
();
}
}
if
(
m_selecting
)
{
std
::
vector
<
PFP2
::
VEC3
>
selectionPoint
;
selectionPoint
.
push_back
(
m_selectionCenter
);
m_selectionSphereVBO
->
updateData
(
selectionPoint
);
m_pointSprite
->
setAttributePosition
(
m_selectionSphereVBO
);
m_pointSprite
->
setSize
(
m_selectionRadius
);
m_pointSprite
->
setColor
(
CGoGN
::
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
1.0
f
,
0.5
f
));
m_pointSprite
->
setLightPosition
(
CGoGN
::
Geom
::
Vec3f
(
0.0
f
,
0.0
f
,
1.0
f
));
m_pointSprite
->
enableVertexAttribs
();
glEnable
(
GL_BLEND
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
glDrawArrays
(
GL_POINTS
,
0
,
1
);
glDisable
(
GL_BLEND
);
m_pointSprite
->
disableVertexAttribs
();
}
}
}
...
...
@@ -121,7 +122,7 @@ void Surface_Selection_Plugin::keyRelease(View* view, QKeyEvent* event)
void
Surface_Selection_Plugin
::
mousePress
(
View
*
view
,
QMouseEvent
*
event
)
{
if
(
event
->
button
()
==
Qt
::
LeftButton
&&
m_selecting
)
if
(
m_selecting
&&
(
event
->
button
()
==
Qt
::
LeftButton
||
event
->
button
()
==
Qt
::
RightButton
)
)
{
MapHandlerGen
*
mh
=
m_schnapps
->
getSelectedMap
();
const
MapParameters
&
p
=
h_viewParameterSet
[
view
][
mh
];
...
...
@@ -152,16 +153,27 @@ void Surface_Selection_Plugin::mousePress(View* view, QMouseEvent* event)
if
(
selector
)
{
switch
(
orbit
)
if
(
event
->
button
()
==
Qt
::
LeftButton
)
{
case
DART
:
break
;
case
VERTEX
:
selector
->
select
(
neigh
.
getInsideVertices
());
break
;
case
EDGE
:
selector
->
select
(
neigh
.
getInsideEdges
());
break
;
case
FACE
:
selector
->
select
(
neigh
.
getInsideFaces
());
break
;
switch
(
orbit
)
{
case
DART
:
break
;
case
VERTEX
:
selector
->
select
(
neigh
.
getInsideVertices
());
break
;
case
EDGE
:
selector
->
select
(
neigh
.
getInsideEdges
());
break
;
case
FACE
:
selector
->
select
(
neigh
.
getInsideFaces
());
break
;
}
}
else
if
(
event
->
button
()
==
Qt
::
RightButton
)
{
switch
(
orbit
)
{
case
DART
:
break
;
case
VERTEX
:
selector
->
unselect
(
neigh
.
getInsideVertices
());
break
;
case
EDGE
:
selector
->
unselect
(
neigh
.
getInsideEdges
());
break
;
case
FACE
:
selector
->
unselect
(
neigh
.
getInsideFaces
());
break
;
}
}
}
view
->
updateGL
()
;
}
}
}
...
...
@@ -208,13 +220,20 @@ void Surface_Selection_Plugin::wheelEvent(View* view, QWheelEvent* event)
if
(
m_selecting
)
{
if
(
event
->
delta
()
>
0
)
m_selectionRadius
*=
0.9
f
;
m_selectionRadius
*=
0.9
f
;
else
m_selectionRadius
*=
1.1
f
;
view
->
updateGL
()
;
m_selectionRadius
*=
1.1
f
;
view
->
updateGL
();
}
}
void
Surface_Selection_Plugin
::
viewLinked
(
View
*
view
)
{
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
map
)
m_selectionRadius
=
map
->
getBBdiagSize
()
/
50.0
f
;
}
...
...
SCHNApps/include/cellSelector.h
View file @
3cd5f660
...
...
@@ -102,12 +102,14 @@ public:
{
for
(
unsigned
int
i
=
0
;
i
<
d
.
size
();
++
i
)
select
(
d
[
i
],
false
);
emit
(
selectedCellsChanged
());
}
inline
void
unselect
(
const
std
::
vector
<
Dart
>&
d
)
{
for
(
unsigned
int
i
=
0
;
i
<
d
.
size
();
++
i
)
unselect
(
d
[
i
],
false
);
emit
(
selectedCellsChanged
());
}
inline
bool
isSelected
(
Dart
d
)
...
...
SCHNApps/include/mapHandler.h
View file @
3cd5f660
...
...
@@ -74,13 +74,6 @@ public slots:
return
matrix
;
}
private
slots
:
void
frameModified
()
{
foreach
(
View
*
view
,
l_views
)
view
->
updateGL
();
}
public:
virtual
void
draw
(
Utils
::
GLSLShader
*
shader
,
int
primitive
)
=
0
;
virtual
void
drawBB
()
=
0
;
...
...
@@ -178,6 +171,7 @@ signals:
void
cellSelectorAdded
(
unsigned
int
orbit
,
const
QString
&
name
);
void
cellSelectorRemoved
(
unsigned
int
orbit
,
const
QString
&
name
);
void
selectedCellsChanged
();
protected:
QString
m_name
;
...
...
SCHNApps/src/mapHandler.cpp
View file @
3cd5f660
...
...
@@ -15,16 +15,12 @@ MapHandlerGen::MapHandlerGen(const QString& name, SCHNApps* s, GenericMap* map)
m_render
(
NULL
)
{
m_frame
=
new
qglviewer
::
ManipulatedFrame
();
connect
(
m_frame
,
SIGNAL
(
modified
()),
this
,
SLOT
(
frameModified
()));
}
MapHandlerGen
::~
MapHandlerGen
()
{
if
(
m_frame
)
{
disconnect
(
m_frame
,
SIGNAL
(
modified
()),
this
,
SLOT
(
frameModified
()));
delete
m_frame
;
}
if
(
m_bbDrawer
)
delete
m_bbDrawer
;
if
(
m_render
)
...
...
@@ -134,6 +130,9 @@ CellSelectorGen* MapHandlerGen::addCellSelector(unsigned int orbit, const QStrin
m_cellSelectors
[
orbit
].
insert
(
name
,
cs
);
emit
(
cellSelectorAdded
(
orbit
,
name
));
connect
(
cs
,
SIGNAL
(
selectedCellsChanged
()),
this
,
SIGNAL
(
selectedCellsChanged
()));
return
cs
;
}
...
...
@@ -144,6 +143,9 @@ void MapHandlerGen::removeCellSelector(unsigned int orbit, const QString& name)
{
m_cellSelectors
[
orbit
].
remove
(
name
);
emit
(
cellSelectorRemoved
(
orbit
,
name
));
disconnect
(
cs
,
SIGNAL
(
selectedCellsChanged
()),
this
,
SIGNAL
(
selectedCellsChanged
()));
delete
cs
;
}
}
...
...
SCHNApps/src/view.cpp
View file @
3cd5f660
...
...
@@ -132,9 +132,15 @@ void View::linkMap(MapHandlerGen* map)
l_maps
.
push_back
(
map
);
map
->
linkView
(
this
);
emit
(
mapLinked
(
map
));
updateCurrentCameraBB
();
updateGL
();
connect
(
map
->
getFrame
(),
SIGNAL
(
modified
()),
this
,
SLOT
(
updateGL
()));
connect
(
map
,
SIGNAL
(
selectedCellsChanged
()),
this
,
SLOT
(
updateGL
()));
if
(
map
==
m_schnapps
->
getSelectedMap
())
setManipulatedFrame
(
map
->
getFrame
());
}
}
...
...
@@ -151,9 +157,15 @@ void View::unlinkMap(MapHandlerGen* map)
{
map
->
unlinkView
(
this
);
emit
(
mapUnlinked
(
map
));
updateCurrentCameraBB
();
updateGL
();
disconnect
(
map
->
getFrame
(),
SIGNAL
(
modified
()),
this
,
SLOT
(
updateGL
()));
disconnect
(
map
,
SIGNAL
(
selectedCellsChanged
()),
this
,
SLOT
(
updateGL
()));
if
(
map
==
m_schnapps
->
getSelectedMap
())
setManipulatedFrame
(
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