Constructor
| 18 | |
| 19 | // Constructor |
| 20 | SimpleView::SimpleView() |
| 21 | { |
| 22 | this->ui = new Ui_SimpleView; |
| 23 | this->ui->setupUi(this); |
| 24 | |
| 25 | // Qt Table View |
| 26 | this->TableView = vtkSmartPointer<vtkQtTableView>::New(); |
| 27 | |
| 28 | // Place the table view in the designer form |
| 29 | this->ui->tableFrame->layout()->addWidget(this->TableView->GetWidget()); |
| 30 | |
| 31 | // Geometry |
| 32 | vtkNew<vtkVectorText> text; |
| 33 | text->SetText("VTK and Qt!"); |
| 34 | vtkNew<vtkElevationFilter> elevation; |
| 35 | elevation->SetInputConnection(text->GetOutputPort()); |
| 36 | elevation->SetLowPoint(0, 0, 0); |
| 37 | elevation->SetHighPoint(10, 0, 0); |
| 38 | |
| 39 | // Mapper |
| 40 | vtkNew<vtkPolyDataMapper> mapper; |
| 41 | mapper->SetInputConnection(elevation->GetOutputPort()); |
| 42 | |
| 43 | // Actor in scene |
| 44 | vtkNew<vtkActor> actor; |
| 45 | actor->SetMapper(mapper); |
| 46 | |
| 47 | // VTK Renderer |
| 48 | vtkNew<vtkRenderer> ren; |
| 49 | |
| 50 | // Add Actor to renderer |
| 51 | ren->AddActor(actor); |
| 52 | |
| 53 | // VTK/Qt wedded |
| 54 | vtkNew<vtkGenericOpenGLRenderWindow> renderWindow; |
| 55 | this->ui->qvtkWidget->setRenderWindow(renderWindow); |
| 56 | this->ui->qvtkWidget->renderWindow()->AddRenderer(ren); |
| 57 | |
| 58 | // Just a bit of Qt interest: Culling off the |
| 59 | // point data and handing it to a vtkQtTableView |
| 60 | vtkNew<vtkAttributeDataToTableFilter> toTable; |
| 61 | toTable->SetInputConnection(elevation->GetOutputPort()); |
| 62 | toTable->SetFieldAssociation(vtkDataObject::FIELD_ASSOCIATION_POINTS); |
| 63 | |
| 64 | // Here we take the end of the VTK pipeline and give it to a Qt View |
| 65 | this->TableView->SetRepresentationFromInputConnection(toTable->GetOutputPort()); |
| 66 | |
| 67 | // Set up action signals and slots |
| 68 | connect(this->ui->actionOpenFile, SIGNAL(triggered()), this, SLOT(slotOpenFile())); |
| 69 | connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit())); |
| 70 | }; |
| 71 | |
| 72 | SimpleView::~SimpleView() |
| 73 | { |
nothing calls this directly
no test coverage detected