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
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
09b87f36
Commit
09b87f36
authored
Mar 17, 2021
by
Joshua Santana
Browse files
[ADD] allow changes for transfer function color bar name label and max scale value
parent
ae121dc8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
src/modules/filterProtonData/WCsvConverter.cpp
src/modules/filterProtonData/WCsvConverter.cpp
+4
-1
src/modules/transferFunctionColorBar/WMTransferFunctionColorBar.cpp
...s/transferFunctionColorBar/WMTransferFunctionColorBar.cpp
+8
-4
src/modules/transferFunctionColorBar/WMTransferFunctionColorBar.h
...les/transferFunctionColorBar/WMTransferFunctionColorBar.h
+10
-0
No files found.
src/modules/filterProtonData/WCsvConverter.cpp
View file @
09b87f36
...
...
@@ -156,6 +156,10 @@ void WCsvConverter::normalizeEdeps( SPFloatVector edeps, SPFloatVector colorArra
}
}
m_colorBar
->
getProperties
()
->
getProperty
(
"Max scale value"
)
->
set
(
0.0
);
m_colorBar
->
getProperties
()
->
getProperty
(
"Max scale value"
)
->
set
(
maxClusterSize
);
m_colorBar
->
getProperties
()
->
getProperty
(
"Description"
)
->
set
(
std
::
string
(
"Clustersize "
)
);
bool
activated
=
m_propertyStatus
->
getVisualizationPropertyHandler
()
->
getColorFromEdep
()
->
get
();
m_colorBar
->
getProperties
()
->
getProperty
(
"active"
)
->
toPropBool
()
->
set
(
activated
);
...
...
@@ -408,7 +412,6 @@ float WCsvConverter::stringToFloat( std::string str )
}
catch
(
const
boost
::
bad_lexical_cast
&
e
)
{
throw
WException
(
"The selected column has an incorrect format ("
+
str
+
"). Numbers (float) are expected. "
+
std
::
string
(
e
.
what
()
)
);
}
}
...
...
src/modules/transferFunctionColorBar/WMTransferFunctionColorBar.cpp
View file @
09b87f36
...
...
@@ -99,6 +99,10 @@ void WMTransferFunctionColorBar::properties()
m_colorBarLabels
->
setMin
(
0
);
m_colorBarLabels
->
setMax
(
55
);
m_maxScaleValue
=
m_properties
->
addProperty
(
"Max scale value"
,
"Maximum scale value in dataset"
,
1.0
,
true
);
m_colorBarDescription
=
m_properties
->
addProperty
(
"Description"
,
"Description of current transfer function"
,
std
::
string
(
"TransferFunction"
),
true
),
WModule
::
properties
();
}
...
...
@@ -214,7 +218,7 @@ void WMTransferFunctionColorBar::moduleMain()
osg
::
ref_ptr
<
WGELabel
>
nameLabel
=
new
WGELabel
();
nameLabel
->
setPosition
(
osg
::
Vec3
(
0.015
,
0.9
,
0.0
)
);
// nameLabel->setText( format( dataSet->getTexture()->name()->get() ) );
nameLabel
->
setText
(
format
(
"TransferFunction"
)
);
nameLabel
->
setText
(
format
(
m_colorBarDescription
->
get
()
)
);
nameLabel
->
setCharacterSize
(
0.015
);
nameLabel
->
setLayout
(
osgText
::
TextBase
::
VERTICAL
);
nameLabel
->
setAlignment
(
osgText
::
Text
::
BASE_LINE
);
...
...
@@ -247,7 +251,7 @@ void WMTransferFunctionColorBar::moduleMain()
m_barProjection
->
addChild
(
matrix
);
m_valueMin
=
0.0
;
// dataSet->getTexture()->minimum()->get();
m_valueScale
=
1.0
;
// dataSet->getTexture()->scale()->get();
m_valueScale
=
m_maxScaleValue
->
get
()
;
// dataSet->getTexture()->scale()->get();
// add
WKernel
::
getRunningKernel
()
->
getGraphicsEngine
()
->
getScene
()
->
insert
(
m_barProjection
);
...
...
@@ -281,7 +285,7 @@ void WMTransferFunctionColorBar::activate()
void
WMTransferFunctionColorBar
::
updateColorbarScale
(
osg
::
Node
*
scaleLabels
)
{
if
(
m_colorBarLabels
->
changed
(
true
)
)
if
(
m_colorBarLabels
->
changed
(
true
)
||
m_maxScaleValue
->
changed
(
true
)
)
{
const
double
labelXPos
=
0.060
;
osg
::
Geode
*
g
=
scaleLabels
->
asGeode
();
...
...
@@ -289,7 +293,7 @@ void WMTransferFunctionColorBar::updateColorbarScale( osg::Node* scaleLabels )
size_t
num
=
m_colorBarLabels
->
get
(
true
);
double
coordStep
=
0.8
/
static_cast
<
double
>
(
num
-
1
);
double
valueStep
=
m_
valueScale
/
static_cast
<
double
>
(
num
-
1
);
double
valueStep
=
m_
maxScaleValue
->
get
()
/
static_cast
<
double
>
(
num
-
1
);
// less than 2 labels is useless
if
(
num
<
2
)
...
...
src/modules/transferFunctionColorBar/WMTransferFunctionColorBar.h
View file @
09b87f36
...
...
@@ -147,6 +147,16 @@ private:
*/
WPropBool
m_colorBarBorder
;
/**
* Maximum scaling factor of the current dataset.
*/
WPropDouble
m_maxScaleValue
;
/**
* Description of the color bar.
*/
WPropString
m_colorBarDescription
;
/**
* The projection node for the colorbar and labels
*/
...
...
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