MOAB: Mesh Oriented datABase  (version 5.4.1)
vtkMOABReaderTest.cxx
Go to the documentation of this file.
00001 #include "vtkMOABReader.h"
00002 #include "vtkRenderer.h"
00003 #include "vtkRenderWindow.h"
00004 #include "vtkRenderWindowInteractor.h"
00005 #include "vtkDataSetMapper.h"
00006 #include "vtkActor.h"
00007 #include "vtkProperty.h"
00008 //#include "vtk.h"
00009 
00010 
00011 int main(int argc, char **argv)
00012 {
00013   if (argc < 2)
00014     {
00015       cout << "Usage: " << argv[0] << " <mesh_filename>" << endl;
00016     return 1;
00017     }
00018 
00019   vtkMOABReader* l = vtkMOABReader::New();
00020 
00021   l->SetFileName(argv[1]);
00022   l->Update();
00023   l->Print(std::cout);
00024   for (int i = 0; i < l->GetNumberOfOutputs(); i++) 
00025     l->GetOutput(i)->Print(std::cout);
00026   
00027   vtkRenderer *aRenderer = vtkRenderer::New();
00028   vtkRenderWindow *renWin = vtkRenderWindow::New();
00029     renWin->AddRenderer(aRenderer);
00030   vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
00031     iren->SetRenderWindow(renWin);
00032 
00033   aRenderer->SetBackground(0,0,1);
00034   renWin->SetSize(640, 480);
00035 
00036   vtkDataSetMapper *meshMapper = vtkDataSetMapper::New();
00037   meshMapper->SetInput(l->GetOutput(1));
00038   vtkActor *meshActor = vtkActor::New();
00039   meshActor->SetMapper(meshMapper);
00040   meshActor->GetProperty()->SetColor(0.8, 0.1, 0.1);
00041   meshActor->GetProperty()->SetRepresentation(1);
00042   meshActor->GetProperty()->SetOpacity(0.1);
00043   meshActor->GetProperty()->SetEdgeVisibility(1);
00044   meshActor->GetProperty()->SetPointSize(3.0);
00045   meshActor->GetProperty()->SetLineWidth(3.0);
00046   aRenderer->AddActor(meshActor);
00047   
00048   // interact with data
00049   iren->Initialize();
00050   iren->Start(); 
00051 
00052   aRenderer->Delete();
00053   renWin->Delete();
00054   iren->Delete();
00055 
00056   return 0;
00057 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines