3 Commits

5 changed files with 90 additions and 2 deletions

1
.gitignore vendored
View File

@@ -16,3 +16,4 @@ src/Python/uLib/.nfs*
test_props.xml
test_props2.xml
test_boost.cpp
.claude/settings.json

View File

@@ -139,6 +139,7 @@ vtkVoxImage::vtkVoxImage(Content &content)
GetContent();
InstallPipe();
RescaleShaderRange();
ULIB_ACTIVATE_DISPLAY_PROPERTIES;
}
vtkVoxImage::~vtkVoxImage() {
@@ -298,7 +299,7 @@ void vtkVoxImage::SetRepresentation(Representation mode) {
void vtkVoxImage::serialize_display(uLib::Archive::display_properties_archive & ar, const unsigned int version) {
// Call base class to show Transform and Appearance properties
Puppet::serialize_display(ar, version);
// Puppet::serialize_display(ar, version);
// Use the member variables for volume rendering parameters
ar & boost::serialization::make_hrp("Window", m_Window);

View File

@@ -4,6 +4,7 @@ set(TESTS
vtkHandlerWidget
PuppetPropertyTest
PuppetParentingTest
vtkQViewportTest
# vtkVoxImageTest
# vtkTriangleMeshTest
)

View File

@@ -0,0 +1,86 @@
/*//////////////////////////////////////////////////////////////////////////////
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
All rights reserved
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
------------------------------------------------------------------
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library.
//////////////////////////////////////////////////////////////////////////////*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <QApplication>
#include <QtGlobal>
#include <Vtk/vtkQViewport.h>
#include <vtkSmartPointer.h>
#include <vtkCubeSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkProperty.h>
#include <vtkRenderer.h>
#include "testing-prototype.h"
using namespace uLib;
int main(int argc, char** argv)
{
// Force X11 on Linux to avoid Wayland connection issues in headless/X11 environments
#if defined(Q_OS_LINUX)
qputenv("QT_QPA_PLATFORM", "xcb");
#endif
BEGIN_TESTING(vtk QViewport Test);
QApplication app(argc, argv);
app.processEvents();
Vtk::QViewport viewport;
viewport.resize(800, 600);
viewport.show();
vtkSmartPointer<vtkCubeSource> cube = vtkSmartPointer<vtkCubeSource>::New();
cube->SetXLength(10);
cube->SetYLength(10);
cube->SetZLength(10);
cube->Update();
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(cube->GetOutputPort());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
actor->GetProperty()->SetColor(1, 0, 0);
viewport.addProp(actor);
viewport.Render();
ASSERT_NOT_NULL(viewport.GetRenderWindow());
ASSERT_NOT_NULL(viewport.GetRenderer());
if (std::getenv("CTEST_PROJECT_NAME") == nullptr) {
// Run application for a while to see the result
// return app.exec();
}
END_TESTING;
}

View File

@@ -81,7 +81,6 @@ void QViewport::SetupPipeline()
void QViewport::Render()
{
UpdateGrid();
if (m_VtkWidget && m_VtkWidget->renderWindow())
m_VtkWidget->renderWindow()->Render();
}