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
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
dad70cf4
Commit
dad70cf4
authored
Mar 05, 2015
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCHNApps: Surface_selection: update selection radius based on map bounding box updates
parent
6d79653e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
20 deletions
+26
-20
SCHNApps/Plugins/surface_selection/include/surface_selection.h
...pps/Plugins/surface_selection/include/surface_selection.h
+4
-2
SCHNApps/Plugins/surface_selection/src/surface_selection.cpp
SCHNApps/Plugins/surface_selection/src/surface_selection.cpp
+22
-18
No files found.
SCHNApps/Plugins/surface_selection/include/surface_selection.h
View file @
dad70cf4
...
...
@@ -57,7 +57,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
:
...
...
@@ -69,6 +69,7 @@ private slots:
void
selectedMapAttributeAdded
(
unsigned
int
orbit
,
const
QString
&
name
);
void
selectedMapAttributeModified
(
unsigned
int
orbit
,
const
QString
&
name
);
void
selectedMapConnectivityModified
();
void
selectedMapBoundingBoxModified
();
public
slots
:
// slots for Python calls
...
...
@@ -98,7 +99,8 @@ protected:
// WithinSphere parameters
Utils
::
VBO
*
m_selectionSphereVBO
;
PFP2
::
REAL
m_selectionRadius
;
PFP2
::
REAL
m_selectionRadiusBase
;
PFP2
::
REAL
m_selectionRadiusCoeff
;
// NormalAngle parameters
PFP2
::
REAL
m_normalAngleThreshold
;
...
...
SCHNApps/Plugins/surface_selection/src/surface_selection.cpp
View file @
dad70cf4
...
...
@@ -18,6 +18,8 @@ namespace SCHNApps
Surface_Selection_Plugin
::
Surface_Selection_Plugin
()
:
m_selecting
(
false
),
m_selectionRadiusBase
(
1
),
m_selectionRadiusCoeff
(
1
),
m_normalAngleThreshold
(
10
)
{}
...
...
@@ -53,7 +55,8 @@ bool Surface_Selection_Plugin::enable()
connect
(
cur
,
SIGNAL
(
attributeAdded
(
unsigned
int
,
const
QString
&
)),
this
,
SLOT
(
selectedMapAttributeAdded
(
unsigned
int
,
const
QString
&
)));
connect
(
cur
,
SIGNAL
(
attributeModified
(
unsigned
int
,
const
QString
&
)),
this
,
SLOT
(
selectedMapAttributeModified
(
unsigned
int
,
const
QString
&
)));
connect
(
cur
,
SIGNAL
(
connectivityModified
()),
this
,
SLOT
(
selectedMapConnectivityModified
()));
m_selectionRadius
=
cur
->
getBBdiagSize
()
/
50.0
f
;
connect
(
cur
,
SIGNAL
(
boundingBoxModified
()),
this
,
SLOT
(
selectedMapBoundingBoxModified
()));
m_selectionRadiusBase
=
cur
->
getBBdiagSize
()
/
50.0
f
;
}
m_dockTab
->
updateMapParameters
();
...
...
@@ -122,7 +125,7 @@ void Surface_Selection_Plugin::drawMap(View* view, MapHandlerGen* map)
break
;
}
case
WithinSphere
:
{
m_pointSprite
->
setSize
(
m_selectionRadius
);
m_pointSprite
->
setSize
(
m_selectionRadius
Base
*
m_selectionRadiusCoeff
);
break
;
}
}
...
...
@@ -164,7 +167,7 @@ void Surface_Selection_Plugin::drawMap(View* view, MapHandlerGen* map)
m_pointSprite
->
setAttributePosition
(
m_selectionSphereVBO
);
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
->
setSize
(
m_selectionRadius
);
m_pointSprite
->
setSize
(
m_selectionRadius
Base
*
m_selectionRadiusCoeff
);
m_pointSprite
->
enableVertexAttribs
();
glEnable
(
GL_BLEND
);
...
...
@@ -206,7 +209,7 @@ void Surface_Selection_Plugin::drawMap(View* view, MapHandlerGen* map)
m_pointSprite
->
setAttributePosition
(
m_selectionSphereVBO
);
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
->
setSize
(
m_selectionRadius
);
m_pointSprite
->
setSize
(
m_selectionRadius
Base
*
m_selectionRadiusCoeff
);
m_pointSprite
->
enableVertexAttribs
();
glEnable
(
GL_BLEND
);
...
...
@@ -276,7 +279,7 @@ void Surface_Selection_Plugin::mousePress(View* view, QMouseEvent* event)
break
;
}
case
WithinSphere
:
{
Algo
::
Surface
::
Selection
::
Collector_WithinSphere
<
PFP2
>
neigh
(
*
map
,
p
.
positionAttribute
,
m_selectionRadius
);
Algo
::
Surface
::
Selection
::
Collector_WithinSphere
<
PFP2
>
neigh
(
*
map
,
p
.
positionAttribute
,
m_selectionRadius
Base
*
m_selectionRadiusCoeff
);
neigh
.
collectAll
(
m_selectingVertex
);
if
(
event
->
button
()
==
Qt
::
LeftButton
)
cs
->
select
(
neigh
.
getInsideVertices
());
...
...
@@ -315,7 +318,7 @@ void Surface_Selection_Plugin::mousePress(View* view, QMouseEvent* event)
break
;
}
case
WithinSphere
:
{
Algo
::
Surface
::
Selection
::
Collector_WithinSphere
<
PFP2
>
neigh
(
*
map
,
p
.
positionAttribute
,
m_selectionRadius
);
Algo
::
Surface
::
Selection
::
Collector_WithinSphere
<
PFP2
>
neigh
(
*
map
,
p
.
positionAttribute
,
m_selectionRadius
Base
*
m_selectionRadiusCoeff
);
neigh
.
collectAll
(
m_selectingEdge
);
if
(
event
->
button
()
==
Qt
::
LeftButton
)
cs
->
select
(
neigh
.
getInsideEdges
());
...
...
@@ -354,7 +357,7 @@ void Surface_Selection_Plugin::mousePress(View* view, QMouseEvent* event)
break
;
}
case
WithinSphere
:
{
Algo
::
Surface
::
Selection
::
Collector_WithinSphere
<
PFP2
>
neigh
(
*
map
,
p
.
positionAttribute
,
m_selectionRadius
);
Algo
::
Surface
::
Selection
::
Collector_WithinSphere
<
PFP2
>
neigh
(
*
map
,
p
.
positionAttribute
,
m_selectionRadius
Base
*
m_selectionRadiusCoeff
);
neigh
.
collectAll
(
m_selectingFace
);
if
(
event
->
button
()
==
Qt
::
LeftButton
)
cs
->
select
(
neigh
.
getInsideFaces
());
...
...
@@ -446,9 +449,9 @@ void Surface_Selection_Plugin::wheelEvent(View* view, QWheelEvent* event)
}
case
WithinSphere
:
{
if
(
event
->
delta
()
>
0
)
m_selectionRadius
*=
0.9
f
;
m_selectionRadius
Coeff
*=
0.9
f
;
else
m_selectionRadius
*=
1.1
f
;
m_selectionRadius
Coeff
*=
1.1
f
;
view
->
updateGL
();
break
;
}
...
...
@@ -457,20 +460,13 @@ void Surface_Selection_Plugin::wheelEvent(View* view, QWheelEvent* event)
m_normalAngleThreshold
*=
0.9
f
;
else
m_normalAngleThreshold
*=
1.1
f
;
//
view->displayMessage(QString("Angle threshold : ") + m_normalAngleThreshold);
//
view->displayMessage(QString("Angle threshold : ") + m_normalAngleThreshold);
break
;
}
}
}
}
void
Surface_Selection_Plugin
::
viewLinked
(
View
*
view
)
{
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
map
)
m_selectionRadius
=
map
->
getBBdiagSize
()
/
50.0
f
;
}
...
...
@@ -483,13 +479,15 @@ void Surface_Selection_Plugin::selectedMapChanged(MapHandlerGen *prev, MapHandle
disconnect
(
prev
,
SIGNAL
(
attributeAdded
(
unsigned
int
,
const
QString
&
)),
this
,
SLOT
(
selectedMapAttributeAdded
(
unsigned
int
,
const
QString
&
)));
disconnect
(
prev
,
SIGNAL
(
attributeModified
(
unsigned
int
,
const
QString
&
)),
this
,
SLOT
(
selectedMapAttributeModified
(
unsigned
int
,
const
QString
&
)));
disconnect
(
prev
,
SIGNAL
(
connectivityModified
()),
this
,
SLOT
(
selectedMapConnectivityModified
()));
disconnect
(
prev
,
SIGNAL
(
boundingBoxModified
()),
this
,
SLOT
(
selectedMapBoundingBoxModified
()));
}
if
(
cur
)
{
connect
(
cur
,
SIGNAL
(
attributeAdded
(
unsigned
int
,
const
QString
&
)),
this
,
SLOT
(
selectedMapAttributeAdded
(
unsigned
int
,
const
QString
&
)));
connect
(
cur
,
SIGNAL
(
attributeModified
(
unsigned
int
,
const
QString
&
)),
this
,
SLOT
(
selectedMapAttributeModified
(
unsigned
int
,
const
QString
&
)));
connect
(
cur
,
SIGNAL
(
connectivityModified
()),
this
,
SLOT
(
selectedMapConnectivityModified
()));
m_selectionRadius
=
cur
->
getBBdiagSize
()
/
50.0
f
;
connect
(
cur
,
SIGNAL
(
boundingBoxModified
()),
this
,
SLOT
(
selectedMapBoundingBoxModified
()));
m_selectionRadiusBase
=
cur
->
getBBdiagSize
()
/
50.0
f
;
}
}
...
...
@@ -589,6 +587,12 @@ void Surface_Selection_Plugin::selectedMapConnectivityModified()
updateSelectedCellsRendering
();
}
void
Surface_Selection_Plugin
::
selectedMapBoundingBoxModified
()
{
MapHandlerGen
*
map
=
static_cast
<
MapHandlerGen
*>
(
QObject
::
sender
());
m_selectionRadiusBase
=
map
->
getBBdiagSize
()
/
50.0
f
;
}
...
...
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