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
D
dtk-visualization
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
11
Issues
11
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
dtk
dtk-visualization
Commits
88a72383
Commit
88a72383
authored
Dec 04, 2020
by
NICLAUSSE Nicolas
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/2.25.0' into master
parents
29ad435d
9bc9f18c
Pipeline
#193659
failed with stage
in 0 seconds
Changes
4
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
3 deletions
+62
-3
CHANGELOG.md
CHANGELOG.md
+3
-0
CMakeLists.txt
CMakeLists.txt
+1
-1
src/dtkVisualization/dtkVisualizationCanvas.cpp
src/dtkVisualization/dtkVisualizationCanvas.cpp
+55
-2
src/dtkVisualization/dtkVisualizationCanvas.h
src/dtkVisualization/dtkVisualizationCanvas.h
+3
-0
No files found.
CHANGELOG.md
View file @
88a72383
# Change Log:
# 2.25.0 04-Dec-2020
-
add setTitle in dtkVisualizationCanvas API
# 2.24.0 31-Jul-2020
-
fix: use previous setting of each slice when show is called
-
vector glyph auto scale can be turned off
...
...
CMakeLists.txt
View file @
88a72383
...
...
@@ -23,7 +23,7 @@ project(dtkVisualization)
## ###################################################################
set
(
${
PROJECT_NAME
}
_VERSION_MAJOR 2
)
set
(
${
PROJECT_NAME
}
_VERSION_MINOR 2
4
)
set
(
${
PROJECT_NAME
}
_VERSION_MINOR 2
5
)
set
(
${
PROJECT_NAME
}
_VERSION_PATCH 0
)
set
(
${
PROJECT_NAME
}
_VERSION
${${
PROJECT_NAME
}
_VERSION_MAJOR
}
.
${${
PROJECT_NAME
}
_VERSION_MINOR
}
.
${${
PROJECT_NAME
}
_VERSION_PATCH
}
)
...
...
src/dtkVisualization/dtkVisualizationCanvas.cpp
View file @
88a72383
...
...
@@ -14,6 +14,7 @@
#include "dtkVisualizationCanvas.h"
#include <dtkThemes>
#include <dtkWidgets>
#include <QtCore>
...
...
@@ -30,6 +31,8 @@
#include <vtkScalarBarRepresentation.h>
#include <vtkScalarBarWidget.h>
#include <vtkSmartPointer.h>
#include <vtkTextActor.h>
#include <vtkTextProperty.h>
#include <vtkTransform.h>
#include <vtkProperty2D.h>
...
...
@@ -69,11 +72,15 @@ public:
public:
dtkWidgetsHUD
*
hud
=
nullptr
;
public:
QString
title
;
vtkSmartPointer
<
vtkTextActor
>
textActor
;
public:
std
::
size_t
nb_scalar_bars
=
0
;
};
//
//
/////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
dtkVisualizationCanvasPrivate
::
dtkVisualizationCanvasPrivate
(
QWidget
*
parent
)
:
QVTKOpenGLNativeWidget
(
parent
)
{
...
...
@@ -114,8 +121,13 @@ QSize dtkVisualizationCanvasPrivate::sizeHint(void) const
void
dtkVisualizationCanvasPrivate
::
resizeEvent
(
QResizeEvent
*
event
)
{
if
(
!
this
->
title
.
isEmpty
())
{
QFontMetrics
metrics
(
qApp
->
font
());
int
pos_x
=
this
->
size
().
width
()
/
2
-
metrics
.
width
(
title
)
/
2
;
this
->
textActor
->
SetPosition
(
pos_x
,
10
);
this
->
textActor
->
Modified
();
}
QVTKOpenGLNativeWidget
::
resizeEvent
(
event
);
this
->
hud
->
resize
(
event
->
size
());
}
...
...
@@ -159,6 +171,47 @@ QWidget *dtkVisualizationCanvas::widget(void)
return
d
;
}
void
dtkVisualizationCanvas
::
setTitle
(
const
QString
&
title
)
{
if
(
title
.
isEmpty
())
{
if
(
d
->
textActor
)
d
->
renderer
->
RemoveActor
(
d
->
textActor
);
return
;
}
QColor
fg
=
dtkThemesEngine
::
instance
()
->
color
(
"@fg"
);
QColor
bg
=
dtkThemesEngine
::
instance
()
->
color
(
"@bg"
);
// Setup the text and add it to the renderer
if
(
!
d
->
textActor
)
d
->
textActor
=
vtkSmartPointer
<
vtkTextActor
>::
New
();
d
->
textActor
->
SetInput
(
qPrintable
(
title
)
);
d
->
textActor
->
GetTextProperty
()
->
SetFontSize
(
12
);
d
->
textActor
->
GetTextProperty
()
->
SetColor
(
1.0
-
fg
.
red
(),
1.0
-
fg
.
green
(),
1.0
-
fg
.
blue
());
d
->
textActor
->
GetTextProperty
()
->
SetBackgroundColor
(
1.0
-
bg
.
red
(),
1.0
-
bg
.
green
(),
1.0
-
bg
.
blue
());
d
->
textActor
->
GetTextProperty
()
->
SetBackgroundOpacity
(
0.6
);
d
->
renderer
->
AddActor2D
(
d
->
textActor
);
if
(
!
d
->
title
.
isEmpty
())
{
// not the first call, skip connect
d
->
title
=
title
;
return
;
}
d
->
title
=
title
;
connect
(
dtkThemesEngine
::
instance
(),
&
dtkThemesEngine
::
changed
,
[
=
]
()
{
QColor
fg
=
dtkThemesEngine
::
instance
()
->
color
(
"@fg"
);
QColor
bg
=
dtkThemesEngine
::
instance
()
->
color
(
"@bg"
);
d
->
textActor
->
GetTextProperty
()
->
SetColor
(
1.0
-
fg
.
red
(),
1.0
-
fg
.
green
(),
1.0
-
fg
.
blue
());
d
->
textActor
->
GetTextProperty
()
->
SetBackgroundColor
(
1.0
-
bg
.
red
(),
1.0
-
bg
.
green
(),
1.0
-
bg
.
blue
());
this
->
draw
();
});
}
void
dtkVisualizationCanvas
::
link
(
dtkVisualizationCanvas
*
other
)
{
d
->
renderer
->
SetActiveCamera
(
other
->
d
->
renderer
->
GetActiveCamera
());
...
...
src/dtkVisualization/dtkVisualizationCanvas.h
View file @
88a72383
...
...
@@ -57,6 +57,9 @@ public:
void
addScalarBar
(
vtkScalarBarWidget
*
,
bool
scalar_bar_is_seek_bar
=
false
);
void
removeScalarBar
(
vtkScalarBarWidget
*
);
public:
virtual
void
setTitle
(
const
QString
&
);
private:
class
dtkVisualizationCanvasPrivate
*
d
;
};
...
...
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