Commit c72f5e9b authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud

Add tubefilter and color by magnitude.

parent db28eed0
......@@ -77,13 +77,10 @@ public:
public:
vtkSmartPointer<vtkStreamTracer> streamtracer;
vtkSmartPointer<vtkTubeFilter> tube_filter;
vtkSmartPointer<vtkPolyDataMapper> mapper;
vtkSmartPointer<vtkActor> actor;
public:
vtkSmartPointer<vtkTubeFilter> tube_filter;
vtkSmartPointer<vtkActor> tube_filter_actor;
public:
vtkSmartPointer<vtkCellCenters> cell_centers;
......@@ -125,8 +122,14 @@ dtkVisualizationDecoratorVectorStreamTracer::dtkVisualizationDecoratorVectorStre
d->streamtracer->SetMaximumError(1.e-6);
d->streamtracer->SetComputeVorticity(true);
d->tube_filter = vtkSmartPointer<vtkTubeFilter>::New();
d->tube_filter->SetInputConnection(d->streamtracer->GetOutputPort());
d->tube_filter->SetNumberOfSides(8);
d->tube_filter->SetRadius(.02);
d->tube_filter->SetVaryRadius(0);
d->mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
d->mapper->SetInputConnection(d->streamtracer->GetOutputPort());
d->mapper->SetInputConnection(d->tube_filter->GetOutputPort());
d->actor = vtkSmartPointer<vtkActor>::New();
d->actor->SetMapper(d->mapper);
......@@ -313,7 +316,7 @@ bool dtkVisualizationDecoratorVectorStreamTracer::setCurrentFieldName(const QStr
if(support == Support::Point) {
d->streamtracer->SetInputData(d_func()->dataset);
d->streamtracer->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, qPrintable(field_name));
d->mapper->SetScalarModeToUsePointData();
} else if(support == Support::Cell) {
d->streamtracer->SetInputConnection(d->cell_centers->GetOutputPort());
d->streamtracer->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, qPrintable(field_name));
......@@ -327,11 +330,13 @@ void dtkVisualizationDecoratorVectorStreamTracer::setColorMap(const QMap<double,
{
dtkVisualizationDecoratorWithClut::setColorMap(new_colormap);
// d->mapper->SetLookupTable(d_func()->color_function);
// d->mapper->SelectColorArray(qPrintable(d_func()->current_field_name));
// auto&& range = d_func()->ranges[d_func()->current_field_name];
// d->mapper->SetScalarRange(range[0], range[1]);
// d->mapper->Modified();
d_func()->color_function->SetVectorModeToMagnitude();
d->mapper->SetLookupTable(d_func()->color_function);
d->mapper->SelectColorArray(qPrintable(d_func()->current_field_name));
auto&& range = d_func()->ranges[d_func()->current_field_name];
d->mapper->SetScalarModeToUsePointFieldData();
d->mapper->SetScalarRange(range[0], range[1]);
d->mapper->Modified();
}
//
......
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