Commit 755b9b44 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

add Polygon glyph + fix bug setting current source

parent eee74144
......@@ -38,6 +38,7 @@
#include <vtkPointData.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRegularPolygonSource.h>
#include <vtkRendererCollection.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
......@@ -78,6 +79,7 @@ public:
vtkSmartPointer<vtkCylinderSource> source_cylinder;
vtkSmartPointer<vtkSphereSource> source_sphere;
vtkSmartPointer<vtkGlyph3D> glyphs;
vtkSmartPointer<vtkRegularPolygonSource> source_polygon;
public:
QHash<QString, double> glyphs_sizes;
......@@ -106,6 +108,8 @@ dtkVisualizationDecoratorScalarGlyphs::dtkVisualizationDecoratorScalarGlyphs(con
d->source_sphere->SetThetaResolution(12.);
d->source_sphere->SetPhiResolution(12.);
d->source_polygon = vtkSmartPointer<vtkRegularPolygonSource>::New();
d->glyphs = vtkSmartPointer<vtkGlyph3D>::New();
d->glyphs->SetScaleModeToDataScalingOff();
d->glyphs->SetColorModeToColorByScalar();
......@@ -241,6 +245,7 @@ void dtkVisualizationDecoratorScalarGlyphs::setCanvas(dtkVisualizationCanvas *ca
glyphs_source_cb->addItem("Cube");
glyphs_source_cb->addItem("Cylinder");
glyphs_source_cb->addItem("Sphere");
glyphs_source_cb->addItem("Polygon");
QWidget *model_widget = new QWidget;
QFormLayout *form_layout = new QFormLayout(model_widget);
......@@ -459,6 +464,10 @@ bool dtkVisualizationDecoratorScalarGlyphs::setCurrentFieldName(const QString& s
d->source_sphere->SetRadius(glyphs_size);
d->source_sphere->Modified();
d->glyphs->SetSourceConnection(d->source_sphere->GetOutputPort());
} else if (glyphs_source == "Polygon") {
d->source_polygon->SetRadius(glyphs_size);
d->source_polygon->Modified();
d->glyphs->SetSourceConnection(d->source_polygon->GetOutputPort());
}
d->glyphs->Modified();
......@@ -497,6 +506,9 @@ void dtkVisualizationDecoratorScalarGlyphs::setCurrentGlyphsSize(double size)
} else if (source == "Sphere") {
d->source_sphere->SetRadius(size);
d->source_sphere->Modified();
} else if (source == "Polygon") {
d->source_polygon->SetRadius(size);
d->source_polygon->Modified();
}
d->glyphs->Modified();
......@@ -525,8 +537,14 @@ void dtkVisualizationDecoratorScalarGlyphs::setCurrentGlyphsSource(const QString
d->glyphs->SetSourceConnection(d->source_cylinder->GetOutputPort());
} else if (source == "Sphere") {
d->glyphs->SetSourceConnection(d->source_sphere->GetOutputPort());
} else if (source == "Polygon") {
double normal[3];
d->source_polygon->GetNormal(normal);
Please register or sign in to reply
d->glyphs->SetSourceConnection(d->source_polygon->GetOutputPort());
}
d->glyphs_sources[d->current_field_name]= source;
d->glyphs->Modified();
d->mapper->Modified();
d->actor->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