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
3ea4e94e
Commit
3ea4e94e
authored
Aug 06, 2010
by
Alexander Wiebel
Browse files
Options
Browse Files
Download
Plain Diff
[MERGE]
parents
6f6b797c
db844a13
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
5 deletions
+111
-5
src/modules/arbitraryPlane/WMArbitraryPlane.cpp
src/modules/arbitraryPlane/WMArbitraryPlane.cpp
+79
-5
src/modules/arbitraryPlane/WMArbitraryPlane.h
src/modules/arbitraryPlane/WMArbitraryPlane.h
+32
-0
No files found.
src/modules/arbitraryPlane/WMArbitraryPlane.cpp
View file @
3ea4e94e
...
...
@@ -96,6 +96,12 @@ void WMArbitraryPlane::properties()
m_showComplete
=
m_properties
->
addProperty
(
"show complete"
,
"Slice should be drawn complete even if the texture value is zero."
,
false
,
m_propCondition
);
m_showManipulators
=
m_properties
->
addProperty
(
"show manipulators"
,
"Hide/Show manipulators."
,
true
,
m_propCondition
);
m_attach2Crosshair
=
m_properties
->
addProperty
(
"attach to crosshair"
,
"Attach to Crosshair"
,
false
,
m_propCondition
);
m_buttonReset2Axial
=
m_properties
->
addProperty
(
"Axial"
,
"resets and aligns the plane"
,
WPVBaseTypes
::
PV_TRIGGER_READY
,
m_propCondition
);
m_buttonReset2Coronal
=
m_properties
->
addProperty
(
"Coronal"
,
"resets and aligns the plane"
,
WPVBaseTypes
::
PV_TRIGGER_READY
,
m_propCondition
);
m_buttonReset2Sagittal
=
m_properties
->
addProperty
(
"Sagittal"
,
"resets and aligns the plane"
,
WPVBaseTypes
::
PV_TRIGGER_READY
,
m_propCondition
);
}
void
WMArbitraryPlane
::
moduleMain
()
...
...
@@ -122,6 +128,7 @@ void WMArbitraryPlane::moduleMain()
m_moduleState
.
setResetable
(
true
,
true
);
m_moduleState
.
add
(
m_propCondition
);
m_moduleState
.
add
(
m_active
->
getUpdateCondition
()
);
while
(
!
m_shutdownFlag
()
)
{
...
...
@@ -132,9 +139,9 @@ void WMArbitraryPlane::moduleMain()
m_dirty
=
true
;
}
if
(
m_
showManipulators
->
changed
()
)
if
(
m_
active
->
changed
()
)
{
if
(
m_
showManipulators
->
get
(
true
)
)
if
(
m_
active
->
get
()
&&
m_showManipulators
->
get
(
)
)
{
m_s0
->
unhide
();
m_s1
->
unhide
();
...
...
@@ -148,6 +155,55 @@ void WMArbitraryPlane::moduleMain()
}
}
if
(
m_showManipulators
->
changed
()
)
{
if
(
m_showManipulators
->
get
(
true
)
)
{
if
(
m_active
->
get
()
)
{
m_s0
->
unhide
();
m_s1
->
unhide
();
m_s2
->
unhide
();
}
}
else
{
m_s0
->
hide
();
m_s1
->
hide
();
m_s2
->
hide
();
}
}
if
(
m_buttonReset2Axial
->
get
(
true
)
==
WPVBaseTypes
::
PV_TRIGGER_TRIGGERED
)
{
wmath
::
WPosition
center
=
WKernel
::
getRunningKernel
()
->
getSelectionManager
()
->
getCrosshair
()
->
getPosition
();
m_s0
->
setPosition
(
center
);
m_s1
->
setPosition
(
wmath
::
WPosition
(
center
[
0
]
-
100
,
center
[
1
],
center
[
2
]
)
);
m_s2
->
setPosition
(
wmath
::
WPosition
(
center
[
0
],
center
[
1
]
-
100
,
center
[
2
]
)
);
m_buttonReset2Axial
->
set
(
WPVBaseTypes
::
PV_TRIGGER_READY
,
false
);
m_dirty
=
true
;
}
if
(
m_buttonReset2Coronal
->
get
(
true
)
==
WPVBaseTypes
::
PV_TRIGGER_TRIGGERED
)
{
wmath
::
WPosition
center
=
WKernel
::
getRunningKernel
()
->
getSelectionManager
()
->
getCrosshair
()
->
getPosition
();
m_s0
->
setPosition
(
center
);
m_s1
->
setPosition
(
wmath
::
WPosition
(
center
[
0
]
-
100
,
center
[
1
],
center
[
2
]
)
);
m_s2
->
setPosition
(
wmath
::
WPosition
(
center
[
0
],
center
[
1
],
center
[
2
]
-
100
)
);
m_buttonReset2Coronal
->
set
(
WPVBaseTypes
::
PV_TRIGGER_READY
,
false
);
m_dirty
=
true
;
}
if
(
m_buttonReset2Sagittal
->
get
(
true
)
==
WPVBaseTypes
::
PV_TRIGGER_TRIGGERED
)
{
wmath
::
WPosition
center
=
WKernel
::
getRunningKernel
()
->
getSelectionManager
()
->
getCrosshair
()
->
getPosition
();
m_s0
->
setPosition
(
center
);
m_s1
->
setPosition
(
wmath
::
WPosition
(
center
[
0
],
center
[
1
],
center
[
2
]
-
100
)
);
m_s2
->
setPosition
(
wmath
::
WPosition
(
center
[
0
],
center
[
1
]
-
100
,
center
[
2
]
)
);
m_buttonReset2Sagittal
->
set
(
WPVBaseTypes
::
PV_TRIGGER_READY
,
false
);
m_dirty
=
true
;
}
if
(
m_shutdownFlag
()
)
{
break
;
...
...
@@ -164,9 +220,10 @@ void WMArbitraryPlane::initPlane()
m_geode
->
addUpdateCallback
(
new
SafeUpdateCallback
(
this
)
);
m_rootNode
->
insert
(
m_geode
);
m_p0
=
wmath
::
WPosition
(
80
,
100
,
80
);
m_p1
=
wmath
::
WPosition
(
0
,
100
,
80
);
m_p2
=
wmath
::
WPosition
(
80
,
0
,
80
);
wmath
::
WPosition
center
=
WKernel
::
getRunningKernel
()
->
getSelectionManager
()
->
getCrosshair
()
->
getPosition
();
m_p0
=
wmath
::
WPosition
(
center
);
m_p1
=
wmath
::
WPosition
(
center
[
0
]
-
100
,
center
[
1
],
center
[
2
]
);
m_p2
=
wmath
::
WPosition
(
center
[
0
],
center
[
1
]
-
100
,
center
[
2
]
);
m_s0
=
boost
::
shared_ptr
<
WROISphere
>
(
new
WROISphere
(
m_p0
,
2.5
)
);
m_s1
=
boost
::
shared_ptr
<
WROISphere
>
(
new
WROISphere
(
m_p1
,
2.5
)
);
...
...
@@ -183,6 +240,11 @@ void WMArbitraryPlane::updatePlane()
{
m_geode
->
removeDrawables
(
0
,
1
);
if
(
m_attach2Crosshair
->
get
()
)
{
m_s0
->
setPosition
(
WKernel
::
getRunningKernel
()
->
getSelectionManager
()
->
getCrosshair
()
->
getPosition
()
);
}
wmath
::
WPosition
p0
=
m_s0
->
getPosition
();
if
(
p0
!=
m_p0
)
...
...
@@ -242,6 +304,13 @@ void WMArbitraryPlane::updatePlane()
void
WMArbitraryPlane
::
SafeUpdateCallback
::
operator
()(
osg
::
Node
*
node
,
osg
::
NodeVisitor
*
nv
)
{
wmath
::
WPosition
ch
=
WKernel
::
getRunningKernel
()
->
getSelectionManager
()
->
getCrosshair
()
->
getPosition
();
wmath
::
WPosition
cho
=
m_module
->
getCenterPosition
();
if
(
ch
[
0
]
!=
cho
[
0
]
||
ch
[
1
]
!=
cho
[
1
]
||
ch
[
2
]
!=
cho
[
2
]
)
{
m_module
->
setDirty
();
}
if
(
m_module
->
isDirty
()
)
{
m_module
->
updatePlane
();
...
...
@@ -397,3 +466,8 @@ void WMArbitraryPlane::initUniforms( osg::StateSet* rootState )
rootState
->
addUniform
(
m_showCompleteUniform
);
}
wmath
::
WPosition
WMArbitraryPlane
::
getCenterPosition
()
{
return
m_s0
->
getPosition
();
}
src/modules/arbitraryPlane/WMArbitraryPlane.h
View file @
3ea4e94e
...
...
@@ -141,6 +141,14 @@ protected:
*/
void
notifyTextureChange
();
/**
* getter for the position of the center manipulator
*
* \return center position
*/
wmath
::
WPosition
getCenterPosition
();
private:
/**
* A condition used to notify about changes in several properties.
...
...
@@ -158,6 +166,30 @@ private:
*/
WPropBool
m_showManipulators
;
/**
* If true the center position will move with the nav slice selection
*/
WPropBool
m_attach2Crosshair
;
/**
* When triggered the center manipulator is set to the nav slice position and the plane is aligned along
* the axial slice
*/
WPropTrigger
m_buttonReset2Axial
;
/**
* When triggered the center manipulator is set to the nav slice position and the plane is aligned along
* the coronal slice
*/
WPropTrigger
m_buttonReset2Coronal
;
/**
* When triggered the center manipulator is set to the nav slice position and the plane is aligned along
* the axial slice
*/
WPropTrigger
m_buttonReset2Sagittal
;
/**
* The root node used for this modules graphics.
...
...
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