Commit 83628b91 authored by Pierre Fernique's avatar Pierre Fernique

Remove support for glyphs

parent 934ec15a
......@@ -162,7 +162,7 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
dtkVisualizationDecoratorScalarIsolines *decorator_scalar_isolines = new dtkVisualizationDecoratorScalarIsolines;
dtkVisualizationDecoratorScalarGlyphs *decorator_scalar_glyphs = new dtkVisualizationDecoratorScalarGlyphs;
decorator_clut_editor->setName("my clut editor");
// decorator_clut_editor->setName("my clut editor");
//chain all decorators
*decorator_clut_editor << *decorator_scalar_isolines << *decorator_scalar_glyphs << *decorator_scalar_color_map ;
......
......@@ -46,12 +46,6 @@
class dtkVisualizationDecoratorScalarColorMapPrivate
{
public:
enum Support {
Point,
Cell
};
public:
QStringList eligible_field_names;
QString current_field_name;
......@@ -66,10 +60,6 @@ public:
public:
vtkSmartPointer<vtkActor> actor;
vtkSmartPointer<vtkDataSetMapper> mapper;
public:
QHash<QString, Support> supports;
};
// ///////////////////////////////////////////////////////////////////
......@@ -100,11 +90,8 @@ dtkVisualizationDecoratorScalarColorMap::~dtkVisualizationDecoratorScalarColorMa
void dtkVisualizationDecoratorScalarColorMap::draw(void)
{
if (d->supports[d->current_field_name] == dtkVisualizationDecoratorScalarColorMapPrivate::Support::Point) {
d->dataset->GetPointData()->SetActiveScalars(qPrintable(d->current_field_name));
} else if (d->supports[d->current_field_name] == dtkVisualizationDecoratorScalarColorMapPrivate::Support::Cell) {
d->dataset->GetCellData()->SetActiveScalars(qPrintable(d->current_field_name));
}
d->dataset->GetPointData()->SetActiveScalars(qPrintable(d->current_field_name));
if (!d->dataset || d->current_field_name.isEmpty()) {
dtkWarn() << Q_FUNC_INFO << "Set dataset and field name before updating actor.";
return;
......@@ -134,30 +121,16 @@ void dtkVisualizationDecoratorScalarColorMap::setData(const QVariant& data)
d->current_field_name.clear();
d->eligible_field_names.clear();
d->supports.clear();
vtkIdType number_of_point_arrays = d->dataset->GetPointData()->GetNumberOfArrays();
for (vtkIdType i = 0; i < number_of_point_arrays; ++i) {
if (d->dataset->GetPointData()->GetArray(i)->GetNumberOfComponents() == 1) {
QString field_name = QString::fromUtf8(d->dataset->GetPointData()->GetArrayName(i));
d->eligible_field_names << field_name;
d->supports[field_name] = dtkVisualizationDecoratorScalarColorMapPrivate::Support::Point;
d->dataset->GetPointData()->SetActiveScalars(qPrintable(field_name));
}
}
vtkIdType number_of_cell_arrays = d->dataset->GetCellData()->GetNumberOfArrays();
for (vtkIdType i = 0; i < number_of_cell_arrays; ++i) {
if (d->dataset->GetCellData()->GetArray(i)->GetNumberOfComponents() == 1) {
QString field_name = QString::fromUtf8(d->dataset->GetCellData()->GetArrayName(i));
d->eligible_field_names << field_name;
d->supports[field_name] = dtkVisualizationDecoratorScalarColorMapPrivate::Support::Cell;
d->dataset->GetCellData()->SetActiveScalars(qPrintable(field_name));
}
}
if (d->eligible_field_names.size() > 0) {
d->eligible_field_names.sort();
......@@ -363,11 +336,7 @@ bool dtkVisualizationDecoratorScalarColorMap::setCurrentFieldName(const QString&
d->current_field_name = scalar_field_name;
if (d->supports[d->current_field_name] == dtkVisualizationDecoratorScalarColorMapPrivate::Support::Point) {
d->dataset->GetPointData()->SetActiveScalars(qPrintable(d->current_field_name));
} else if (d->supports[d->current_field_name] == dtkVisualizationDecoratorScalarColorMapPrivate::Support::Cell) {
d->dataset->GetCellData()->SetActiveScalars(qPrintable(d->current_field_name));
}
d->dataset->GetPointData()->SetActiveScalars(qPrintable(d->current_field_name));
vtkSmartPointer<vtkColorTransferFunction> color_function;
QPair<double, double> range;
......
......@@ -133,6 +133,12 @@ dtkVisualizationDecoratorScalarGlyphs::~dtkVisualizationDecoratorScalarGlyphs(vo
void dtkVisualizationDecoratorScalarGlyphs::draw(void)
{
if (d->supports[d->current_field_name] == dtkVisualizationDecoratorScalarGlyphsPrivate::Support::Point) {
d->dataset->GetPointData()->SetActiveScalars(qPrintable(d->current_field_name));
} else if (d->supports[d->current_field_name] == dtkVisualizationDecoratorScalarGlyphsPrivate::Support::Cell) {
d->dataset->GetCellData()->SetActiveScalars(qPrintable(d->current_field_name));
}
if (!d->dataset || d->current_field_name.isEmpty()) {
dtkWarn() << Q_FUNC_INFO << "Set dataset and field name before updating actor.";
return;
......
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