[vtkusers] vtkProgrammableGlyphFilter C++ class Issue

Steffen Oeltze stoeltze at isg.cs.uni-magdeburg.de
Mon Feb 21 04:14:00 EST 2011


It seems that I could solve the problem by passing the "this"-pointer to 
the function that is called for each glyph. If I now declare the 
vtkProgrammableGlyphFilter, the glyph source and the vtkTransform as 
class variables, I can access them after casting the this-pointer.

Sincerely,
Steffen



On 20.02.2011 16:05, Steffen Oeltze wrote:
> Hi,
>
> I have written a class in C++ that is using a 
> vtkProgrammableGlyphFilter. In the method that is called for each 
> glyph, I pass a pointer to the filter. By doing so, I can access the 
> input data of the filter and its associated point data arrays in the 
> method. I need the latter for glyph modification. My problem is, that 
> I cannot access the glyph source and the vtkTransform that I am using 
> for positioning the glyphs in a similar manner. Instead, I have to 
> define both globally. So far that has not been a problem. However, now 
> that I am using several instances of my class, I run into problems 
> (the glyphs are not visible anymore in a viewer that uses the second 
> instance). I guess that these problems are related to my global 
> definitions.
>
> Any help is deeply appreciated.
>
> Sincerely,
> Steffen
>
> Here, a code snippet:
>
> g_vertexGlyph = vtkSmartPointer<vtkSectorSource>::New(); // globally 
> defined
>         g_vertexGlyph->SetOuterRadius(0.05);
>         g_vertexGlyph->SetInnerRadius(0.0);
>         g_vertexGlyph->SetStartAngle(0.0);
>         g_vertexGlyph->SetEndAngle(270.0);
>         g_vertexGlyph->SetCircumferentialResolution(12);
>         g_vertexGlyph->SetZCoord(0.0);
>
>     g_vertexGlyphTransform = vtkSmartPointer<vtkTransform>::New(); // 
> globally defined
>
>     vtkSmartPointer<vtkTransformPolyDataFilter > glyphTransform = 
> vtkSmartPointer<vtkTransformPolyDataFilter>::New();
>         glyphTransform->SetInput(g_vertexGlyph->GetOutput());
>         glyphTransform->SetTransform(g_vertexGlyphTransform);
>         glyphTransform->ReleaseDataFlagOn();
>
>     vtkSmartPointer<vtkProgrammableGlyphFilter> progGlyphs = 
> vtkSmartPointer<vtkProgrammableGlyphFilter>::New();
>         progGlyphs->SetInput(graphToPoly->GetOutput());
>         progGlyphs->SetSource(glyphTransform->GetOutput());
>         progGlyphs->SetColorModeToColorByInput();
>         progGlyphs->SetGlyphMethod(glyphAttribModif, (void *)progGlyphs);
>         progGlyphs->ReleaseDataFlagOn();
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: 
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers


-- 
Dr. Steffen Oeltze
Department of Simulation and Graphics, School of Computer Science
Otto-von-Guericke-University Magdeburg

Universitätsplatz 2, 39106 Magdeburg
GERMANY

Phone:  (+49-391) 67-1 25 27
Fax:    (+49 391) 67-1 11 64
Email:  stoeltze at isg.cs.uni-magdeburg.de
Web:    http://www.vismd.de/




More information about the vtkusers mailing list