Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 0adae229 authored by LE BRETON Come's avatar LE BRETON Come

Merge branch 'release/2.2.1'

parents f8928eaf 77a2aef9
# Change Log: # Change Log:
## 2.2.1 20-Sep-2018
- addField is now deprecated, use addFieldX and addFieldY instead
- more accessors are available for overload
## 2.2.0 19-Sep-2018 ## 2.2.0 19-Sep-2018
- add methods for Plot 2D to add/remove fields - add methods for Plot 2D to add/remove fields
......
...@@ -24,7 +24,7 @@ project(dtkVisualization) ...@@ -24,7 +24,7 @@ project(dtkVisualization)
set(${PROJECT_NAME}_VERSION_MAJOR 2) set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 2) set(${PROJECT_NAME}_VERSION_MINOR 2)
set(${PROJECT_NAME}_VERSION_PATCH 0) set(${PROJECT_NAME}_VERSION_PATCH 1)
set(${PROJECT_NAME}_VERSION set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}) ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
......
...@@ -37,7 +37,7 @@ int main(int argc, char **argv) ...@@ -37,7 +37,7 @@ int main(int argc, char **argv)
application.setApplicationName("dtkVisualizationViewer"); application.setApplicationName("dtkVisualizationViewer");
application.setOrganizationName("inria"); application.setOrganizationName("inria");
application.setOrganizationDomain("fr"); application.setOrganizationDomain("fr");
application.setApplicationVersion("2.2.0"); application.setApplicationVersion("2.2.1");
dtkVisualizationViewer *viewer = new dtkVisualizationViewer; dtkVisualizationViewer *viewer = new dtkVisualizationViewer;
viewer->show(); viewer->show();
......
...@@ -23,7 +23,7 @@ int main(int argc, char **argv) ...@@ -23,7 +23,7 @@ int main(int argc, char **argv)
application.setApplicationName("dtkVisualizationOverlayPaneItem"); application.setApplicationName("dtkVisualizationOverlayPaneItem");
application.setOrganizationName("inria"); application.setOrganizationName("inria");
application.setOrganizationDomain("fr"); application.setOrganizationDomain("fr");
application.setApplicationVersion("2.2.0"); application.setApplicationVersion("2.2.1");
QFormLayout *layout_1 = new QFormLayout; QFormLayout *layout_1 = new QFormLayout;
layout_1->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); layout_1->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
......
...@@ -22,7 +22,7 @@ int main(int argc, char **argv) ...@@ -22,7 +22,7 @@ int main(int argc, char **argv)
application.setApplicationName("dtkVisualizationOverlayRope"); application.setApplicationName("dtkVisualizationOverlayRope");
application.setOrganizationName("inria"); application.setOrganizationName("inria");
application.setOrganizationDomain("fr"); application.setOrganizationDomain("fr");
application.setApplicationVersion("2.2.0"); application.setApplicationVersion("2.2.1");
dtkWidgetsOverlayRope *window = new dtkWidgetsOverlayRope; dtkWidgetsOverlayRope *window = new dtkWidgetsOverlayRope;
window->setWindowTitle("dtkVisualizationOverlayRope"); window->setWindowTitle("dtkVisualizationOverlayRope");
......
...@@ -33,7 +33,7 @@ int main(int argc, char **argv) ...@@ -33,7 +33,7 @@ int main(int argc, char **argv)
application.setApplicationName("dtkVisualizationPlot2D"); application.setApplicationName("dtkVisualizationPlot2D");
application.setOrganizationName("inria"); application.setOrganizationName("inria");
application.setOrganizationDomain("fr"); application.setOrganizationDomain("fr");
application.setApplicationVersion("2.2.0"); application.setApplicationVersion("2.2.1");
// /////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////
// Field data // Field data
...@@ -65,9 +65,9 @@ int main(int argc, char **argv) ...@@ -65,9 +65,9 @@ int main(int argc, char **argv)
// /////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////
dtkVisualizationPlot2D *plot = new dtkVisualizationPlot2D; dtkVisualizationPlot2D *plot = new dtkVisualizationPlot2D;
plot->setWindowTitle("dtkVisualizationPlot2D"); plot->setWindowTitle("dtkVisualizationPlot2D");
plot->addField(field_1); plot->addFieldX(field_1);
plot->addField(field_2, true, vtkChart::LINE, vtkPlotPoints::NONE); plot->addFieldY(field_2, true, vtkChart::LINE, vtkPlotPoints::NONE);
plot->addField(field_3); plot->addFieldY(field_3);
plot->show(); plot->show();
plot->raise(); plot->raise();
plot->render(); plot->render();
...@@ -78,6 +78,8 @@ int main(int argc, char **argv) ...@@ -78,6 +78,8 @@ int main(int argc, char **argv)
qDebug() << plot->fields(); qDebug() << plot->fields();
plot->addFieldX(field_3);
plot->removeField("third_field");
// /////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////
return application.exec(); return application.exec();
......
...@@ -88,13 +88,18 @@ public: ...@@ -88,13 +88,18 @@ public:
dtkWidgetsHUD *hud; dtkWidgetsHUD *hud;
dtkWidgetsOverlayPane *overlay; dtkWidgetsOverlayPane *overlay;
struct FieldParameters {
int chart_type;
int marker_style;
int width;
QColor color;
};
public: public:
QComboBox *field_x; QComboBox *field_x;
QListWidget *field_y; QListWidget *field_y;
QStringListModel *fields_table_model; QStringListModel *fields_table_model;
QMap<QString, int> chart_type; QMap<QString, FieldParameters> fields_parameters;
QMap<QString, QColor> fields_color;
QMap<QString, int> marker_style;
bool show_legend = true; bool show_legend = true;
}; };
...@@ -312,16 +317,17 @@ void dtkVisualizationPlot2D::render(void) ...@@ -312,16 +317,17 @@ void dtkVisualizationPlot2D::render(void)
for(int row=0; row < d->field_y->count(); ++row) { for(int row=0; row < d->field_y->count(); ++row) {
if(d->field_y->item(row)->checkState() == Qt::Checked) { if(d->field_y->item(row)->checkState() == Qt::Checked) {
int chart_type = d->chart_type[d->field_y->item(row)->text()]; dtkVisualizationPlot2DPrivate::FieldParameters param = d->fields_parameters[d->field_y->item(row)->text()];
vtkPlot *points = d->chart->AddPlot(chart_type);
vtkPlot *points = d->chart->AddPlot(param.chart_type);
points->SetInputData(d->fields_table, points->SetInputData(d->fields_table,
d->field_x->currentText().toStdString(), d->field_x->currentText().toStdString(),
d->field_y->item(row)->text().toStdString()); d->field_y->item(row)->text().toStdString());
QColor color = d->fields_color[d->field_y->item(row)->text()];
points->SetColor(color.red(), color.green(), color.blue(), 255); points->SetColor(param.color.red(), param.color.green(), param.color.blue(), 255);
points->GetBrush()->SetColor(255, 64, 64); points->GetBrush()->SetColor(255, 64, 64);
points->SetWidth(1.0); points->SetWidth(param.width);
vtkPlotPoints::SafeDownCast(points)->SetMarkerStyle(d->marker_style[d->field_y->item(row)->text()]); vtkPlotPoints::SafeDownCast(points)->SetMarkerStyle(param.marker_style);
} }
} }
...@@ -333,28 +339,53 @@ QStringList dtkVisualizationPlot2D::fields(void) ...@@ -333,28 +339,53 @@ QStringList dtkVisualizationPlot2D::fields(void)
return d->fields_table_model->stringList(); return d->fields_table_model->stringList();
} }
void dtkVisualizationPlot2D::addField(vtkSmartPointer<vtkAbstractArray> field, bool checked, int chart_type, int marker_style) void dtkVisualizationPlot2D::addFieldX(vtkSmartPointer<vtkAbstractArray> field)
{
d->fields_table->AddColumn(field);
d->field_x->addItem(field->GetName());
d->field_x->model()->sort(0);
}
void dtkVisualizationPlot2D::addFieldY(vtkSmartPointer<vtkAbstractArray> field,
bool checked,
int chart_type,
int marker_style,
QColor color,
int width)
{ {
Q_ASSERT_X(chart_type >= 0 && chart_type < 7, "setChartType", "0: Line , 1: Points , 2: Bar , 3: Stacked , 4: Bag , 5: functionalBag , 6: Area -> as in vtkPlot"); Q_ASSERT_X(chart_type >= 0 && chart_type < 7, "setChartType", "0: Line , 1: Points , 2: Bar , 3: Stacked , 4: Bag , 5: functionalBag , 6: Area -> as in vtkPlot");
Q_ASSERT_X(marker_style >= 0 && marker_style < 6, "setMarkerStyle", "NONE , CROSS , PLUS , SQUARE , CIRCLE , DIAMOND "); Q_ASSERT_X(marker_style >= 0 && marker_style < 6, "setMarkerStyle", "NONE , CROSS , PLUS , SQUARE , CIRCLE , DIAMOND ");
d->fields_table->AddColumn(field); d->fields_table->AddColumn(field);
d->chart_type[field->GetName()] = chart_type; dtkVisualizationPlot2DPrivate::FieldParameters param;
d->fields_color[field->GetName()] = d->random(); param.chart_type = chart_type;
d->marker_style[field->GetName()] = marker_style; param.marker_style = marker_style;
d->field_x->addItem(field->GetName()); param.width = width;
if(color == Qt::transparent) {
param.color = d->random();
} else {
param.color = color;
}
d->fields_parameters[field->GetName()] = param;
QListWidgetItem *new_field_item = new QListWidgetItem(field->GetName(), d->field_y); QListWidgetItem *new_field_item = new QListWidgetItem(field->GetName(), d->field_y);
new_field_item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable); new_field_item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
new_field_item->setCheckState(Qt::Unchecked); new_field_item->setCheckState(Qt::Unchecked);
new_field_item->setCheckState(checked ? Qt::Checked : Qt::Unchecked); new_field_item->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
d->field_x->model()->sort(0);
d->field_y->sortItems(); d->field_y->sortItems();
this->render(); this->render();
} }
void dtkVisualizationPlot2D::addField(vtkSmartPointer<vtkAbstractArray> field, bool checked, int chart_type, int marker_style)
{
this->addFieldX(field);
this->addFieldY(field, checked, chart_type, marker_style);
}
void dtkVisualizationPlot2D::removeField(vtkSmartPointer<vtkAbstractArray> field) void dtkVisualizationPlot2D::removeField(vtkSmartPointer<vtkAbstractArray> field)
{ {
this->removeField(field->GetName()); this->removeField(field->GetName());
...@@ -363,17 +394,12 @@ void dtkVisualizationPlot2D::removeField(vtkSmartPointer<vtkAbstractArray> field ...@@ -363,17 +394,12 @@ void dtkVisualizationPlot2D::removeField(vtkSmartPointer<vtkAbstractArray> field
void dtkVisualizationPlot2D::removeField(const QString& field) void dtkVisualizationPlot2D::removeField(const QString& field)
{ {
int idx = d->field_x->findText(field); int idx = d->field_x->findText(field);
if(idx > 0) {
Q_ASSERT(idx > 0); d->field_x->removeItem(idx);
}
d->field_x->removeItem(idx);
qDeleteAll(d->field_y->findItems(field, Qt::MatchFixedString)); qDeleteAll(d->field_y->findItems(field, Qt::MatchFixedString));
d->fields_parameters.remove(field);
d->chart_type.remove(field);
d->fields_color.remove(field);
d->marker_style.remove(field);
d->fields_table->RemoveColumnByName(field.toStdString().c_str()); d->fields_table->RemoveColumnByName(field.toStdString().c_str());
} }
......
...@@ -50,7 +50,14 @@ public: ...@@ -50,7 +50,14 @@ public:
QStringList fields(void); QStringList fields(void);
public: public:
void addField(vtkSmartPointer<vtkAbstractArray>, bool checked = false, int type = vtkChart::POINTS, int marker_style = vtkPlotPoints::PLUS); [[deprecated]] void addField(vtkSmartPointer<vtkAbstractArray>, bool checked = false, int type = vtkChart::POINTS, int marker_style = vtkPlotPoints::PLUS);
void addFieldX(vtkSmartPointer<vtkAbstractArray>);
void addFieldY(vtkSmartPointer<vtkAbstractArray>,
bool checked = false,
int type = vtkChart::POINTS,
int marker_style = vtkPlotPoints::PLUS,
QColor color = Qt::transparent,
int width = 1);
void removeField(vtkSmartPointer<vtkAbstractArray>); void removeField(vtkSmartPointer<vtkAbstractArray>);
void removeField(const QString&); void removeField(const QString&);
void setShowLegend(bool); void setShowLegend(bool);
......
...@@ -188,6 +188,16 @@ vtkRenderer *dtkVisualizationView2D::renderer(void) ...@@ -188,6 +188,16 @@ vtkRenderer *dtkVisualizationView2D::renderer(void)
return d->renderer; return d->renderer;
} }
vtkRenderWindow *dtkVisualizationView2D::renderWindow(void)
{
return d->window;
}
vtkRenderWindowInteractor *dtkVisualizationView2D::renderWindowInteractor(void)
{
return d->GetInteractor();
}
void dtkVisualizationView2D::dragEnterEvent(QDragEnterEvent *event) void dtkVisualizationView2D::dragEnterEvent(QDragEnterEvent *event)
{ {
if (event->mimeData()->hasText()) if (event->mimeData()->hasText())
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include <dtkVisualizationExport> #include <dtkVisualizationExport>
class vtkRenderer; class vtkRenderer;
class vtkRenderWindow;
class vtkRenderWindowInteractor;
class DTKVISUALIZATION_EXPORT dtkVisualizationView2D : public dtkWidgetsWidget class DTKVISUALIZATION_EXPORT dtkVisualizationView2D : public dtkWidgetsWidget
{ {
...@@ -42,7 +44,9 @@ public: ...@@ -42,7 +44,9 @@ public:
dtkWidgetsOverlayPane *overlay(void); dtkWidgetsOverlayPane *overlay(void);
public: public:
vtkRenderer *renderer(void); vtkRenderer *renderer(void);
vtkRenderWindow *renderWindow(void);
vtkRenderWindowInteractor *renderWindowInteractor(void);
protected: protected:
void dragEnterEvent(QDragEnterEvent *event); void dragEnterEvent(QDragEnterEvent *event);
......
...@@ -105,8 +105,6 @@ dtkVisualizationView3DPrivate::dtkVisualizationView3DPrivate(QWidget *parent) : ...@@ -105,8 +105,6 @@ dtkVisualizationView3DPrivate::dtkVisualizationView3DPrivate(QWidget *parent) :
this->overlay->addWidget(clut_item); this->overlay->addWidget(clut_item);
this->overlay->toggle(); this->overlay->toggle();
qDebug() << Q_FUNC_INFO;
connect(this->overlay, &dtkWidgetsOverlayPane::entered, [=] () { connect(this->overlay, &dtkWidgetsOverlayPane::entered, [=] () {
this->GetInteractor()->Disable(); this->GetInteractor()->Disable();
}); });
...@@ -220,7 +218,7 @@ void dtkVisualizationView3D::unlink(void) ...@@ -220,7 +218,7 @@ void dtkVisualizationView3D::unlink(void)
void dtkVisualizationView3D::update(void) void dtkVisualizationView3D::update(void)
{ {
d->actors->update(); // d->actors->update();
bool enabled = d->GetInteractor()->GetEnabled(); bool enabled = d->GetInteractor()->GetEnabled();
......
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