Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
3660e97d
Commit
3660e97d
authored
Aug 18, 2017
by
Alexander Wiebel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFAC] extract method
parent
e6990231
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
20 deletions
+28
-20
src/modules/pickingDVR/WMPickingDVR.cpp
src/modules/pickingDVR/WMPickingDVR.cpp
+23
-20
src/modules/pickingDVR/WMPickingDVR.h
src/modules/pickingDVR/WMPickingDVR.h
+5
-0
No files found.
src/modules/pickingDVR/WMPickingDVR.cpp
View file @
3660e97d
...
...
@@ -258,26 +258,7 @@ void WMPickingDVR::moduleMain()
{
if
(
m_externalScreenPos
->
isConnected
()
!=
0
&&
m_externalScreenPos
->
getData
()
)
{
float
fPosX
=
(
*
(
m_externalScreenPos
->
getData
()
)
)[
0
];
float
fPosY
=
(
*
(
m_externalScreenPos
->
getData
()
)
)[
1
];
boost
::
shared_ptr
<
WGraphicsEngine
>
graphicsEngine
=
WGraphicsEngine
::
getGraphicsEngine
();
boost
::
shared_ptr
<
WGEViewer
>
mainView
=
graphicsEngine
->
getViewerByName
(
"Main View"
);
osg
::
ref_ptr
<
osgViewer
::
Viewer
>
view
=
mainView
->
getView
();
osgUtil
::
LineSegmentIntersector
::
Intersections
intersections
;
bool
intersected
=
view
->
computeIntersections
(
fPosX
,
fPosY
,
intersections
,
0xFFFFFFFF
);
if
(
intersected
)
{
osgUtil
::
LineSegmentIntersector
::
Intersection
start
=
*
intersections
.
begin
();
osgUtil
::
LineSegmentIntersector
::
Intersection
end
=
*
intersections
.
rbegin
();
m_posStart
=
start
.
getWorldIntersectPoint
();
m_posEnd
=
end
.
getWorldIntersectPoint
();
m_intersected
=
true
;
}
setPickPositionFromConnector
();
}
// Valid position picked on proxy cube
...
...
@@ -420,6 +401,28 @@ void WMPickingDVR::setPickPositionSource()
}
}
void
WMPickingDVR
::
setPickPositionFromConnector
()
{
float
fPosX
=
(
*
(
m_externalScreenPos
->
getData
()
)
)[
0
];
float
fPosY
=
(
*
(
m_externalScreenPos
->
getData
()
)
)[
1
];
boost
::
shared_ptr
<
WGraphicsEngine
>
graphicsEngine
=
WGraphicsEngine
::
getGraphicsEngine
();
boost
::
shared_ptr
<
WGEViewer
>
mainView
=
graphicsEngine
->
getViewerByName
(
"Main View"
);
osg
::
ref_ptr
<
osgViewer
::
Viewer
>
view
=
mainView
->
getView
();
osgUtil
::
LineSegmentIntersector
::
Intersections
intersections
;
bool
intersected
=
view
->
computeIntersections
(
fPosX
,
fPosY
,
intersections
,
0xFFFFFFFF
);
if
(
intersected
)
{
osgUtil
::
LineSegmentIntersector
::
Intersection
start
=
*
intersections
.
begin
();
osgUtil
::
LineSegmentIntersector
::
Intersection
end
=
*
intersections
.
rbegin
();
m_posStart
=
start
.
getWorldIntersectPoint
();
m_posEnd
=
end
.
getWorldIntersectPoint
();
m_intersected
=
true
;
}
}
void
WMPickingDVR
::
updateModuleGUI
(
std
::
string
pickingMode
)
{
...
...
src/modules/pickingDVR/WMPickingDVR.h
View file @
3660e97d
...
...
@@ -110,6 +110,11 @@ private:
*/
void
setPickPositionSource
();
/**
* Set the current pick position to the \ref WSinglePosition from the connector.
*/
void
setPickPositionFromConnector
();
/**
* Shows and hide relevant properties according to chosen picking mode.
*
...
...
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