mirror of
https://github.com/OpenFOAM/ThirdParty-6.git
synced 2025-12-08 06:57:43 +00:00
ParaView-5.0.1: Added the source-tree to ThirdParty-dev and patched as described in the README file
Resolves bug-report http://bugs.openfoam.org/view.php?id=2098
This commit is contained in:
@ -0,0 +1,48 @@
|
||||
cmake_minimum_required(VERSION 2.8.8)
|
||||
if(POLICY CMP0020)
|
||||
cmake_policy(SET CMP0020 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0025)
|
||||
cmake_policy(SET CMP0025 NEW) # CMake 3.0
|
||||
endif()
|
||||
if(POLICY CMP0043)
|
||||
cmake_policy(SET CMP0043 NEW) # CMake 3.0
|
||||
endif()
|
||||
if(POLICY CMP0053)
|
||||
cmake_policy(SET CMP0053 NEW) # CMake 3.1
|
||||
endif()
|
||||
project(QtImageViewer)
|
||||
|
||||
find_package(VTK COMPONENTS
|
||||
vtkGUISupportQt
|
||||
vtkIOImage
|
||||
vtkInteractionImage
|
||||
vtkRendering${VTK_RENDERING_BACKEND}
|
||||
vtkTestingCore
|
||||
)
|
||||
include(${VTK_USE_FILE})
|
||||
|
||||
if("${VTK_QT_VERSION}" STREQUAL "")
|
||||
message(FATAL_ERROR "VTK was not built with Qt")
|
||||
endif()
|
||||
|
||||
set( Srcs main.cxx )
|
||||
|
||||
if(VTK_QT_VERSION VERSION_GREATER "4")
|
||||
find_package(Qt5 COMPONENTS Core REQUIRED QUIET)
|
||||
|
||||
add_executable(qtimageviewer ${Srcs})
|
||||
qt5_use_modules(qtimageviewer Core Gui Widgets)
|
||||
target_link_libraries(qtimageviewer ${VTK_LIBRARIES})
|
||||
else()
|
||||
find_package(Qt4 REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
# Use what VTK built with
|
||||
set(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
|
||||
set(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
|
||||
set(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
|
||||
include_directories(${QT_INCLUDE_DIR})
|
||||
|
||||
add_executable(qtimageviewer ${Srcs})
|
||||
target_link_libraries(qtimageviewer ${QT_LIBRARIES} ${VTK_LIBRARIES})
|
||||
endif()
|
||||
70
ParaView-5.0.1/VTK/Examples/GUI/Qt/ImageViewer/main.cxx
Normal file
70
ParaView-5.0.1/VTK/Examples/GUI/Qt/ImageViewer/main.cxx
Normal file
@ -0,0 +1,70 @@
|
||||
|
||||
|
||||
/*=========================================================================
|
||||
Copyright 2004 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.
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
/*========================================================================
|
||||
For general information about using VTK and Qt, see:
|
||||
http://www.trolltech.com/products/3rdparty/vtksupport.html
|
||||
=========================================================================*/
|
||||
|
||||
/*========================================================================
|
||||
!!! WARNING for those who want to contribute code to this file.
|
||||
!!! If you use a commercial edition of Qt, you can modify this code.
|
||||
!!! If you use an open source version of Qt, you are free to modify
|
||||
!!! and use this code within the guidelines of the GPL license.
|
||||
!!! Unfortunately, you cannot contribute the changes back into this
|
||||
!!! file. Doing so creates a conflict between the GPL and BSD-like VTK
|
||||
!!! license.
|
||||
=========================================================================*/
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include "vtkImageViewer.h"
|
||||
#include "vtkRenderWindowInteractor.h"
|
||||
#include "vtkRenderer.h"
|
||||
#include "vtkPNGReader.h"
|
||||
#include "vtkTestUtilities.h"
|
||||
|
||||
#include "QVTKWidget.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QVTKWidget widget;
|
||||
widget.resize(256,256);
|
||||
|
||||
vtkPNGReader* reader = vtkPNGReader::New();
|
||||
char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/vtk.png");
|
||||
reader->SetFileName(fname);
|
||||
delete [] fname;
|
||||
|
||||
vtkImageViewer* image_view = vtkImageViewer::New();
|
||||
image_view->SetInputConnection(reader->GetOutputPort());
|
||||
|
||||
widget.SetRenderWindow(image_view->GetRenderWindow());
|
||||
image_view->SetupInteractor(widget.GetRenderWindow()->GetInteractor());
|
||||
|
||||
image_view->SetColorLevel(138.5);
|
||||
image_view->SetColorWindow(233);
|
||||
|
||||
widget.show();
|
||||
|
||||
app.exec();
|
||||
|
||||
|
||||
image_view->Delete();
|
||||
reader->Delete();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user