Commit 7ca21478 authored by ZUBIAGA Carlos J.'s avatar ZUBIAGA Carlos J.
Browse files

Merge remote-tracking branch 'origin/develop' into feature/plot2d_multiple_sources

parents 0ee26bed 75f72a30
Pipeline #158451 passed with stage
in 0 seconds
# dtk-visualization
[![Anaconda-Server Badge](https://anaconda.org/dtk-forge/dtk-visualization/badges/version.svg)](https://anaconda.org/dtk-forge/dtk-visualization)
[![Anaconda-Server Badge](https://anaconda.org/dtk-forge/dtk-visualization/badges/latest_release_date.svg)](https://anaconda.org/dtk-forge/dtk-visualization)
[![Anaconda-Server Badge](https://anaconda.org/dtk-forge/dtk-visualization/badges/platforms.svg)](https://anaconda.org/dtk-forge/dtk-visualization)
`dtk-visualization` is a bridge between Qt and VTK and requires no additional dependency. Assuming VTK datasets as an input it provides visualization option in a most intuitive way as possible. Therefore, few filters are used.
Its purpose is double:
......
......@@ -219,12 +219,16 @@ void dtkVisualizationCanvas::addScalarBar(vtkScalarBarWidget *scalar_bar_widget,
{
vtkScalarBarActor* scalar_bar = scalar_bar_widget->GetScalarBarActor();
if (this->renderer() && this->renderer()->GetViewProps()->IsItemPresent(scalar_bar)) {
return;
}
if(this->renderer()) {
if (scalar_bar_widget->GetInteractor() == this->interactor()) {
// scalar bar already added to this interactor, skip
return;
}
if (this->renderer()) {
//this->renderer()->AddActor2D(scalar_bar);
this->renderer()->Render();
}
......@@ -233,9 +237,9 @@ void dtkVisualizationCanvas::addScalarBar(vtkScalarBarWidget *scalar_bar_widget,
++d->nb_scalar_bars;
int display_level = (d->nb_scalar_bars - 1) / 4;
int display_level = (d->nb_scalar_bars - 1) / 4;
int side_slot = (d->nb_scalar_bars - 1) % 4; // display slots are ordered as follows:
/*
/*
_______________________________________
| 111111 | scalar bar positioning-corner is marked with X:
| 555555 | X_____________________
......@@ -253,7 +257,7 @@ void dtkVisualizationCanvas::addScalarBar(vtkScalarBarWidget *scalar_bar_widget,
*/
int is_vertical = (side_slot == 0) || (side_slot == 2);
int is_left = (side_slot == 1) || (side_slot == 2);
scalar_bar->SetOrientation(is_vertical);
scalar_bar->SetBarRatio(0.45);
......@@ -264,12 +268,12 @@ void dtkVisualizationCanvas::addScalarBar(vtkScalarBarWidget *scalar_bar_widget,
double thickness = 0.05;
double xmin = 0.02;
double ymin = (scalar_bar_is_seek_bar ? 0.10 : 0.02); //(xmin, ymin) is the bottom-left corner, because the origin is at the bottom-left corner.
double xmax = 0.98;
double xmax = 0.98;
double ymax = 0.90; //(xmax, ymax) is the top-right corner, because the origin is at the bottom-left corner.
double x = xmin;
double y = ymin;
switch(side_slot)
{
case 0:
......@@ -291,13 +295,13 @@ void dtkVisualizationCanvas::addScalarBar(vtkScalarBarWidget *scalar_bar_widget,
default:
break;
}
// if more than 4 bars are displayed, they are shown by default in concentric circles, piling up.
double space_x = pow(-1, is_left) * display_level * thickness * double(is_vertical);
double space_y = pow(-1, is_left + 1) * display_level * thickness * double(!is_vertical);
x -= space_x;
y -= space_y;
double start_pos[2] = {0, 0};
start_pos[0] = x;
start_pos[1] = y;
......@@ -305,7 +309,7 @@ void dtkVisualizationCanvas::addScalarBar(vtkScalarBarWidget *scalar_bar_widget,
size[0] = length * !is_vertical + thickness * is_vertical;
size[1] = length * is_vertical + thickness * !is_vertical;
// qDebug("pos: (%f %f), (%f %f) - display_level = %d", start_pos[0], start_pos[1], size[0], size[1], display_level);
r->SetPosition(start_pos);
r->SetPosition2(size); // this is SetSize. It's badly named. But it sets the representation size.
r->SetProportionalResize(false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment