[vtkusers] VTk and STL-Containers from C++
ClaudeG
claude.gangolf at gmail.com
Thu Jul 2 09:23:09 EDT 2009
#include "map.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkCylinderSource.h"
/// map containing mappers
std::map<unsigned long, vtkPolyDataMapper *, std::less<unsigned long> >
mapper;
/// iterator for mapper
std::map<unsigned long, vtkPolyDataMapper *, std::less<unsigned long>
>::iterator mapper_pos;
/// map containing actors
std::map<unsigned long, vtkActor *, std::less<unsigned long> > actors;
/// iterator for actors
std::map<unsigned long, vtkActor *, std::less<unsigned long> >::iterator
actors_pos;
void setup(vtkRenderer *renderer)
{
int particle_counter = 0;
for(int particule=0; particule<5; particule++)
{
vtkCylinderSource *cylinder =vtkCylinderSource::New();
mapper[particle_counter] = vtkPolyDataMapper::New();
mapper[particle_counter]->SetInputConnection(barrelsource[particle_counter]->GetOutputPort());
// The actor is a grouping mechanism: besides the geometry (mapper),
it
// also has a property, transformation matrix, and/or texture map.
actors[particle_counter] = vtkActor::New();
actors[particle_counter]->SetMapper(mapper[particle_counter]);
// Add the actors to the renderer
renderer->AddActor(actors[particle_counter]);
// increment particle count
particle_counter++;
}
}
void manipulate(vtkRenderer *renderer)
{
int particle_counter = 0;
for(int particule=0; particule<5; particule++)
{
double pos= particule*2.;
actors[particule_counter]->SetPostion(2., 5.+pos, 3.);
paricule_counter++;
}
}
main()
{
vtkRenderer *ren1 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
setup(ren1);
renWin->Render();
manipulate(ren1);
renWin->Render();
}
I hope this will help you, this example must compile, (i hope because then
you can help me much more)
Thx for your help until now!
--
View this message in context: http://www.nabble.com/VTk-and-STL-Containers-from-C%2B%2B-tp24305314p24306657.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list