/* * Copyright 2007 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the * U.S. Government. Redistribution and use in source and binary forms, with * or without modification, are permitted provided that this Notice and any * statement of authorship are reproduced on all copies. */ #include "ui_SimpleView.h" #include "SimpleView.h" #include #include #include "vtkGenericOpenGLRenderWindow.h" #include #include #include #include #include #include "vtkSmartPointer.h" #include // Constructor SimpleView::SimpleView() { this->ui = new Ui_SimpleView; this->ui->setupUi(this); // Qt Table View this->TableView = vtkSmartPointer::New(); // Place the table view in the designer form this->ui->tableFrame->layout()->addWidget(this->TableView->GetWidget()); // Geometry vtkNew text; text->SetText("VTK and Qt!"); vtkNew elevation; elevation->SetInputConnection(text->GetOutputPort()); elevation->SetLowPoint(0,0,0); elevation->SetHighPoint(10,0,0); // Mapper vtkNew mapper; mapper->SetInputConnection(elevation->GetOutputPort()); // Actor in scene vtkNew actor; actor->SetMapper(mapper); // VTK Renderer vtkNew ren; // Add Actor to renderer ren->AddActor(actor); // VTK/Qt wedded vtkNew renderWindow; this->ui->qvtkWidget->SetRenderWindow(renderWindow); this->ui->qvtkWidget->GetRenderWindow()->AddRenderer(ren); // Just a bit of Qt interest: Culling off the // point data and handing it to a vtkQtTableView vtkNew toTable; toTable->SetInputConnection(elevation->GetOutputPort()); toTable->SetFieldType(vtkDataObjectToTable::POINT_DATA); // Here we take the end of the VTK pipeline and give it to a Qt View this->TableView->SetRepresentationFromInputConnection(toTable->GetOutputPort()); // Set up action signals and slots connect(this->ui->actionOpenFile, SIGNAL(triggered()), this, SLOT(slotOpenFile())); connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit())); }; SimpleView::~SimpleView() { // The smart pointers should clean up for up } // Action to be taken upon file open void SimpleView::slotOpenFile() { } void SimpleView::slotExit() { qApp->exit(); }