Commit e6d004a3 authored by LE BRETON Come's avatar LE BRETON Come

Fix misuage of vtk api.

parent a0f83fb9
...@@ -935,7 +935,7 @@ void dtkVisualizationWidgetsClutEditor::setOpacityTransferFunction(vtkPiecewiseF ...@@ -935,7 +935,7 @@ void dtkVisualizationWidgetsClutEditor::setOpacityTransferFunction(vtkPiecewiseF
void dtkVisualizationWidgetsClutEditor::updateTable(void) void dtkVisualizationWidgetsClutEditor::updateTable(void)
{ {
if(!d->colorTransferFunction || !d->opacityTransferFunction) if(!d->colorTransferFunction)
return; return;
for(dtkVisualizationWidgetsClutEditorVertex *vertex : d->table->vertices) { for(dtkVisualizationWidgetsClutEditorVertex *vertex : d->table->vertices) {
...@@ -946,19 +946,22 @@ void dtkVisualizationWidgetsClutEditor::updateTable(void) ...@@ -946,19 +946,22 @@ void dtkVisualizationWidgetsClutEditor::updateTable(void)
int size = d->colorTransferFunction->GetSize(); int size = d->colorTransferFunction->GetSize();
double *vtk_vertex = new double[2]; double *vtk_node = new double[6];
double *vtk_color = new double[3];
double alpha = 0; double alpha = 0;
for(int i = 0; i < size; ++i) { for(int i = 0; i < size; ++i) {
d->colorTransferFunction->GetNodeValue(i, &vtk_vertex[0]); d->colorTransferFunction->GetNodeValue(i, &vtk_node[0]);
d->colorTransferFunction->GetColor(vtk_vertex[0], &vtk_color[0]);
alpha = d->opacityTransferFunction->GetValue(vtk_vertex[0]); if(d->opacityTransferFunction) alpha = d->opacityTransferFunction->GetValue(vtk_node[0]);
dtkVisualizationWidgetsClutEditorVertex *new_vertex = new dtkVisualizationWidgetsClutEditorVertex(dtkVisualizationWidgetsClutEditorMap(QPointF(vtk_vertex[0], alpha), d->min, d->max, this->width(), 100, d->button_log->isChecked()), QColor(vtk_color[0] *255, vtk_color[1] * 255, vtk_color[2] * 255)); else alpha = 1.;
dtkVisualizationWidgetsClutEditorVertex *new_vertex = new dtkVisualizationWidgetsClutEditorVertex(dtkVisualizationWidgetsClutEditorMap(QPointF(vtk_node[0], alpha), d->min, d->max, this->width(), 100, d->button_log->isChecked()), QColor(vtk_node[1] *255, vtk_node[2] * 255, vtk_node[3] * 255));
d->table->addVertex(new_vertex); d->table->addVertex(new_vertex);
connect(new_vertex, SIGNAL(moved(const QPointF&)), d->scene, SIGNAL(moved(const QPointF&))); connect(new_vertex, SIGNAL(moved(const QPointF&)), d->scene, SIGNAL(moved(const QPointF&)));
} }
delete[] vtk_node;
} }
void dtkVisualizationWidgetsClutEditor::setRange(double min, double max) void dtkVisualizationWidgetsClutEditor::setRange(double min, double max)
......
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