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:
32
ParaView-5.0.1/Examples/Plugins/Autostart/CMakeLists.txt
Normal file
32
ParaView-5.0.1/Examples/Plugins/Autostart/CMakeLists.txt
Normal file
@ -0,0 +1,32 @@
|
||||
# Create an auto-start plugin. Auto start plugins provide callbacks that get
|
||||
# called when the plugin is loaded and when the application shutsdown.
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
IF(NOT ParaView_BINARY_DIR)
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
ENDIF()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
IF (PARAVIEW_QT_VERSION VERSION_GREATER "4")
|
||||
QT5_WRAP_CPP(MOC_SRCS pqMyApplicationStarter.h)
|
||||
ELSE ()
|
||||
QT4_WRAP_CPP(MOC_SRCS pqMyApplicationStarter.h)
|
||||
ENDIF ()
|
||||
|
||||
ADD_PARAVIEW_AUTO_START(IFACES IFACE_SRCS CLASS_NAME pqMyApplicationStarter
|
||||
STARTUP onStartup
|
||||
SHUTDOWN onShutdown)
|
||||
|
||||
# create a plugin for this starter
|
||||
ADD_PARAVIEW_PLUGIN(Autostart "1.0"
|
||||
GUI_INTERFACES ${IFACES}
|
||||
SOURCES pqMyApplicationStarter.cxx ${MOC_SRCS} ${RCS_SRCS} ${IFACE_SRCS})
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: pqMyApplicationStarter.cxx
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#include "pqMyApplicationStarter.h"
|
||||
|
||||
// Server Manager Includes.
|
||||
|
||||
// Qt Includes.
|
||||
#include <QtDebug>
|
||||
// ParaView Includes.
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
pqMyApplicationStarter::pqMyApplicationStarter(QObject* p/*=0*/)
|
||||
: QObject(p)
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
pqMyApplicationStarter::~pqMyApplicationStarter()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void pqMyApplicationStarter::onStartup()
|
||||
{
|
||||
qWarning() << "Message from pqMyApplicationStarter: Application Started";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void pqMyApplicationStarter::onShutdown()
|
||||
{
|
||||
qWarning() << "Message from pqMyApplicationStarter: Application Shutting down";
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: pqMyApplicationStarter.h
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#ifndef pqMyApplicationStarter_h
|
||||
#define pqMyApplicationStarter_h
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class pqMyApplicationStarter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
typedef QObject Superclass;
|
||||
public:
|
||||
pqMyApplicationStarter(QObject* p=0);
|
||||
~pqMyApplicationStarter();
|
||||
|
||||
// Callback for shutdown.
|
||||
void onShutdown();
|
||||
|
||||
// Callback for startup.
|
||||
void onStartup();
|
||||
private:
|
||||
pqMyApplicationStarter(const pqMyApplicationStarter&); // Not implemented.
|
||||
void operator=(const pqMyApplicationStarter&); // Not implemented.
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
37
ParaView-5.0.1/Examples/Plugins/DockWidget/CMakeLists.txt
Normal file
37
ParaView-5.0.1/Examples/Plugins/DockWidget/CMakeLists.txt
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
# Example plugin demonstrating how to add a dock panel to ParaView.
|
||||
# This plugin adds the panel ExampleDockPanel to the client.
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
IF(NOT ParaView_BINARY_DIR)
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
ENDIF()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
IF(PARAVIEW_BUILD_QT_GUI)
|
||||
IF (PARAVIEW_QT_VERSION VERSION_GREATER "4")
|
||||
QT5_WRAP_CPP(MOC_SRCS ExampleDockPanel.h)
|
||||
QT5_WRAP_UI(UI_SRCS ExampleDockPanel.ui)
|
||||
ELSE ()
|
||||
QT4_WRAP_CPP(MOC_SRCS ExampleDockPanel.h)
|
||||
QT4_WRAP_UI(UI_SRCS ExampleDockPanel.ui)
|
||||
ENDIF ()
|
||||
|
||||
ADD_PARAVIEW_DOCK_WINDOW(
|
||||
OUTIFACES
|
||||
OUTSRCS
|
||||
CLASS_NAME ExampleDockPanel
|
||||
DOCK_AREA Right)
|
||||
|
||||
ADD_PARAVIEW_PLUGIN(ExampleDockPanel "1.0"
|
||||
GUI_INTERFACES ${OUTIFACES}
|
||||
GUI_SOURCES ${OUTSRCS} ${MOC_SRCS} ${UI_SRCS} ExampleDockPanel.cxx)
|
||||
ENDIF()
|
||||
@ -0,0 +1,11 @@
|
||||
#include "ExampleDockPanel.h"
|
||||
#include "ui_ExampleDockPanel.h"
|
||||
|
||||
void ExampleDockPanel::constructor()
|
||||
{
|
||||
this->setWindowTitle("Example Dock Panel");
|
||||
QWidget* t_widget = new QWidget(this);
|
||||
Ui::ExampleDockPanel ui;
|
||||
ui.setupUi(t_widget);
|
||||
this->setWidget(t_widget);
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
|
||||
#include <QDockWidget>
|
||||
|
||||
|
||||
class ExampleDockPanel : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
typedef QDockWidget Superclass;
|
||||
public:
|
||||
ExampleDockPanel(const QString &t, QWidget* p = 0, Qt::WindowFlags f=0):
|
||||
Superclass(t, p, f) { this->constructor(); }
|
||||
ExampleDockPanel(QWidget *p=0, Qt::WindowFlags f=0):
|
||||
Superclass(p, f) { this->constructor(); }
|
||||
private:
|
||||
void constructor();
|
||||
};
|
||||
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ExampleDockPanel</class>
|
||||
<widget class="QWidget" name="ExampleDockPanel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>207</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Helvetica'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Custom Dock Panel</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>This is dock panel</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Loaded Using a Plugin</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
24
ParaView-5.0.1/Examples/Plugins/Filter/CMakeLists.txt
Normal file
24
ParaView-5.0.1/Examples/Plugins/Filter/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
||||
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
|
||||
|
||||
if (NOT ParaView_BINARY_DIR)
|
||||
find_package(ParaView REQUIRED)
|
||||
include(${PARAVIEW_USE_FILE})
|
||||
endif()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
include(ParaViewPlugins)
|
||||
|
||||
# create a paraview plugin containing server manager xml and the server
|
||||
# manager classes to build
|
||||
# this plugin can be loaded on the server side
|
||||
|
||||
ADD_PARAVIEW_PLUGIN(SMMyElevation "1.0"
|
||||
SERVER_MANAGER_XML MyElevationFilter.xml
|
||||
SERVER_MANAGER_SOURCES vtkMyElevationFilter.cxx)
|
||||
|
||||
79
ParaView-5.0.1/Examples/Plugins/Filter/MyElevationFilter.xml
Normal file
79
ParaView-5.0.1/Examples/Plugins/Filter/MyElevationFilter.xml
Normal file
@ -0,0 +1,79 @@
|
||||
<ServerManagerConfiguration>
|
||||
<!-- This is the server manager configuration XML. It defines the interface to
|
||||
our new filter. As a rule of thumb, try to locate the configuration for
|
||||
a filter already in ParaView (in Servers/ServerManager/Resources/*.xml)
|
||||
that matches your filter and then model your xml on it -->
|
||||
<ProxyGroup name="filters">
|
||||
<SourceProxy name="MyElevationFilter" class="vtkMyElevationFilter" label="MyElevation">
|
||||
<Documentation
|
||||
long_help="Create point attribute array by projecting points onto an elevation vector."
|
||||
short_help="Create a point array representing elevation.">
|
||||
The Elevation filter generates point scalar values for an input data
|
||||
set along a specified direction vector. The Input menu allows the user
|
||||
to select the data set to which this filter will be applied. The Low
|
||||
Point and High Point define a line onto which each point of the data
|
||||
set is projected. The minimum scalar value is associated with the Low
|
||||
Point, and the maximum scalar value is associated with the High Point.
|
||||
The scalar value for each point in the data set is determined by the
|
||||
location along the line to which that point projects.
|
||||
|
||||
The line can be specified interactively using the 3D line widget. See
|
||||
section 7.4 for more information about this widget.
|
||||
</Documentation>
|
||||
<InputProperty
|
||||
name="Input"
|
||||
command="SetInputConnection">
|
||||
<ProxyGroupDomain name="groups">
|
||||
<Group name="sources"/>
|
||||
<Group name="filters"/>
|
||||
</ProxyGroupDomain>
|
||||
<DataTypeDomain name="input_type">
|
||||
<DataType value="vtkDataSet"/>
|
||||
</DataTypeDomain>
|
||||
</InputProperty>
|
||||
|
||||
<DoubleVectorProperty
|
||||
name="LowPoint"
|
||||
label="Low Point"
|
||||
command="SetLowPoint"
|
||||
number_of_elements="3"
|
||||
animateable="1"
|
||||
default_values="0 0 0" >
|
||||
<BoundsDomain name="range" mode="normal" default_mode="min" >
|
||||
<RequiredProperties>
|
||||
<Property name="Input" function="Input" />
|
||||
</RequiredProperties>
|
||||
</BoundsDomain>
|
||||
<Documentation>
|
||||
Define one end of the line (small scalar values). Default is (0,0,0).
|
||||
</Documentation>
|
||||
</DoubleVectorProperty>
|
||||
|
||||
<DoubleVectorProperty
|
||||
name="HighPoint"
|
||||
label="High Point"
|
||||
command="SetHighPoint"
|
||||
number_of_elements="3"
|
||||
animateable="1"
|
||||
default_values="0 0 1" >
|
||||
<BoundsDomain name="range" mode="normal" default_mode="max" >
|
||||
<RequiredProperties>
|
||||
<Property name="Input" function="Input" />
|
||||
</RequiredProperties>
|
||||
</BoundsDomain>
|
||||
<Documentation>
|
||||
Define other end of the line (large scalar values). Default is (0,0,1).
|
||||
</Documentation>
|
||||
</DoubleVectorProperty>
|
||||
|
||||
<Hints>
|
||||
<PropertyGroup type="Line" label="My Elevation Widget">
|
||||
<Property function="Point1WorldPosition" name="LowPoint" />
|
||||
<Property function="Point2WorldPosition" name="HighPoint" />
|
||||
</PropertyGroup>
|
||||
</Hints>
|
||||
<!-- End MyElevationFilter -->
|
||||
</SourceProxy>
|
||||
</ProxyGroup>
|
||||
</ServerManagerConfiguration>
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit
|
||||
Module: vtkMyElevationFilter.cxx
|
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
#include "vtkMyElevationFilter.h"
|
||||
|
||||
#include "vtkObjectFactory.h"
|
||||
|
||||
vtkStandardNewMacro(vtkMyElevationFilter);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkMyElevationFilter::vtkMyElevationFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkMyElevationFilter::~vtkMyElevationFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkMyElevationFilter::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os,indent);
|
||||
}
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit
|
||||
Module: vtkMyElevationFilter.h
|
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
// .NAME vtkMyElevationFilter - generate scalars along a specified direction
|
||||
// .SECTION Description
|
||||
// vtkMyElevationFilter is a filter to generate scalar values from a
|
||||
// dataset. The scalar values lie within a user specified range, and
|
||||
// are generated by computing a projection of each dataset point onto
|
||||
// a line. The line can be oriented arbitrarily. A typical example is
|
||||
// to generate scalars based on elevation or height above a plane.
|
||||
|
||||
#ifndef vtkMyElevationFilter_h
|
||||
#define vtkMyElevationFilter_h
|
||||
|
||||
#include "vtkElevationFilter.h"
|
||||
|
||||
class VTK_EXPORT vtkMyElevationFilter : public vtkElevationFilter
|
||||
{
|
||||
public:
|
||||
static vtkMyElevationFilter* New();
|
||||
vtkTypeMacro(vtkMyElevationFilter, vtkElevationFilter);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
protected:
|
||||
vtkMyElevationFilter();
|
||||
~vtkMyElevationFilter();
|
||||
|
||||
private:
|
||||
vtkMyElevationFilter(const vtkMyElevationFilter&); // Not implemented.
|
||||
void operator=(const vtkMyElevationFilter&); // Not implemented.
|
||||
};
|
||||
|
||||
#endif
|
||||
33
ParaView-5.0.1/Examples/Plugins/GUIToolBar/CMakeLists.txt
Normal file
33
ParaView-5.0.1/Examples/Plugins/GUIToolBar/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
# create a plugin that implements an object panel for a source proxy
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
IF(NOT ParaView_BINARY_DIR)
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
ENDIF()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
IF(PARAVIEW_BUILD_QT_GUI)
|
||||
IF (PARAVIEW_QT_VERSION VERSION_GREATER "4")
|
||||
QT5_WRAP_CPP(MOC_SRCS MyToolBarActions.h)
|
||||
ELSE ()
|
||||
QT4_WRAP_CPP(MOC_SRCS MyToolBarActions.h)
|
||||
ENDIF ()
|
||||
|
||||
# we implement a pqConePanel.h for the ConeSource
|
||||
ADD_PARAVIEW_ACTION_GROUP(IFACES IFACE_SRCS CLASS_NAME MyToolBarActions
|
||||
GROUP_NAME "ToolBar/MyActions")
|
||||
|
||||
# create a plugin for this panel
|
||||
ADD_PARAVIEW_PLUGIN(GUIMyToolBar "1.0"
|
||||
GUI_INTERFACES ${IFACES}
|
||||
SOURCES MyToolBarActions.cxx ${MOC_SRCS} ${IFACE_SRCS})
|
||||
ENDIF()
|
||||
@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
#include "MyToolBarActions.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStyle>
|
||||
#include <QMessageBox>
|
||||
|
||||
MyToolBarActions::MyToolBarActions(QObject* p)
|
||||
: QActionGroup(p)
|
||||
{
|
||||
QIcon icon = qApp->style()->standardIcon(QStyle::SP_MessageBoxCritical);
|
||||
|
||||
QAction* a = this->addAction(new QAction(icon, "MyAction", this));
|
||||
QObject::connect(a, SIGNAL(triggered(bool)), this, SLOT(onAction()));
|
||||
}
|
||||
|
||||
MyToolBarActions::~MyToolBarActions()
|
||||
{
|
||||
}
|
||||
|
||||
void MyToolBarActions::onAction()
|
||||
{
|
||||
QMessageBox::information(NULL, "MyAction", "MyAction was invoked\n");
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
|
||||
#include <QActionGroup>
|
||||
|
||||
class MyToolBarActions : public QActionGroup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MyToolBarActions(QObject* p);
|
||||
~MyToolBarActions();
|
||||
|
||||
public slots:
|
||||
void onAction();
|
||||
|
||||
};
|
||||
|
||||
99
ParaView-5.0.1/Examples/Plugins/HelixSource/HelixSource.ui
Normal file
99
ParaView-5.0.1/Examples/Plugins/HelixSource/HelixSource.ui
Normal file
@ -0,0 +1,99 @@
|
||||
<ui version="4.0" >
|
||||
<class>HelixSource</class>
|
||||
<widget class="QWidget" name="HelixSource" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>234</width>
|
||||
<height>288</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Number Of Points</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QSpinBox" name="NumberOfPoints_1" >
|
||||
<property name="minimum" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>99999</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>80</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Length</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QDoubleSpinBox" name="Length_1" >
|
||||
<property name="minimum" >
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<double>99999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Number of Rounds</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QSpinBox" name="NumberOfRounds_1" >
|
||||
<property name="minimum" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>99999</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
BIN
ParaView-5.0.1/Examples/Plugins/HelixSource/helix.bqrc
Normal file
BIN
ParaView-5.0.1/Examples/Plugins/HelixSource/helix.bqrc
Normal file
Binary file not shown.
7
ParaView-5.0.1/Examples/Plugins/HelixSource/helix.qrc
Normal file
7
ParaView-5.0.1/Examples/Plugins/HelixSource/helix.qrc
Normal file
@ -0,0 +1,7 @@
|
||||
<!-- paraview looks for "/pqWidgets/UI/<SM XML Name>.ui", so an alias is created to put the panel there -->
|
||||
<!-- this resource can be converted to binary form by running "rcc -binary -o helix.bqrc helix.qrc" -->
|
||||
<RCC>
|
||||
<qresource prefix="/pqWidgets" >
|
||||
<file alias="UI/HelixSource.ui">HelixSource.ui</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
71
ParaView-5.0.1/Examples/Plugins/HelixSource/helix.xml
Normal file
71
ParaView-5.0.1/Examples/Plugins/HelixSource/helix.xml
Normal file
@ -0,0 +1,71 @@
|
||||
|
||||
<ServerManagerConfiguration>
|
||||
<ProxyGroup name="sources">
|
||||
|
||||
<!-- server manager xml for a python script that creates a helix
|
||||
the auto generated panel for this exposes everything more than we want so
|
||||
a custom panel would be good -->
|
||||
<SourceProxy name="HelixSource" class="vtkPythonProgrammableFilter"
|
||||
label="Helix Source">
|
||||
<Documentation
|
||||
long_help="Creates a helix using a python script using parameters filled in by the user."
|
||||
short_help="Creates a helix.">
|
||||
This source will execute a python script to produce a helix dataset.
|
||||
</Documentation>
|
||||
|
||||
<!-- data set type -->
|
||||
<IntVectorProperty
|
||||
name="OutputDataSetType"
|
||||
command="SetOutputDataSetType"
|
||||
number_of_elements="1"
|
||||
default_values="0">
|
||||
<!-- value of 0 means vtkPolyData -->
|
||||
</IntVectorProperty>
|
||||
|
||||
<!-- the script -->
|
||||
<StringVectorProperty
|
||||
name="Script"
|
||||
command="SetScript"
|
||||
number_of_elements="1"
|
||||
default_values="import math;
pdo = self.GetPolyDataOutput()

newPts = vtk.vtkPoints()
for i in range(0, numPts):
 x = i*float(length)/float(numPts)
 y = math.sin(i*rounds*2*math.pi/numPts)
 z = math.cos(i*rounds*2*math.pi/numPts)
 newPts.InsertPoint(i, x,y,z)

pdo.SetPoints(newPts)
aPolyLine = vtk.vtkPolyLine()

aPolyLine.GetPointIds().SetNumberOfIds(numPts)
for i in range(0,numPts):
 aPolyLine.GetPointIds().SetId(i, i)

pdo.Allocate(1, 1)
pdo.InsertNextCell(aPolyLine.GetCellType(), aPolyLine.GetPointIds())
">
|
||||
<Hints>
|
||||
<Widget type="multi_line"/>
|
||||
</Hints>
|
||||
</StringVectorProperty>
|
||||
|
||||
<!-- python script references a variable "numPts"
|
||||
we expose this as a property allowing the user to set it -->
|
||||
<StringVectorProperty
|
||||
name="NumberOfPoints"
|
||||
command="SetParameter"
|
||||
number_of_elements="2"
|
||||
default_values_delimiter=";"
|
||||
default_values="numPts;80">
|
||||
</StringVectorProperty>
|
||||
|
||||
<!-- python script references a variable "length"
|
||||
we expose this as a property allowing the user to set it -->
|
||||
<StringVectorProperty
|
||||
name="Length"
|
||||
command="SetParameter"
|
||||
number_of_elements="2"
|
||||
default_values_delimiter=";"
|
||||
default_values="length;2.0">
|
||||
</StringVectorProperty>
|
||||
|
||||
<!-- python script references a variable "rounds"
|
||||
we expose this as a property allowing the user to set it -->
|
||||
<StringVectorProperty
|
||||
name="NumberOfRounds"
|
||||
command="SetParameter"
|
||||
number_of_elements="2"
|
||||
default_values_delimiter=";"
|
||||
default_values="rounds;3">
|
||||
</StringVectorProperty>
|
||||
|
||||
<!-- End HelixSource -->
|
||||
</SourceProxy>
|
||||
</ProxyGroup>
|
||||
</ServerManagerConfiguration>
|
||||
|
||||
|
||||
24
ParaView-5.0.1/Examples/Plugins/HelixSource/readme.txt
Normal file
24
ParaView-5.0.1/Examples/Plugins/HelixSource/readme.txt
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
This example contains:
|
||||
|
||||
1. A server manager xml file (helix.xml) which defines a programmable source
|
||||
that creates a helix. It also contains extra properties for variables in
|
||||
the python script.
|
||||
|
||||
2. A custom gui created in the Qt designer. When opening the designer, a
|
||||
blank widget may be used. Place all labels and widgets in their places,
|
||||
add a spacer at the bottom then lay them out in a grid. The widgets are
|
||||
named after their associated server manager property. For example,
|
||||
NumberOfRounds is a string property with 2 values. The first value is the
|
||||
name of the python variable, and the second is the value of the python
|
||||
variable. The widget is named NumberOfRounds_1, where _1 tells the GUI to
|
||||
tie the value of the widget with the second value of the server manager
|
||||
property.
|
||||
|
||||
3. A helix.qrc file specifying the .ui file to include in the resource.
|
||||
4. A binary resource helix.bqrc, created from helix.qrc by the Qt's rcc command:
|
||||
rcc -binary -o helix.bqrc helix.qrc
|
||||
|
||||
Although the Qt files aren't required, it does give a better user interface
|
||||
to the helix source.
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
# This plugin demonstrates how to add a new representation to ParaView that
|
||||
# employs hardware shaders. The shaders are employed by the
|
||||
# vtkVisibleLinesPainter which is initialized by the
|
||||
# vtkGeometryRepresentationWithHiddenLinesRemoval.
|
||||
# This plugin add a new representation-type
|
||||
# "Visible Wireframe" when showing polydata in a 3D view.
|
||||
|
||||
# Note that this plugin does not work in parallel since it relies on composited
|
||||
# Z-buffer and currently there's not support to obtain a composited Z-buffer
|
||||
# during the rendering stage.
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
|
||||
|
||||
if (NOT ParaView_BINARY_DIR)
|
||||
find_package(ParaView REQUIRED)
|
||||
include(${PARAVIEW_USE_FILE})
|
||||
endif()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
include(ParaViewPlugins)
|
||||
|
||||
if (VTK_RENDERING_BACKEND STREQUAL "OpenGL")
|
||||
|
||||
# Compile-in all GLSL files are strings.
|
||||
# const char* with the names same as that of the file then become available for
|
||||
# use.
|
||||
encode_files_as_strings(ENCODED_STRING_FILES
|
||||
vtkPVLightingHelper_s.glsl
|
||||
vtkPVColorMaterialHelper_vs.glsl
|
||||
vtkVisibleLinesPainter_fs.glsl
|
||||
vtkVisibleLinesPainter_vs.glsl
|
||||
)
|
||||
|
||||
add_paraview_plugin(
|
||||
HiddenLinesRemoval "1.0"
|
||||
SERVER_MANAGER_XML
|
||||
HiddenLinesRemovalPlugin.xml
|
||||
|
||||
SERVER_MANAGER_SOURCES
|
||||
vtkGeometryRepresentationWithHiddenLinesRemoval.cxx
|
||||
|
||||
SOURCES vtkPVColorMaterialHelper.cxx
|
||||
vtkPVLightingHelper.cxx
|
||||
vtkVisibleLinesPainter.cxx
|
||||
${ENCODED_STRING_FILES}
|
||||
)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(SYSTEM ${OPENGL_INCLUDE_DIR})
|
||||
target_link_libraries(HiddenLinesRemoval LINK_PRIVATE ${OPENGL_LIBRARIES})
|
||||
|
||||
endif()
|
||||
@ -0,0 +1,39 @@
|
||||
<ServerManagerConfiguration>
|
||||
<ProxyGroup name="representations">
|
||||
<RepresentationProxy name="VisibleLinesRepresentation"
|
||||
base_proxygroup="representations"
|
||||
base_proxyname="SurfaceRepresentation"
|
||||
processes="client|dataserver|renderserver"
|
||||
class="vtkGeometryRepresentationWithHiddenLinesRemoval" >
|
||||
<Documentation>
|
||||
This is the new representation type we are adding. This is identical to
|
||||
the SurfaceRepresentation except that we are overriding the mapper with
|
||||
our mapper.
|
||||
</Documentation>
|
||||
|
||||
<!-- End of SurfaceRepresentation -->
|
||||
</RepresentationProxy>
|
||||
|
||||
<Extension name="GeometryRepresentation">
|
||||
<Documentation>
|
||||
Extends standard GeometryRepresentation by adding
|
||||
VisibleLinesRepresentation as a new type of representation.
|
||||
</Documentation>
|
||||
|
||||
<!-- this adds to what is already defined in PVRepresentationBase -->
|
||||
<RepresentationType subproxy="VisibleLinesRepresentation"
|
||||
text="Visible Wireframe" subtype="Wireframe" />
|
||||
|
||||
<SubProxy>
|
||||
<Proxy name="VisibleLinesRepresentation"
|
||||
proxygroup="representations" proxyname="VisibleLinesRepresentation">
|
||||
</Proxy>
|
||||
<ShareProperties subproxy="SurfaceRepresentation">
|
||||
<Exception name="Input" />
|
||||
<Exception name="Visibility" />
|
||||
<Exception name="Representation" />
|
||||
</ShareProperties>
|
||||
</SubProxy>
|
||||
</Extension>
|
||||
</ProxyGroup>
|
||||
</ServerManagerConfiguration>
|
||||
@ -0,0 +1,74 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
#include "vtkGeometryRepresentationWithHiddenLinesRemoval.h"
|
||||
|
||||
#include "vtkCompositePolyDataMapper2.h"
|
||||
#include "vtkDefaultPainter.h"
|
||||
#include "vtkObjectFactory.h"
|
||||
#include "vtkVisibleLinesPainter.h"
|
||||
|
||||
vtkStandardNewMacro(vtkGeometryRepresentationWithHiddenLinesRemoval);
|
||||
//----------------------------------------------------------------------------
|
||||
vtkGeometryRepresentationWithHiddenLinesRemoval::vtkGeometryRepresentationWithHiddenLinesRemoval()
|
||||
{
|
||||
if (this->Mapper)
|
||||
{
|
||||
// Replace the representation painter to the vtkVisibleLinesPainter,
|
||||
// so when rendering as wireframe, we remove the hidden lines.
|
||||
|
||||
vtkCompositePolyDataMapper2* compositeMapper =
|
||||
vtkCompositePolyDataMapper2::SafeDownCast(this->Mapper);
|
||||
|
||||
vtkVisibleLinesPainter* painter = vtkVisibleLinesPainter::New();
|
||||
vtkDefaultPainter* dfPainter = vtkDefaultPainter::SafeDownCast(
|
||||
compositeMapper->GetPainter());
|
||||
dfPainter->SetRepresentationPainter(painter);
|
||||
painter->Delete();
|
||||
|
||||
// Disable display lists, since vtkVisibleLinesPainter is not designed to work
|
||||
// with display lists.
|
||||
dfPainter->SetDisplayListPainter(0);
|
||||
}
|
||||
|
||||
if (this->LODMapper)
|
||||
{
|
||||
// Replace the representation painter to the vtkVisibleLinesPainter,
|
||||
// so when rendering as wireframe, we remove the hidden lines.
|
||||
|
||||
vtkCompositePolyDataMapper2* compositeMapper =
|
||||
vtkCompositePolyDataMapper2::SafeDownCast(this->LODMapper);
|
||||
|
||||
vtkVisibleLinesPainter* painter = vtkVisibleLinesPainter::New();
|
||||
vtkDefaultPainter* dfPainter = vtkDefaultPainter::SafeDownCast(
|
||||
compositeMapper->GetPainter());
|
||||
dfPainter->SetRepresentationPainter(painter);
|
||||
painter->Delete();
|
||||
|
||||
// Disable display lists, since vtkVisibleLinesPainter is not designed to work
|
||||
// with display lists.
|
||||
dfPainter->SetDisplayListPainter(0);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkGeometryRepresentationWithHiddenLinesRemoval::~vtkGeometryRepresentationWithHiddenLinesRemoval()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkGeometryRepresentationWithHiddenLinesRemoval::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os, indent);
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
// .NAME vtkGeometryRepresentationWithHiddenLinesRemoval
|
||||
// .SECTION Description
|
||||
//
|
||||
|
||||
#ifndef vtkGeometryRepresentationWithHiddenLinesRemoval_h
|
||||
#define vtkGeometryRepresentationWithHiddenLinesRemoval_h
|
||||
|
||||
#include "vtkGeometryRepresentationWithFaces.h"
|
||||
|
||||
class VTK_EXPORT vtkGeometryRepresentationWithHiddenLinesRemoval :
|
||||
public vtkGeometryRepresentationWithFaces
|
||||
{
|
||||
public:
|
||||
static vtkGeometryRepresentationWithHiddenLinesRemoval* New();
|
||||
vtkTypeMacro(vtkGeometryRepresentationWithHiddenLinesRemoval, vtkGeometryRepresentationWithFaces);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
//BTX
|
||||
protected:
|
||||
vtkGeometryRepresentationWithHiddenLinesRemoval();
|
||||
~vtkGeometryRepresentationWithHiddenLinesRemoval();
|
||||
|
||||
private:
|
||||
vtkGeometryRepresentationWithHiddenLinesRemoval(const vtkGeometryRepresentationWithHiddenLinesRemoval&); // Not implemented
|
||||
void operator=(const vtkGeometryRepresentationWithHiddenLinesRemoval&); // Not implemented
|
||||
//ETX
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,113 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: vtkPVColorMaterialHelper.cxx
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
#include "vtkPVColorMaterialHelper.h"
|
||||
|
||||
#include "vtkShaderProgram2.h"
|
||||
#include "vtkObjectFactory.h"
|
||||
#include "vtkShader2.h"
|
||||
#include "vtkShader2Collection.h"
|
||||
#include "vtkUniformVariables.h"
|
||||
#include "vtkgl.h"
|
||||
extern const char* vtkPVColorMaterialHelper_vs;
|
||||
|
||||
vtkStandardNewMacro(vtkPVColorMaterialHelper);
|
||||
vtkCxxSetObjectMacro(vtkPVColorMaterialHelper, Shader, vtkShaderProgram2);
|
||||
//----------------------------------------------------------------------------
|
||||
vtkPVColorMaterialHelper::vtkPVColorMaterialHelper()
|
||||
{
|
||||
this->Shader = 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkPVColorMaterialHelper::~vtkPVColorMaterialHelper()
|
||||
{
|
||||
this->SetShader(0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkPVColorMaterialHelper::Initialize(vtkShaderProgram2* pgm)
|
||||
{
|
||||
if (this->Shader != pgm)
|
||||
{
|
||||
this->SetShader(pgm);
|
||||
if (pgm)
|
||||
{
|
||||
vtkShader2 *s=vtkShader2::New();
|
||||
s->SetSourceCode(vtkPVColorMaterialHelper_vs);
|
||||
s->SetType(VTK_SHADER_TYPE_VERTEX);
|
||||
s->SetContext(pgm->GetContext());
|
||||
pgm->GetShaders()->AddItem(s);
|
||||
s->Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkPVColorMaterialHelper::PrepareForRendering()
|
||||
{
|
||||
if (!this->Shader)
|
||||
{
|
||||
vtkErrorMacro("Please Initialize() before calling PrepareForRendering().");
|
||||
return ;
|
||||
}
|
||||
|
||||
this->Mode = vtkPVColorMaterialHelper::DISABLED;
|
||||
if (glIsEnabled(GL_COLOR_MATERIAL))
|
||||
{
|
||||
GLint colorMaterialParameter;
|
||||
glGetIntegerv(GL_COLOR_MATERIAL_PARAMETER, &colorMaterialParameter);
|
||||
switch (colorMaterialParameter)
|
||||
{
|
||||
case GL_AMBIENT:
|
||||
this->Mode = vtkPVColorMaterialHelper::AMBIENT;
|
||||
break;
|
||||
|
||||
case GL_DIFFUSE:
|
||||
this->Mode = vtkPVColorMaterialHelper::DIFFUSE;
|
||||
break;
|
||||
|
||||
case GL_SPECULAR:
|
||||
this->Mode = vtkPVColorMaterialHelper::SPECULAR;
|
||||
break;
|
||||
|
||||
case GL_AMBIENT_AND_DIFFUSE:
|
||||
this->Mode = vtkPVColorMaterialHelper::AMBIENT_AND_DIFFUSE;
|
||||
break;
|
||||
|
||||
case GL_EMISSION:
|
||||
this->Mode = vtkPVColorMaterialHelper::EMISSION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkPVColorMaterialHelper::Render()
|
||||
{
|
||||
if (!this->Shader)
|
||||
{
|
||||
vtkErrorMacro("Please Initialize() before calling Render().");
|
||||
return;
|
||||
}
|
||||
|
||||
int value=this->Mode;
|
||||
this->Shader->GetUniformVariables()->SetUniformi("vtkPVColorMaterialHelper_Mode",1,&value);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkPVColorMaterialHelper::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os, indent);
|
||||
os << indent << "Shader: " << this->Shader << endl;
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: vtkPVColorMaterialHelper.h
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
// .NAME vtkPVColorMaterialHelper - a helper to assist in similating the
|
||||
// ColorMaterial behaviour of the default OpenGL pipeline.
|
||||
// .SECTION Description
|
||||
// vtkPVColorMaterialHelper is a helper to assist in similating the
|
||||
// ColorMaterial behaviour of the default OpenGL pipeline. Look at
|
||||
// vtkPVColorMaterialHelper_s for available GLSL functions.
|
||||
|
||||
#ifndef vtkPVColorMaterialHelper_h
|
||||
#define vtkPVColorMaterialHelper_h
|
||||
|
||||
#include "vtkObject.h"
|
||||
|
||||
class vtkShaderProgram2;
|
||||
|
||||
class VTK_EXPORT vtkPVColorMaterialHelper : public vtkObject
|
||||
{
|
||||
public:
|
||||
static vtkPVColorMaterialHelper* New();
|
||||
vtkTypeMacro(vtkPVColorMaterialHelper, vtkObject);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
void Initialize(vtkShaderProgram2*);
|
||||
vtkGetObjectMacro(Shader, vtkShaderProgram2);
|
||||
|
||||
// Description:
|
||||
// Prepares the shader i.e. reads color material paramters state from OpenGL.
|
||||
// This must be called before the shader is bound.
|
||||
void PrepareForRendering();
|
||||
|
||||
// Description:
|
||||
// Uploads any uniforms needed. This must be called only
|
||||
// after the shader has been bound, but before rendering the geometry.
|
||||
void Render();
|
||||
|
||||
//BTX
|
||||
protected:
|
||||
vtkPVColorMaterialHelper();
|
||||
~vtkPVColorMaterialHelper();
|
||||
|
||||
void SetShader(vtkShaderProgram2*);
|
||||
vtkShaderProgram2* Shader;
|
||||
|
||||
enum eMaterialParamater
|
||||
{
|
||||
DISABLED = 0,
|
||||
AMBIENT = 1,
|
||||
DIFFUSE = 2,
|
||||
SPECULAR = 3,
|
||||
AMBIENT_AND_DIFFUSE = 4,
|
||||
EMISSION = 5
|
||||
};
|
||||
eMaterialParamater Mode;
|
||||
|
||||
private:
|
||||
vtkPVColorMaterialHelper(const vtkPVColorMaterialHelper&); // Not implemented.
|
||||
void operator=(const vtkPVColorMaterialHelper&); // Not implemented.
|
||||
//ETX
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,58 @@
|
||||
//=========================================================================
|
||||
//
|
||||
// Program: ParaView
|
||||
// Module: vtkPVColorMaterialHelper_vs.glsl
|
||||
//
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
//=========================================================================
|
||||
// Id: Id
|
||||
|
||||
// symbols beginning with GL_ are reserved, so use lower-case
|
||||
// instead
|
||||
#define gl_ambient 1
|
||||
#define gl_diffuse 2
|
||||
#define gl_specular 3
|
||||
#define gl_ambient_and_diffuse 4
|
||||
#define gl_emission 5
|
||||
|
||||
uniform int vtkPVColorMaterialHelper_Mode;
|
||||
gl_MaterialParameters getMaterialParameters()
|
||||
{
|
||||
if (vtkPVColorMaterialHelper_Mode == 0)
|
||||
{
|
||||
return gl_FrontMaterial;
|
||||
}
|
||||
|
||||
gl_MaterialParameters materialParams = gl_FrontMaterial;
|
||||
if (vtkPVColorMaterialHelper_Mode == gl_ambient)
|
||||
{
|
||||
materialParams.ambient = gl_Color;
|
||||
}
|
||||
else if (vtkPVColorMaterialHelper_Mode == gl_diffuse)
|
||||
{
|
||||
materialParams.diffuse = gl_Color;
|
||||
}
|
||||
else if (vtkPVColorMaterialHelper_Mode == gl_specular)
|
||||
{
|
||||
materialParams.specular = gl_Color;
|
||||
}
|
||||
else if (vtkPVColorMaterialHelper_Mode == gl_ambient_and_diffuse)
|
||||
{
|
||||
materialParams.ambient = gl_Color;
|
||||
materialParams.diffuse = gl_Color;
|
||||
}
|
||||
else if (vtkPVColorMaterialHelper_Mode == gl_emission)
|
||||
{
|
||||
materialParams.emission = gl_Color;
|
||||
}
|
||||
return materialParams;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,94 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: vtkPVLightingHelper.cxx
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
#include "vtkPVLightingHelper.h"
|
||||
|
||||
#include "vtkObjectFactory.h"
|
||||
#include "vtkgl.h"
|
||||
#include "vtkShaderProgram2.h"
|
||||
#include "vtkShader2Collection.h"
|
||||
|
||||
extern const char* vtkPVLightingHelper_s;
|
||||
|
||||
vtkStandardNewMacro(vtkPVLightingHelper);
|
||||
vtkCxxSetObjectMacro(vtkPVLightingHelper, Shader, vtkShaderProgram2);
|
||||
//----------------------------------------------------------------------------
|
||||
vtkPVLightingHelper::vtkPVLightingHelper()
|
||||
{
|
||||
this->Shader = 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkPVLightingHelper::~vtkPVLightingHelper()
|
||||
{
|
||||
this->SetShader(0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkPVLightingHelper::Initialize(vtkShaderProgram2* pgm,
|
||||
vtkShader2Type mode)
|
||||
{
|
||||
if (this->Shader != pgm)
|
||||
{
|
||||
this->SetShader(pgm);
|
||||
if (pgm)
|
||||
{
|
||||
vtkShader2 *s=vtkShader2::New();
|
||||
s->SetSourceCode(vtkPVLightingHelper_s);
|
||||
s->SetType(mode);
|
||||
s->SetContext(this->Shader->GetContext());
|
||||
this->Shader->GetShaders()->AddItem(s);
|
||||
s->Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
#define VTK_MAX_LIGHTS 8
|
||||
void vtkPVLightingHelper::PrepareForRendering()
|
||||
{
|
||||
GLint ivalue;
|
||||
glGetIntegerv(vtkgl::CURRENT_PROGRAM, &ivalue);
|
||||
if (ivalue != 0)
|
||||
{
|
||||
vtkErrorMacro("PrepareForRendering() cannot be called after a shader program has been bound.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int cc=0; cc < VTK_MAX_LIGHTS; cc++)
|
||||
{
|
||||
// use the light's 4th diffuse component to store an enabled bit
|
||||
GLfloat lightDiffuse[4];
|
||||
glGetLightfv(GL_LIGHT0 + cc, GL_DIFFUSE, lightDiffuse);
|
||||
|
||||
// enable/disable the light for fixed function
|
||||
if (glIsEnabled(GL_LIGHT0 + cc))
|
||||
{
|
||||
lightDiffuse[3] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
lightDiffuse[3] = 0;
|
||||
}
|
||||
glLightfv(GL_LIGHT0 + cc, GL_DIFFUSE, lightDiffuse);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkPVLightingHelper::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os, indent);
|
||||
os << indent << "Shader: " << this->Shader << endl;
|
||||
}
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: vtkPVLightingHelper.h
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
// .NAME vtkPVLightingHelper - helper to assist in simulating lighting similar
|
||||
// to default OpenGL pipeline.
|
||||
// .SECTION Description
|
||||
// vtkPVLightingHelper is an helper to assist in simulating lighting similar
|
||||
// to default OpenGL pipeline. Look at vtkPVLightingHelper_s for available
|
||||
// GLSL functions.
|
||||
|
||||
#ifndef vtkPVLightingHelper_h
|
||||
#define vtkPVLightingHelper_h
|
||||
|
||||
#include "vtkObject.h"
|
||||
#include "vtkShader2.h" // for vtkShader2Type
|
||||
|
||||
class vtkShaderProgram2;
|
||||
|
||||
class VTK_EXPORT vtkPVLightingHelper : public vtkObject
|
||||
{
|
||||
public:
|
||||
static vtkPVLightingHelper* New();
|
||||
vtkTypeMacro(vtkPVLightingHelper, vtkObject);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
// Description:
|
||||
// Get/Set the shader program to which we want to add the lighting kernels.
|
||||
// mode = VTK_SHADER_TYPE_VERTEX or VTK_SHADER_TYPE_FRAGMENT
|
||||
// depending on whether the vertex lighting or fragment lighting is to be
|
||||
// used.
|
||||
void Initialize(vtkShaderProgram2 *shader,
|
||||
vtkShader2Type mode);
|
||||
vtkGetObjectMacro(Shader, vtkShaderProgram2);
|
||||
|
||||
// Description:
|
||||
// Updates any lighting specific information needed.
|
||||
// This must be called before the shader program is bound.
|
||||
void PrepareForRendering();
|
||||
|
||||
//BTX
|
||||
protected:
|
||||
vtkPVLightingHelper();
|
||||
~vtkPVLightingHelper();
|
||||
|
||||
void SetShader(vtkShaderProgram2 *shader);
|
||||
vtkShaderProgram2 *Shader;
|
||||
|
||||
private:
|
||||
vtkPVLightingHelper(const vtkPVLightingHelper&); // Not implemented.
|
||||
void operator=(const vtkPVLightingHelper&); // Not implemented.
|
||||
//ETX
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -0,0 +1,189 @@
|
||||
//=========================================================================
|
||||
//
|
||||
// Program: ParaView
|
||||
// Module: vtkPVLightingHelper_s.glsl
|
||||
//
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
//=========================================================================
|
||||
// Filename: vtkPVLighting.glsl
|
||||
// Filename is useful when using gldb-gui
|
||||
|
||||
// This file defines some lighting functions.
|
||||
// They can be used either in a vertex or fragment shader.
|
||||
|
||||
// It is intented to be used in conjunction with vtkPVLightsSwitches class.
|
||||
|
||||
// Those functions expect uniform variables about the status of lights
|
||||
// 1. In fixed-mode pipeline (glUseProgram(0)),
|
||||
// 2. get the values with GLboolean lightSwitch[i]=glIsEnabled(GL_LIGHTi);
|
||||
// 3. Switch to programmable pipeline (glUseProgram(prog))
|
||||
// 4. Send boolean as uniform: var=glGetUniformLocation(prog,"lightSwitch[i]");
|
||||
// 5. glUniform1i(var,lightSwitch[i]);
|
||||
|
||||
// vtkPVLightsSwitches class can do that for you.
|
||||
|
||||
|
||||
// Example in vertex shader:
|
||||
// Reminder: two-sided/one-sided is controlled by GL_VERTEX_PROGRAM_TWO_SIDE
|
||||
//
|
||||
// vec4 eyeCoords=gl_ModelViewMatrix*gl_Vertex;
|
||||
// vec4 n=gl_Normalmatrix*gl_Normal;
|
||||
// n=normalize(n);
|
||||
// separateSpecularColor(gl_FrontMaterial,eyeCoords,n,gl_FrontColor,gl_FrontSecondaryColor);
|
||||
// If two-sided.
|
||||
// separateSpecularColor(gl_BackMaterial,eyeCoords,n,gl_BackColor,gl_BackSecondaryColor);
|
||||
|
||||
// Typical:
|
||||
// gl_FrontColor=singleColor(gl_FrontMaterial,eyeCoords,n);
|
||||
|
||||
// This is convenience method to use in shader but you better do
|
||||
// this computation on the CPU and send the result as a uniform.
|
||||
|
||||
// True if any enabled light is a positional one.
|
||||
bool needSurfacePositionInEyeCoordinates()
|
||||
{
|
||||
bool result=false;
|
||||
for (int i=0; !result && (i < gl_MaxLights); i++)
|
||||
{
|
||||
result = (gl_LightSource[i].diffuse.w != 0.0) &&
|
||||
(gl_LightSource[i].position.w != 0.0);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Lighting computation based on a material m,
|
||||
// a position on the surface expressed in eye coordinate (typically a vertex
|
||||
// position in a vertex shader, something interpolated in a fragment shader),
|
||||
// a unit normal `n' to the surface in eye coordinates.
|
||||
// Most of the components are in cpri (primary color), the specular
|
||||
// component is in csec (secondary color).
|
||||
// Useful for blending color and textures.
|
||||
void separateSpecularColor(gl_MaterialParameters m,
|
||||
vec3 surfacePosEyeCoords,
|
||||
vec3 n,
|
||||
out vec4 cpri,
|
||||
out vec4 csec)
|
||||
{
|
||||
cpri = m.emission + m.ambient * gl_LightModel.ambient; // ecm+acm*acs
|
||||
csec = vec4(0.0,0.0,0.0,1.0);
|
||||
vec3 wReverseRayDir = surfacePosEyeCoords;
|
||||
|
||||
// For each light,
|
||||
for (int i=0; i < gl_MaxLights; i++)
|
||||
{
|
||||
// Trick.
|
||||
bool lightEnabled = (gl_LightSource[i].diffuse.w != 0.0);
|
||||
if (!lightEnabled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
vec3 lightPos;
|
||||
vec3 ldir;
|
||||
vec3 h;
|
||||
float att;
|
||||
float spot;
|
||||
float shininessFactor;
|
||||
|
||||
if (gl_LightSource[i].position.w != 0.0)
|
||||
{
|
||||
// ldir=light direction
|
||||
ldir = lightPos - surfacePosEyeCoords;
|
||||
float sqrDistance = dot(ldir,ldir);
|
||||
ldir = normalize(ldir);
|
||||
h = normalize(ldir + wReverseRayDir);
|
||||
att = 1.0 / (gl_LightSource[i].constantAttenuation + gl_LightSource[i].linearAttenuation *
|
||||
sqrt(sqrDistance) + gl_LightSource[i].quadraticAttenuation * sqrDistance);
|
||||
}
|
||||
else
|
||||
{
|
||||
att = 1.0;
|
||||
ldir = gl_LightSource[i].position.xyz;
|
||||
ldir = normalize(ldir);
|
||||
h = normalize(ldir + wReverseRayDir);
|
||||
}
|
||||
|
||||
if (att>0.0)
|
||||
{
|
||||
if (gl_LightSource[i].spotCutoff == 180.0)
|
||||
{
|
||||
spot = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float coef=-dot(ldir,gl_LightSource[i].spotDirection);
|
||||
if (coef>=gl_LightSource[i].spotCosCutoff)
|
||||
{
|
||||
spot=pow(coef,gl_LightSource[i].spotExponent);
|
||||
}
|
||||
else
|
||||
{
|
||||
spot=0.0;
|
||||
}
|
||||
}
|
||||
if (spot>0.0)
|
||||
{
|
||||
// LIT operation...
|
||||
float nDotL=dot(n,ldir);
|
||||
float nDotH=dot(n,h);
|
||||
|
||||
// separate nDotL and nDotH for two-sided shading, otherwise we
|
||||
// get black spots.
|
||||
|
||||
if (nDotL<0.0) // two-sided shading
|
||||
{
|
||||
nDotL=-nDotL;
|
||||
}
|
||||
|
||||
if (nDotH<0.0) // two-sided shading
|
||||
{
|
||||
nDotH=-nDotH;
|
||||
}
|
||||
// ambient term for this light
|
||||
vec4 cpril=m.ambient*gl_LightSource[i].ambient;// acm*adi
|
||||
|
||||
// diffuse term for this light
|
||||
if (nDotL>0.0)
|
||||
{
|
||||
cpril+=m.diffuse*gl_LightSource[i].diffuse*nDotL; // dcm*dcli
|
||||
}
|
||||
|
||||
// specular term for this light
|
||||
shininessFactor=pow(nDotH,m.shininess); // srm
|
||||
|
||||
cpri+=att*spot*cpril;
|
||||
|
||||
// scm*scli
|
||||
csec+=att*spot*
|
||||
m.specular*gl_LightSource[i].specular*shininessFactor;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Lighting computation based on a material m,
|
||||
// a position on the surface expressed in eye coordinate (typically a vertex
|
||||
// position in a vertex shader, something interpolated in a fragment shader),
|
||||
// a unit normal to the surface in eye coordinates.
|
||||
// The result includes the specular component.
|
||||
vec4 singleColor(gl_MaterialParameters m,
|
||||
vec3 surfacePosEyeCoords,
|
||||
vec3 n)
|
||||
{
|
||||
vec4 cpri;
|
||||
vec4 csec;
|
||||
separateSpecularColor(m,surfacePosEyeCoords,n,cpri,csec);
|
||||
return cpri+csec;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,283 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit
|
||||
Module: vtkVisibleLinesPainter.cxx
|
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
#include "vtkVisibleLinesPainter.h"
|
||||
|
||||
#include "vtkActor.h"
|
||||
#include "vtkBoundingBox.h"
|
||||
#include "vtkPVColorMaterialHelper.h"
|
||||
#include "vtkFrameBufferObject.h"
|
||||
#include "vtkPVLightingHelper.h"
|
||||
#include "vtkShaderProgram2.h"
|
||||
#include "vtkShader2.h"
|
||||
#include "vtkShader2Collection.h"
|
||||
#include "vtkUniformVariables.h"
|
||||
#include "vtkTextureObject.h"
|
||||
#include "vtkObjectFactory.h"
|
||||
#include "vtkPolyData.h"
|
||||
#include "vtkProperty.h"
|
||||
#include "vtkRenderer.h"
|
||||
#include "vtkOpenGLRenderWindow.h"
|
||||
|
||||
#include <string>
|
||||
#include <assert.h>
|
||||
#include "vtkgl.h"
|
||||
|
||||
extern const char* vtkVisibleLinesPainter_vs;
|
||||
extern const char* vtkVisibleLinesPainter_fs;
|
||||
|
||||
vtkStandardNewMacro(vtkVisibleLinesPainter);
|
||||
#define vtkGetIndex(r,c) (c*4+r)
|
||||
|
||||
inline double vtkClamp(double val, const double& min, const double& max)
|
||||
{
|
||||
val = (val < min)? min : val;
|
||||
val = (val > max)? max : val;
|
||||
return val;
|
||||
}
|
||||
|
||||
class vtkVisibleLinesPainter::vtkInternals
|
||||
{
|
||||
public:
|
||||
vtkWeakPointer<vtkRenderWindow> LastContext;
|
||||
int LastViewportSize[2];
|
||||
int ViewportExtent[4];
|
||||
|
||||
vtkSmartPointer<vtkFrameBufferObject> FBO;
|
||||
vtkSmartPointer<vtkTextureObject> DepthImage;
|
||||
vtkSmartPointer<vtkShaderProgram2> Shader;
|
||||
vtkSmartPointer<vtkPVLightingHelper> LightingHelper;
|
||||
vtkSmartPointer<vtkPVColorMaterialHelper> ColorMaterialHelper;
|
||||
|
||||
vtkInternals()
|
||||
{
|
||||
this->LastViewportSize[0] = this->LastViewportSize[1] = 0;
|
||||
this->LightingHelper = vtkSmartPointer<vtkPVLightingHelper>::New();
|
||||
this->ColorMaterialHelper = vtkSmartPointer<vtkPVColorMaterialHelper>::New();
|
||||
}
|
||||
|
||||
void ClearTextures()
|
||||
{
|
||||
this->DepthImage = 0;
|
||||
if (this->FBO)
|
||||
{
|
||||
this->FBO->RemoveAllColorBuffers();
|
||||
this->FBO->RemoveDepthBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
void ClearGraphicsResources()
|
||||
{
|
||||
this->ClearTextures();
|
||||
this->FBO = 0;
|
||||
this->DepthImage = 0;
|
||||
this->LightingHelper->Initialize(0,VTK_SHADER_TYPE_VERTEX);
|
||||
this->ColorMaterialHelper->Initialize(0);
|
||||
if(this->Shader!=0)
|
||||
{
|
||||
this->Shader->ReleaseGraphicsResources();
|
||||
this->Shader = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkVisibleLinesPainter::vtkVisibleLinesPainter()
|
||||
{
|
||||
this->Internals = new vtkInternals();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkVisibleLinesPainter::~vtkVisibleLinesPainter()
|
||||
{
|
||||
this->ReleaseGraphicsResources(this->Internals->LastContext);
|
||||
delete this->Internals;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkVisibleLinesPainter::ReleaseGraphicsResources(vtkWindow* win)
|
||||
{
|
||||
this->Internals->ClearGraphicsResources();
|
||||
this->Internals->LastContext = 0;
|
||||
|
||||
this->Superclass::ReleaseGraphicsResources(win);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool vtkVisibleLinesPainter::CanRender(vtkRenderer* vtkNotUsed(renderer),
|
||||
vtkActor* actor)
|
||||
{
|
||||
return (actor->GetProperty()->GetRepresentation() == VTK_WIREFRAME);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkVisibleLinesPainter::PrepareForRendering(vtkRenderer* renderer, vtkActor* actor)
|
||||
{
|
||||
if (!this->CanRender(renderer, actor))
|
||||
{
|
||||
this->Internals->ClearGraphicsResources();
|
||||
this->Internals->LastContext = 0;
|
||||
this->Superclass::PrepareForRendering(renderer, actor);
|
||||
return;
|
||||
}
|
||||
|
||||
vtkRenderWindow* renWin = renderer->GetRenderWindow();
|
||||
if (this->Internals->LastContext != renWin)
|
||||
{
|
||||
this->Internals->ClearGraphicsResources();
|
||||
}
|
||||
this->Internals->LastContext = renWin;
|
||||
|
||||
int viewsize[2], vieworigin[2];
|
||||
renderer->GetTiledSizeAndOrigin(&viewsize[0], &viewsize[1], &vieworigin[0], &vieworigin[1]);
|
||||
if (this->Internals->LastViewportSize[0] != viewsize[0] ||
|
||||
this->Internals->LastViewportSize[1] != viewsize[1])
|
||||
{
|
||||
// View size has changed, we need to re-generate the textures.
|
||||
this->Internals->ClearTextures();
|
||||
}
|
||||
this->Internals->LastViewportSize[0] = viewsize[0];
|
||||
this->Internals->LastViewportSize[1] = viewsize[1];
|
||||
|
||||
if (!this->Internals->FBO)
|
||||
{
|
||||
vtkFrameBufferObject* fbo = vtkFrameBufferObject::New();
|
||||
fbo->SetContext(renWin);
|
||||
this->Internals->FBO = fbo;
|
||||
fbo->Delete();
|
||||
}
|
||||
|
||||
if (!this->Internals->DepthImage)
|
||||
{
|
||||
vtkTextureObject* depthImage = vtkTextureObject::New();
|
||||
depthImage->SetContext(renWin);
|
||||
depthImage->Create2D(viewsize[0], viewsize[1], 1, VTK_VOID, false);
|
||||
this->Internals->FBO->SetDepthBuffer(depthImage);
|
||||
this->Internals->DepthImage = depthImage;
|
||||
depthImage->Delete();
|
||||
}
|
||||
|
||||
if (!this->Internals->Shader)
|
||||
{
|
||||
vtkShaderProgram2* pgm = vtkShaderProgram2::New();
|
||||
pgm->SetContext(static_cast<vtkOpenGLRenderWindow *>(renWin));
|
||||
|
||||
vtkShader2 *s1=vtkShader2::New();
|
||||
s1->SetType(VTK_SHADER_TYPE_VERTEX);
|
||||
s1->SetSourceCode(vtkVisibleLinesPainter_vs);
|
||||
s1->SetContext(pgm->GetContext());
|
||||
|
||||
vtkShader2 *s2=vtkShader2::New();
|
||||
s2->SetType(VTK_SHADER_TYPE_FRAGMENT);
|
||||
s2->SetSourceCode(vtkVisibleLinesPainter_fs);
|
||||
s2->SetContext(pgm->GetContext());
|
||||
|
||||
pgm->GetShaders()->AddItem(s1);
|
||||
pgm->GetShaders()->AddItem(s2);
|
||||
s1->Delete();
|
||||
s2->Delete();
|
||||
|
||||
this->Internals->LightingHelper->Initialize(pgm,VTK_SHADER_TYPE_VERTEX);
|
||||
this->Internals->ColorMaterialHelper->Initialize(pgm);
|
||||
this->Internals->Shader = pgm;
|
||||
pgm->Delete();
|
||||
}
|
||||
|
||||
// Now compute the bounds of the pixels that this dataset is going to occupy
|
||||
// on the screen.
|
||||
this->Internals->ViewportExtent[0] = vieworigin[0];
|
||||
this->Internals->ViewportExtent[1] = vieworigin[0] + viewsize[0];
|
||||
this->Internals->ViewportExtent[2] = vieworigin[1];
|
||||
this->Internals->ViewportExtent[3] = vieworigin[1] + viewsize[1];
|
||||
this->Superclass::PrepareForRendering(renderer, actor);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkVisibleLinesPainter::RenderInternal(vtkRenderer *renderer,
|
||||
vtkActor *actor,
|
||||
unsigned long typeflags,
|
||||
bool forceCompileOnly)
|
||||
{
|
||||
if (!this->CanRender(renderer, actor))
|
||||
{
|
||||
this->Superclass::RenderInternal(renderer, actor, typeflags,
|
||||
forceCompileOnly);
|
||||
return;
|
||||
}
|
||||
|
||||
vtkRenderWindow* renWin = renderer->GetRenderWindow();
|
||||
|
||||
// Save context state to be able to restore.
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
glDisable(GL_POLYGON_OFFSET_LINE);
|
||||
glDisable(GL_POLYGON_OFFSET_POINT);
|
||||
|
||||
// we get the view port size (not the renderwindow size).
|
||||
int viewsize[2], vieworigin[2];
|
||||
renderer->GetTiledSizeAndOrigin(&viewsize[0], &viewsize[1], &vieworigin[0], &vieworigin[1]);
|
||||
|
||||
// Pass One: Render surface, we are only interested in the depth buffer, hence
|
||||
// we don't clear the color buffer. However, color buffer attachment is needed
|
||||
// for FBO completeness (verify).
|
||||
this->Internals->FBO->StartNonOrtho(viewsize[0], viewsize[1], false);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
this->Superclass::Superclass::RenderInternal(renderer, actor, typeflags,
|
||||
forceCompileOnly);
|
||||
glFlush();
|
||||
this->Internals->FBO->UnBind();
|
||||
|
||||
// Now paste back the rendered image into the default framebuffer.
|
||||
renWin->MakeCurrent();
|
||||
this->Internals->LightingHelper->PrepareForRendering();
|
||||
this->Internals->ColorMaterialHelper->PrepareForRendering();
|
||||
|
||||
this->Internals->Shader->Build();
|
||||
if(this->Internals->Shader->GetLastBuildStatus()
|
||||
!=VTK_SHADER_PROGRAM2_LINK_SUCCEEDED)
|
||||
{
|
||||
vtkErrorMacro("Pass Two failed.");
|
||||
abort();
|
||||
}
|
||||
|
||||
this->Internals->ColorMaterialHelper->Render();
|
||||
vtkgl::ActiveTexture(vtkgl::TEXTURE0);
|
||||
this->Internals->DepthImage->Bind();
|
||||
|
||||
int value=0;
|
||||
this->Internals->Shader->GetUniformVariables()->SetUniformi("texDepth",1,&value);
|
||||
float fvalues[2];
|
||||
fvalues[0]=static_cast<float>(viewsize[0]);
|
||||
fvalues[1]=static_cast<float>(viewsize[1]);
|
||||
this->Internals->Shader->GetUniformVariables()->SetUniformf("uViewSize",2,fvalues);
|
||||
this->Internals->Shader->Use();
|
||||
if(!this->Internals->Shader->IsValid())
|
||||
{
|
||||
vtkErrorMacro(<<" validation of the program failed: "<<this->Internals->Shader->GetLastValidateLog());
|
||||
}
|
||||
this->Superclass::RenderInternal(renderer, actor, typeflags, forceCompileOnly);
|
||||
this->Internals->Shader->Restore();
|
||||
|
||||
// Pop the attributes.
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkVisibleLinesPainter::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os, indent);
|
||||
}
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: Visualization Toolkit
|
||||
Module: vtkVisibleLinesPainter.h
|
||||
|
||||
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
// .NAME vtkVisibleLinesPainter - this is more of a hidden lines remove painter.
|
||||
// .SECTION Description
|
||||
// vtkVisibleLinesPainter is a hidden lines removal painter that removes hidden
|
||||
// lines. Once this painter is inserted in the painter chain, if the
|
||||
// representation type is VTK_WIREFRAME, then it will automatically remove the
|
||||
// hidden lines.
|
||||
|
||||
#ifndef vtkVisibleLinesPainter_h
|
||||
#define vtkVisibleLinesPainter_h
|
||||
|
||||
#include "vtkOpenGLRepresentationPainter.h"
|
||||
|
||||
class VTK_EXPORT vtkVisibleLinesPainter : public vtkOpenGLRepresentationPainter
|
||||
{
|
||||
public:
|
||||
static vtkVisibleLinesPainter* New();
|
||||
vtkTypeMacro(vtkVisibleLinesPainter, vtkOpenGLRepresentationPainter);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
// Description:
|
||||
// Release any graphics resources that are being consumed by this mapper.
|
||||
// The parameter window could be used to determine which graphic
|
||||
// resources to release. In this case, releases the display lists.
|
||||
virtual void ReleaseGraphicsResources(vtkWindow *);
|
||||
|
||||
//BTX
|
||||
protected:
|
||||
vtkVisibleLinesPainter();
|
||||
~vtkVisibleLinesPainter();
|
||||
|
||||
// Description:
|
||||
// Some subclasses may need to do some preprocessing
|
||||
// before the actual rendering can be done eg. build effecient
|
||||
// representation for the data etc. This should be done here.
|
||||
// This method get called after the ProcessInformation()
|
||||
// but before RenderInternal().
|
||||
virtual void PrepareForRendering(vtkRenderer*, vtkActor*);
|
||||
|
||||
// Description:
|
||||
// Changes the polygon mode according to the representation.
|
||||
void RenderInternal(vtkRenderer* renderer, vtkActor* actor,
|
||||
unsigned long typeflags, bool forceCompileOnly);
|
||||
|
||||
// Description:
|
||||
// Returns true when rendering is possible.
|
||||
bool CanRender(vtkRenderer*, vtkActor*);
|
||||
|
||||
private:
|
||||
vtkVisibleLinesPainter(const vtkVisibleLinesPainter&); // Not implemented.
|
||||
void operator=(const vtkVisibleLinesPainter&); // Not implemented.
|
||||
|
||||
class vtkInternals;
|
||||
vtkInternals* Internals;
|
||||
//ETX
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
//=========================================================================
|
||||
//
|
||||
// Program: ParaView
|
||||
// Module: vtkVisibleLinesPainter_fs.glsl
|
||||
//
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
//=========================================================================
|
||||
// Id: Id
|
||||
|
||||
|
||||
uniform sampler2D texDepth;
|
||||
uniform vec2 uViewSize;
|
||||
varying vec4 vColor;
|
||||
|
||||
const vec2 threshold = vec2(0.00001, 0.005);
|
||||
void main (void)
|
||||
{
|
||||
float surfaceDepth = texture2D(texDepth, gl_FragCoord.xy/uViewSize).x;
|
||||
|
||||
// tolerance increases as depth increases, this ensures that the lines appear
|
||||
// smooth and continuous.
|
||||
float tolerance = threshold.x + (1.0 - gl_FragCoord.z) * (threshold.y - threshold.x);
|
||||
if (surfaceDepth+tolerance < gl_FragCoord.z)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
gl_FragColor = vColor;
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
//=========================================================================
|
||||
//
|
||||
// Program: ParaView
|
||||
// Module: vtkVisibleLinesPainter_vs.glsl
|
||||
//
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
//=========================================================================
|
||||
// Id: Id
|
||||
|
||||
#version 120
|
||||
varying vec4 vColor;
|
||||
|
||||
// from vtkPVColorMaterialHelper
|
||||
gl_MaterialParameters getMaterialParameters();
|
||||
|
||||
// from vtkPVLightingHelper
|
||||
vec4 singleColor(gl_MaterialParameters m,
|
||||
vec3 surfacePosEyeCoords, vec3 n);
|
||||
|
||||
vec4 colorFrontFace()
|
||||
{
|
||||
vec4 heyeCoords = gl_ModelViewMatrix*gl_Vertex;
|
||||
vec3 eyeCoords = heyeCoords.xyz/heyeCoords.w;
|
||||
vec3 n = normalize(gl_NormalMatrix*gl_Normal);
|
||||
return singleColor(getMaterialParameters(),eyeCoords,n);
|
||||
}
|
||||
|
||||
void main (void)
|
||||
{
|
||||
gl_Position = ftransform();
|
||||
vColor = colorFrontFace();
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: vtkVisibleLinesPolyDataMapper.cxx
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
#include "vtkVisibleLinesPolyDataMapper.h"
|
||||
|
||||
#include "vtkObjectFactory.h"
|
||||
#include "vtkVisibleLinesPainter.h"
|
||||
#include "vtkDefaultPainter.h"
|
||||
|
||||
vtkStandardNewMacro(vtkVisibleLinesPolyDataMapper);
|
||||
//----------------------------------------------------------------------------
|
||||
vtkVisibleLinesPolyDataMapper::vtkVisibleLinesPolyDataMapper()
|
||||
{
|
||||
// Replace the representation painter to the vtkVisibleLinesPainter,
|
||||
// so when rendering as wireframe, we remove the hidden lines.
|
||||
vtkVisibleLinesPainter* painter = vtkVisibleLinesPainter::New();
|
||||
|
||||
vtkDefaultPainter* dfPainter = vtkDefaultPainter::SafeDownCast(this->GetPainter());
|
||||
dfPainter->SetRepresentationPainter(painter);
|
||||
painter->Delete();
|
||||
|
||||
// Disable display lists, since vtkVisibleLinesPainter is not designed to work
|
||||
// with display lists.
|
||||
dfPainter->SetDisplayListPainter(0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkVisibleLinesPolyDataMapper::~vtkVisibleLinesPolyDataMapper()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkVisibleLinesPolyDataMapper::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os, indent);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: vtkVisibleLinesPolyDataMapper.h
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
// .NAME vtkVisibleLinesPolyDataMapper
|
||||
// .SECTION Description
|
||||
//
|
||||
|
||||
#ifndef vtkVisibleLinesPolyDataMapper_h
|
||||
#define vtkVisibleLinesPolyDataMapper_h
|
||||
|
||||
#include "vtkPainterPolyDataMapper.h"
|
||||
|
||||
class VTK_EXPORT vtkVisibleLinesPolyDataMapper : public vtkPainterPolyDataMapper
|
||||
{
|
||||
public:
|
||||
static vtkVisibleLinesPolyDataMapper* New();
|
||||
vtkTypeMacro(vtkVisibleLinesPolyDataMapper, vtkPainterPolyDataMapper);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
//BTX
|
||||
protected:
|
||||
vtkVisibleLinesPolyDataMapper();
|
||||
~vtkVisibleLinesPolyDataMapper();
|
||||
|
||||
private:
|
||||
vtkVisibleLinesPolyDataMapper(const vtkVisibleLinesPolyDataMapper&); // Not implemented
|
||||
void operator=(const vtkVisibleLinesPolyDataMapper&); // Not implemented
|
||||
//ETX
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
|
||||
# create a paraview plugin containing server manager xml and the server
|
||||
# manager classes to build
|
||||
# this plugin can be loaded on the server side
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
IF(NOT ParaView_BINARY_DIR)
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
ENDIF()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
ADD_PARAVIEW_PLUGIN(SMParametricSource "1.0"
|
||||
SERVER_MANAGER_XML ParametricSource.xml)
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
<ServerManagerConfiguration>
|
||||
<ProxyGroup name="parametric_functions">
|
||||
<Proxy name="ParametricBoy" class="vtkParametricBoy"/>
|
||||
<Proxy name="ParametricConicSpiral" class="vtkParametricConicSpiral">
|
||||
<DoubleVectorProperty name="TubeRadius" command="SetA"
|
||||
animateable="1"
|
||||
number_of_elements="1" default_values="0.2">
|
||||
<DoubleRangeDomain name="range" min="0" />
|
||||
</DoubleVectorProperty>
|
||||
<DoubleVectorProperty name="Height" command="SetB"
|
||||
number_of_elements="1" default_values="1">
|
||||
<DoubleRangeDomain name="range" min="0" />
|
||||
</DoubleVectorProperty>
|
||||
<DoubleVectorProperty name="Radius" command="SetC"
|
||||
number_of_elements="1" default_values="0.1">
|
||||
<DoubleRangeDomain name="range" min="0" />
|
||||
</DoubleVectorProperty>
|
||||
<DoubleVectorProperty name="NumberOfWindings" command="SetN"
|
||||
number_of_elements="1" default_values="2">
|
||||
<DoubleRangeDomain name="range" min="0" />
|
||||
</DoubleVectorProperty>
|
||||
</Proxy>
|
||||
<Proxy name="ParametricEllipsoid" class="vtkParametricEllipsoid"/>
|
||||
</ProxyGroup>
|
||||
|
||||
<ProxyGroup name="sources">
|
||||
<SourceProxy name="ParametricSource"
|
||||
class="vtkParametricFunctionSource"
|
||||
label="Parametric Source">
|
||||
<ProxyProperty
|
||||
command="SetParametricFunction"
|
||||
name="ParametricFunction"
|
||||
label="Parametric Function">
|
||||
<ProxyListDomain name="proxy_list">
|
||||
<Proxy group="parametric_functions" name="ParametricBoy" />
|
||||
<Proxy group="parametric_functions" name="ParametricConicSpiral" />
|
||||
<Proxy group="parametric_functions" name="ParametricEllipsoid" />
|
||||
</ProxyListDomain>
|
||||
</ProxyProperty>
|
||||
</SourceProxy>
|
||||
</ProxyGroup>
|
||||
</ServerManagerConfiguration>
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
# This plugin demonstrates creating new types pqPropertyWidget and
|
||||
# pqPropertyWidgetDecorator instances for customizing the Properties panel.
|
||||
cmake_minimum_required(VERSION 2.8.8)
|
||||
|
||||
if (NOT ParaView_BINARY_DIR)
|
||||
find_package(ParaView REQUIRED)
|
||||
include(${PARAVIEW_USE_FILE})
|
||||
endif()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
if (PARAVIEW_BUILD_QT_GUI)
|
||||
if (PARAVIEW_QT_VERSION VERSION_GREATER "4")
|
||||
qt5_wrap_cpp(moc_srcs
|
||||
pqMyPropertyWidgetForProperty.h
|
||||
pqMyPropertyWidgetForGroup.h
|
||||
pqMyPropertyWidgetDecorator.h)
|
||||
else ()
|
||||
qt4_wrap_cpp(moc_srcs
|
||||
pqMyPropertyWidgetForProperty.h
|
||||
pqMyPropertyWidgetForGroup.h
|
||||
pqMyPropertyWidgetDecorator.h)
|
||||
endif ()
|
||||
|
||||
set (outifaces0)
|
||||
set (outsrcs0)
|
||||
add_paraview_property_widget(outifaces0 outsrcs0
|
||||
TYPE "my_property_widget_type"
|
||||
CLASS_NAME pqMyPropertyWidgetForProperty)
|
||||
|
||||
set (outifaces1)
|
||||
set (outsrcs1)
|
||||
add_paraview_property_group_widget(outifaces1 outsrcs1
|
||||
TYPE "my_property_group_type"
|
||||
CLASS_NAME pqMyPropertyWidgetForGroup)
|
||||
|
||||
set (outifaces2)
|
||||
set (outsrcs2)
|
||||
add_paraview_property_widget_decorator(outifaces2 outsrcs2
|
||||
TYPE "my_decorator"
|
||||
CLASS_NAME pqMyPropertyWidgetDecorator)
|
||||
|
||||
# Now, create the plugin.
|
||||
add_paraview_plugin(ExamplesPropertyWidgets "1.0"
|
||||
SERVER_MANAGER_XML PropertyWidgetsFilter.xml
|
||||
GUI_INTERFACES ${outifaces0}
|
||||
${outifaces1}
|
||||
${outifaces2}
|
||||
SOURCES ${outsrcs0}
|
||||
${outsrcs1}
|
||||
${outsrcs2}
|
||||
${moc_srcs}
|
||||
pqMyPropertyWidgetForProperty.cxx
|
||||
pqMyPropertyWidgetForGroup.cxx
|
||||
pqMyPropertyWidgetDecorator.cxx)
|
||||
endif()
|
||||
@ -0,0 +1,39 @@
|
||||
<ServerManagerConfiguration>
|
||||
<!-- This is the server manager configuration XML. It defines the interface to
|
||||
our new filter. As a rule of thumb, try to locate the configuration for
|
||||
a filter already in ParaView
|
||||
that matches your filter and then model your xml on it
|
||||
Here, we just change the XML to create our custom widgets instead of
|
||||
default ones.
|
||||
-->
|
||||
<ProxyGroup name="filters">
|
||||
<SourceProxy name="MyPropertyWidgetsFilter" label="MyPropertyWidgets"
|
||||
class="vtkShrinkFilter"
|
||||
base_proxygroup="filters"
|
||||
base_proxyname="ShrinkFilter">
|
||||
|
||||
<IntVectorProperty name="DemonstratePropertyWidget"
|
||||
number_of_elements="1"
|
||||
default_values="0"
|
||||
panel_widget="my_property_widget_type">
|
||||
<Documentation>
|
||||
This property's widget is a custom widget.
|
||||
</Documentation>
|
||||
<BooleanDomain name="bool"/>
|
||||
</IntVectorProperty>
|
||||
|
||||
<DoubleVectorProperty name="DemonstratePropertyWidgetDecorator"
|
||||
number_of_elements="1"
|
||||
default_values="0">
|
||||
<Documentation>
|
||||
This property's widget is standard, but the decorator controls it's
|
||||
logic. This property will be "available" only when
|
||||
ShrinkFactor >= 0.1.
|
||||
</Documentation>
|
||||
<Hints>
|
||||
<PropertyWidgetDecorator type="my_decorator" />
|
||||
</Hints>
|
||||
</DoubleVectorProperty>
|
||||
</SourceProxy>
|
||||
</ProxyGroup>
|
||||
</ServerManagerConfiguration>
|
||||
@ -0,0 +1,86 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#include "pqMyPropertyWidgetDecorator.h"
|
||||
|
||||
#include "pqCoreUtilities.h"
|
||||
#include "pqPropertyWidget.h"
|
||||
#include "vtkCommand.h"
|
||||
#include "vtkSMProperty.h"
|
||||
#include "vtkSMProxy.h"
|
||||
#include "vtkSMUncheckedPropertyHelper.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
pqMyPropertyWidgetDecorator::pqMyPropertyWidgetDecorator(
|
||||
vtkPVXMLElement* config, pqPropertyWidget* parentObject)
|
||||
: Superclass(config, parentObject)
|
||||
{
|
||||
vtkSMProxy* proxy = parentObject->proxy();
|
||||
vtkSMProperty* prop = proxy? proxy->GetProperty("ShrinkFactor") : NULL;
|
||||
if (!prop)
|
||||
{
|
||||
qDebug("Could not locate property named 'ShrinkFactor'. "
|
||||
"pqMyPropertyWidgetDecorator will have no effect.");
|
||||
return;
|
||||
}
|
||||
|
||||
this->ObservedObject = prop;
|
||||
this->ObserverId = pqCoreUtilities::connect(
|
||||
prop, vtkCommand::UncheckedPropertyModifiedEvent,
|
||||
this, SIGNAL(visibilityChanged()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
pqMyPropertyWidgetDecorator::~pqMyPropertyWidgetDecorator()
|
||||
{
|
||||
if (this->ObservedObject && this->ObserverId)
|
||||
{
|
||||
this->ObservedObject->RemoveObserver(this->ObserverId);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool pqMyPropertyWidgetDecorator::canShowWidget(bool show_advanced) const
|
||||
{
|
||||
pqPropertyWidget* parentObject = this->parentWidget();
|
||||
vtkSMProxy* proxy = parentObject->proxy();
|
||||
vtkSMProperty* prop = proxy? proxy->GetProperty("ShrinkFactor") : NULL;
|
||||
if (prop)
|
||||
{
|
||||
double value = vtkSMUncheckedPropertyHelper(prop).GetAsDouble();
|
||||
if (value < 0.1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return this->Superclass::canShowWidget(show_advanced);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#ifndef pqMyPropertyWidgetDecorator_h
|
||||
#define pqMyPropertyWidgetDecorator_h
|
||||
|
||||
#include "pqPropertyWidgetDecorator.h"
|
||||
#include "vtkWeakPointer.h"
|
||||
class vtkObject;
|
||||
|
||||
class pqMyPropertyWidgetDecorator : public pqPropertyWidgetDecorator
|
||||
{
|
||||
Q_OBJECT
|
||||
typedef pqPropertyWidgetDecorator Superclass;
|
||||
public:
|
||||
pqMyPropertyWidgetDecorator(
|
||||
vtkPVXMLElement* config, pqPropertyWidget* parentObject);
|
||||
virtual ~pqMyPropertyWidgetDecorator();
|
||||
|
||||
/// Overridden to hide the widget when ShrinkFactor < 0.1
|
||||
virtual bool canShowWidget(bool show_advanced) const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(pqMyPropertyWidgetDecorator)
|
||||
|
||||
vtkWeakPointer<vtkObject> ObservedObject;
|
||||
unsigned long ObserverId;
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,45 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#include "pqMyPropertyWidgetForGroup.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
pqMyPropertyWidgetForGroup::pqMyPropertyWidgetForGroup(
|
||||
vtkSMProxy *smproxy, vtkSMPropertyGroup *smgroup, QWidget *parentObject)
|
||||
: Superclass(smproxy, parentObject)
|
||||
{
|
||||
Q_UNUSED(smgroup);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
pqMyPropertyWidgetForGroup::~pqMyPropertyWidgetForGroup()
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#ifndef pqMyPropertyWidgetForGroup_h
|
||||
#define pqMyPropertyWidgetForGroup_h
|
||||
|
||||
#include "pqPropertyWidget.h"
|
||||
|
||||
class vtkSMPropertyGroup;
|
||||
|
||||
class pqMyPropertyWidgetForGroup : public pqPropertyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
typedef pqPropertyWidget Superclass;
|
||||
public:
|
||||
pqMyPropertyWidgetForGroup(
|
||||
vtkSMProxy *smproxy, vtkSMPropertyGroup *smgroup, QWidget *parentObject=0);
|
||||
virtual ~pqMyPropertyWidgetForGroup();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(pqMyPropertyWidgetForGroup)
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,69 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#include "pqMyPropertyWidgetForProperty.h"
|
||||
|
||||
#include "pqPropertiesPanel.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
pqMyPropertyWidgetForProperty::pqMyPropertyWidgetForProperty(
|
||||
vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject)
|
||||
: Superclass(smproxy, parentObject)
|
||||
{
|
||||
this->setShowLabel(false);
|
||||
|
||||
QGridLayout* gridLayout = new QGridLayout(this);
|
||||
gridLayout->setMargin(pqPropertiesPanel::suggestedMargin());
|
||||
gridLayout->setHorizontalSpacing(pqPropertiesPanel::suggestedHorizontalSpacing());
|
||||
gridLayout->setVerticalSpacing(pqPropertiesPanel::suggestedVerticalSpacing());
|
||||
gridLayout->setColumnStretch(0, 0);
|
||||
gridLayout->setColumnStretch(1, 1);
|
||||
|
||||
QLabel* customLabel = new QLabel("Custom Widget", this);
|
||||
gridLayout->addWidget(customLabel);
|
||||
|
||||
QCheckBox* checkbox = new QCheckBox("<-- pqMyPropertyWidgetForProperty", this);
|
||||
checkbox->setObjectName("Checkbox");
|
||||
this->addPropertyLink(checkbox, "checked", SIGNAL(toggled(bool)), smproperty);
|
||||
gridLayout->addWidget(checkbox);
|
||||
|
||||
// since there's no such thing a "editing" and 'editing done' for checkboxes.
|
||||
this->setChangeAvailableAsChangeFinished(true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
pqMyPropertyWidgetForProperty::~pqMyPropertyWidgetForProperty()
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#ifndef pqMyPropertyWidgetForProperty_h
|
||||
#define pqMyPropertyWidgetForProperty_h
|
||||
|
||||
#include "pqPropertyWidget.h"
|
||||
|
||||
class pqMyPropertyWidgetForProperty : public pqPropertyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
typedef pqPropertyWidget Superclass;
|
||||
public:
|
||||
pqMyPropertyWidgetForProperty(
|
||||
vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject=0);
|
||||
virtual ~pqMyPropertyWidgetForProperty();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(pqMyPropertyWidgetForProperty)
|
||||
};
|
||||
|
||||
#endif
|
||||
30
ParaView-5.0.1/Examples/Plugins/Reader/CMakeLists.txt
Normal file
30
ParaView-5.0.1/Examples/Plugins/Reader/CMakeLists.txt
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
# create a plugin that adds a reader to the ParaView GUI
|
||||
# it is added in the file dialog when doing opens/saves.
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
IF(NOT ParaView_BINARY_DIR)
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
ENDIF()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
IF(PARAVIEW_BUILD_QT_GUI)
|
||||
# The pqReader.xml file contains xml defining readers with their file
|
||||
# extensions and descriptions. The Server Manager XML file defines the
|
||||
# properties of the reader. This example uses the already existing PNG
|
||||
# reader but gives it another identity in the Server Manager. Adding your
|
||||
# own reader to ParaView would mean the SourceProxy class points to your
|
||||
# class.
|
||||
ADD_PARAVIEW_PLUGIN(MyPNGReader "1.0"
|
||||
SERVER_MANAGER_XML readers.xml
|
||||
REQUIRED_ON_SERVER
|
||||
)
|
||||
ENDIF()
|
||||
30
ParaView-5.0.1/Examples/Plugins/Reader/readers.xml
Normal file
30
ParaView-5.0.1/Examples/Plugins/Reader/readers.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<ServerManagerConfiguration>
|
||||
<ProxyGroup name="sources">
|
||||
<SourceProxy name="MyPNGReader"
|
||||
class="vtkPNGReader"
|
||||
label="PNG reader">
|
||||
<Documentation
|
||||
short_help="Read a PNG file."
|
||||
long_help="Read a PNG file into an image data.">
|
||||
The PNG reader reads PNG (Portable Network Graphics) files, and the output is a uniform rectilinear (image/volume) dataset. The default file extension is .png.
|
||||
</Documentation>
|
||||
<StringVectorProperty
|
||||
name="FileName"
|
||||
animateable="0"
|
||||
command="SetFileName"
|
||||
number_of_elements="1"
|
||||
panel_visibility="never">
|
||||
<FileListDomain name="files"/>
|
||||
<Documentation>
|
||||
This property specifies the file name for the PNG reader.
|
||||
</Documentation>
|
||||
</StringVectorProperty>
|
||||
|
||||
<Hints>
|
||||
<ReaderFactory extensions="mypng" file_description="My PNG Files" />
|
||||
</Hints>
|
||||
<!-- End MyPNGReader -->
|
||||
</SourceProxy>
|
||||
</ProxyGroup>
|
||||
</ServerManagerConfiguration>
|
||||
|
||||
20
ParaView-5.0.1/Examples/Plugins/ReaderXMLOnly/CMakeLists.txt
Normal file
20
ParaView-5.0.1/Examples/Plugins/ReaderXMLOnly/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
||||
# This plugin can be loaded directly as the XML or compiled into a binary and
|
||||
# then the binary can be loaded in ParaView.
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
if (NOT ParaView_BINARY_DIR)
|
||||
find_package(ParaView REQUIRED)
|
||||
include(${PARAVIEW_USE_FILE})
|
||||
endif()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
add_paraview_plugin(
|
||||
ReaderXMLOnly "1.0"
|
||||
SERVER_MANAGER_XML ReaderXMLOnly.xml
|
||||
REQUIRED_ON_SERVER)
|
||||
@ -0,0 +1,36 @@
|
||||
<ParaViewPlugin>
|
||||
<!-- one can simply load this XML into ParaView as a plugin and then open data
|
||||
files from File|Open -->
|
||||
<ServerManagerConfiguration>
|
||||
<!-- This specifies the XML configuration for the ServerManager defining the
|
||||
proxies, etc. -->
|
||||
<ProxyGroup name="sources">
|
||||
<SourceProxy name="PNGReaderFromXMLOnlyPlugin"
|
||||
class="vtkPNGReader"
|
||||
label="PNG reader">
|
||||
<Documentation
|
||||
short_help="Read a PNG file."
|
||||
long_help="Read a PNG file into an image data.">
|
||||
The PNG reader reads PNG (Portable Network Graphics) files, and the output is a uniform rectilinear (image/volume) dataset. The default file extension is .png.
|
||||
</Documentation>
|
||||
<StringVectorProperty
|
||||
name="FileName"
|
||||
animateable="0"
|
||||
command="SetFileName"
|
||||
number_of_elements="1"
|
||||
panel_visibility="never">
|
||||
<FileListDomain name="files"/>
|
||||
<Documentation>
|
||||
This property specifies the file name for the PNG reader.
|
||||
</Documentation>
|
||||
</StringVectorProperty>
|
||||
|
||||
<Hints>
|
||||
<ReaderFactory extensions="mypng"
|
||||
file_description="My PNG Files (XMLOnly Plugin)" />
|
||||
</Hints>
|
||||
<!-- End of PNGReaderFromXMLOnlyPlugin -->
|
||||
</SourceProxy>
|
||||
</ProxyGroup>
|
||||
</ServerManagerConfiguration>
|
||||
</ParaViewPlugin>
|
||||
@ -0,0 +1,36 @@
|
||||
# This plugin demonstrates how to add new render views to ParaView that use
|
||||
# different render passes.
|
||||
# It adds two views
|
||||
# 1> Render View with Shadow Maps and
|
||||
# 2> Render View with Edge detection
|
||||
|
||||
IF (ParaView_SOURCE_DIR)
|
||||
INCLUDE_DIRECTORIES(
|
||||
${VTK_INCLUDE_DIR}
|
||||
${PARAVIEW_INCLUDE_DIRS}
|
||||
)
|
||||
ELSE ()
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
ENDIF ()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
if (VTK_RENDERING_BACKEND STREQUAL "OpenGL")
|
||||
|
||||
add_paraview_plugin(
|
||||
RenderPassViews "1.0"
|
||||
REQUIRED_ON_SERVER
|
||||
REQUIRED_ON_CLIENT
|
||||
SERVER_MANAGER_SOURCES
|
||||
vtkPVRenderViewWithSobel.cxx
|
||||
vtkPVRenderViewWithShadowMap.cxx
|
||||
SERVER_MANAGER_XML
|
||||
RenderPassViews.xml
|
||||
)
|
||||
endif()
|
||||
@ -0,0 +1,16 @@
|
||||
<ServerManagerConfiguration>
|
||||
<ProxyGroup name="views">
|
||||
<RenderViewProxy name="RenderViewWithSobel" class="vtkPVRenderViewWithSobel"
|
||||
label="Render View With Edge Detection"
|
||||
processes="client|renderserver|dataserver"
|
||||
base_proxygroup="views" base_proxyname="RenderView">
|
||||
</RenderViewProxy>
|
||||
|
||||
<RenderViewProxy name="RenderViewWithShadowMap"
|
||||
class="vtkPVRenderViewWithShadowMap"
|
||||
label="Render View With Shadow Maps"
|
||||
processes="client|renderserver|dataserver"
|
||||
base_proxygroup="views" base_proxyname="RenderView" >
|
||||
</RenderViewProxy>
|
||||
</ProxyGroup>
|
||||
</ServerManagerConfiguration>
|
||||
@ -0,0 +1,129 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
#include "vtkPVRenderViewWithShadowMap.h"
|
||||
|
||||
#include "vtkCameraPass.h"
|
||||
#include "vtkCompositeZPass.h"
|
||||
#include "vtkDepthPeelingPass.h"
|
||||
#include "vtkLight.h"
|
||||
#include "vtkLightsPass.h"
|
||||
#include "vtkMultiProcessController.h"
|
||||
#include "vtkObjectFactory.h"
|
||||
#include "vtkOpaquePass.h"
|
||||
#include "vtkOverlayPass.h"
|
||||
#include "vtkPVSynchronizedRenderer.h"
|
||||
#include "vtkRenderPassCollection.h"
|
||||
#include "vtkSequencePass.h"
|
||||
#include "vtkShadowMapBakerPass.h"
|
||||
#include "vtkShadowMapPass.h"
|
||||
#include "vtkTranslucentPass.h"
|
||||
#include "vtkVolumetricPass.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
vtkRenderPass* CreateShadowMapPipeline()
|
||||
{
|
||||
vtkOpaquePass *opaque=vtkOpaquePass::New();
|
||||
vtkDepthPeelingPass *peeling=vtkDepthPeelingPass::New();
|
||||
peeling->SetMaximumNumberOfPeels(200);
|
||||
peeling->SetOcclusionRatio(0.1);
|
||||
vtkTranslucentPass *translucent=vtkTranslucentPass::New();
|
||||
peeling->SetTranslucentPass(translucent);
|
||||
vtkVolumetricPass *volume=vtkVolumetricPass::New();
|
||||
vtkOverlayPass *overlay=vtkOverlayPass::New();
|
||||
vtkLightsPass *lights=vtkLightsPass::New();
|
||||
|
||||
vtkSequencePass *opaqueSequence=vtkSequencePass::New();
|
||||
|
||||
vtkRenderPassCollection *passes2=vtkRenderPassCollection::New();
|
||||
passes2->AddItem(lights);
|
||||
passes2->AddItem(opaque);
|
||||
opaqueSequence->SetPasses(passes2);
|
||||
passes2->Delete();
|
||||
|
||||
vtkCameraPass *opaqueCameraPass=vtkCameraPass::New();
|
||||
opaqueCameraPass->SetDelegatePass(opaqueSequence);
|
||||
|
||||
vtkShadowMapBakerPass *shadowsBaker=vtkShadowMapBakerPass::New();
|
||||
shadowsBaker->SetOpaquePass(opaqueCameraPass);
|
||||
opaqueCameraPass->Delete();
|
||||
shadowsBaker->SetResolution(256);
|
||||
// To cancel self-shadowing.
|
||||
shadowsBaker->SetPolygonOffsetFactor(3.1f);
|
||||
shadowsBaker->SetPolygonOffsetUnits(10.0f);
|
||||
|
||||
vtkShadowMapPass *shadows=vtkShadowMapPass::New();
|
||||
shadows->SetShadowMapBakerPass(shadowsBaker);
|
||||
shadows->SetOpaquePass(opaqueSequence);
|
||||
|
||||
if (vtkMultiProcessController::GetGlobalController())
|
||||
{
|
||||
vtkCompositeZPass *compositeZPass=vtkCompositeZPass::New();
|
||||
compositeZPass->SetController(vtkMultiProcessController::GetGlobalController());
|
||||
shadowsBaker->SetCompositeZPass(compositeZPass);
|
||||
compositeZPass->Delete();
|
||||
}
|
||||
|
||||
vtkSequencePass *seq=vtkSequencePass::New();
|
||||
vtkRenderPassCollection *passes=vtkRenderPassCollection::New();
|
||||
passes->AddItem(shadowsBaker);
|
||||
passes->AddItem(shadows);
|
||||
passes->AddItem(lights);
|
||||
passes->AddItem(peeling);
|
||||
passes->AddItem(volume);
|
||||
passes->AddItem(overlay);
|
||||
seq->SetPasses(passes);
|
||||
|
||||
opaque->Delete();
|
||||
peeling->Delete();
|
||||
translucent->Delete();
|
||||
volume->Delete();
|
||||
overlay->Delete();
|
||||
passes->Delete();
|
||||
lights->Delete();
|
||||
shadows->Delete();
|
||||
shadowsBaker->Delete();
|
||||
opaqueSequence->Delete();
|
||||
return seq;
|
||||
}
|
||||
}
|
||||
|
||||
vtkStandardNewMacro(vtkPVRenderViewWithShadowMap);
|
||||
//----------------------------------------------------------------------------
|
||||
vtkPVRenderViewWithShadowMap::vtkPVRenderViewWithShadowMap()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkPVRenderViewWithShadowMap::~vtkPVRenderViewWithShadowMap()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkPVRenderViewWithShadowMap::Initialize(unsigned int id)
|
||||
{
|
||||
this->Superclass::Initialize(id);
|
||||
|
||||
vtkRenderPass* shadowMapPass = CreateShadowMapPipeline();
|
||||
this->SynchronizedRenderers->SetRenderPass(shadowMapPass);
|
||||
shadowMapPass->Delete();
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkPVRenderViewWithShadowMap::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os, indent);
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
// .NAME vtkPVRenderViewWithShadowMap
|
||||
// .SECTION Description
|
||||
// vtkPVRenderViewWithShadowMap is a vtkPVRenderView specialization that uses
|
||||
// shadow-map render passes for rendering shadows.
|
||||
|
||||
#ifndef vtkPVRenderViewWithShadowMap_h
|
||||
#define vtkPVRenderViewWithShadowMap_h
|
||||
|
||||
#include "vtkPVRenderView.h"
|
||||
|
||||
class VTK_EXPORT vtkPVRenderViewWithShadowMap : public vtkPVRenderView
|
||||
{
|
||||
public:
|
||||
static vtkPVRenderViewWithShadowMap* New();
|
||||
vtkTypeMacro(vtkPVRenderViewWithShadowMap, vtkPVRenderView);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
// Description:
|
||||
// Initialize the view with an identifier. Unless noted otherwise, this method
|
||||
// must be called before calling any other methods on this class.
|
||||
// @CallOnAllProcessess
|
||||
virtual void Initialize(unsigned int id);
|
||||
|
||||
//BTX
|
||||
protected:
|
||||
vtkPVRenderViewWithShadowMap();
|
||||
~vtkPVRenderViewWithShadowMap();
|
||||
|
||||
private:
|
||||
vtkPVRenderViewWithShadowMap(const vtkPVRenderViewWithShadowMap&); // Not implemented
|
||||
void operator=(const vtkPVRenderViewWithShadowMap&); // Not implemented
|
||||
//ETX
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,46 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
#include "vtkPVRenderViewWithSobel.h"
|
||||
|
||||
#include "vtkObjectFactory.h"
|
||||
#include "vtkSobelGradientMagnitudePass.h"
|
||||
#include "vtkPVSynchronizedRenderer.h"
|
||||
|
||||
vtkStandardNewMacro(vtkPVRenderViewWithSobel);
|
||||
//----------------------------------------------------------------------------
|
||||
vtkPVRenderViewWithSobel::vtkPVRenderViewWithSobel()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkPVRenderViewWithSobel::~vtkPVRenderViewWithSobel()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkPVRenderViewWithSobel::Initialize(unsigned int id)
|
||||
{
|
||||
this->Superclass::Initialize(id);
|
||||
|
||||
vtkSobelGradientMagnitudePass* sobel =vtkSobelGradientMagnitudePass::New();
|
||||
this->SynchronizedRenderers->SetImageProcessingPass(sobel);
|
||||
sobel->Delete();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkPVRenderViewWithSobel::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os, indent);
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
// .NAME vtkPVRenderViewWithSobel
|
||||
// .SECTION Description
|
||||
// vtkPVRenderViewWithSobel demonstrates how to create custom render-view
|
||||
// subclasses that use a image-processing render pass for processing the image
|
||||
// before rendering it on the screen.
|
||||
|
||||
#ifndef vtkPVRenderViewWithSobel_h
|
||||
#define vtkPVRenderViewWithSobel_h
|
||||
|
||||
#include "vtkPVRenderView.h"
|
||||
|
||||
class VTK_EXPORT vtkPVRenderViewWithSobel : public vtkPVRenderView
|
||||
{
|
||||
public:
|
||||
static vtkPVRenderViewWithSobel* New();
|
||||
vtkTypeMacro(vtkPVRenderViewWithSobel, vtkPVRenderView);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
// Description:
|
||||
// Initialize the view with an identifier. Unless noted otherwise, this method
|
||||
// must be called before calling any other methods on this class.
|
||||
// @CallOnAllProcessess
|
||||
virtual void Initialize(unsigned int id);
|
||||
|
||||
//BTX
|
||||
protected:
|
||||
vtkPVRenderViewWithSobel();
|
||||
~vtkPVRenderViewWithSobel();
|
||||
|
||||
private:
|
||||
vtkPVRenderViewWithSobel(const vtkPVRenderViewWithSobel&); // Not implemented
|
||||
void operator=(const vtkPVRenderViewWithSobel&); // Not implemented
|
||||
//ETX
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,19 @@
|
||||
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
|
||||
|
||||
IF (NOT ParaView_BINARY_DIR)
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
ENDIF ()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
ADD_PARAVIEW_PLUGIN(Representation "1.0"
|
||||
SERVER_MANAGER_XML Representation.xml
|
||||
SERVER_MANAGER_SOURCES
|
||||
vtkMySpecialPolyDataMapper.cxx
|
||||
vtkMySpecialRepresentation.cxx)
|
||||
@ -0,0 +1,40 @@
|
||||
<ServerManagerConfiguration>
|
||||
<ProxyGroup name="representations">
|
||||
<RepresentationProxy name="MySpecialRepresentation"
|
||||
class="vtkMySpecialRepresentation"
|
||||
processes="client|renderserver|dataserver"
|
||||
base_proxygroup="representations"
|
||||
base_proxyname="SurfaceRepresentation">
|
||||
<Documentation>
|
||||
This is the new representation type we are adding. This is identical to
|
||||
the SurfaceRepresentation except that we are overriding the mapper with
|
||||
our mapper.
|
||||
</Documentation>
|
||||
|
||||
<!-- End of MySpecialRepresentation -->
|
||||
</RepresentationProxy>
|
||||
|
||||
<Extension name="GeometryRepresentation">
|
||||
<Documentation>
|
||||
Extends standard GeometryRepresentation by adding
|
||||
MySpecialRepresentation as a new type of representation.
|
||||
</Documentation>
|
||||
|
||||
<!-- this adds to what is already defined in PVRepresentationBase -->
|
||||
<RepresentationType subproxy="MySpecialRepresentation"
|
||||
text="Special Mapper" subtype="Surface" />
|
||||
|
||||
<SubProxy>
|
||||
<Proxy name="MySpecialRepresentation"
|
||||
proxygroup="representations" proxyname="MySpecialRepresentation">
|
||||
</Proxy>
|
||||
<ShareProperties subproxy="SurfaceRepresentation">
|
||||
<Exception name="Input" />
|
||||
<Exception name="Visibility" />
|
||||
<Exception name="Representation" />
|
||||
</ShareProperties>
|
||||
</SubProxy>
|
||||
</Extension>
|
||||
</ProxyGroup>
|
||||
|
||||
</ServerManagerConfiguration>
|
||||
@ -0,0 +1,36 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: vtkMySpecialPolyDataMapper.cxx
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
#include "vtkMySpecialPolyDataMapper.h"
|
||||
|
||||
#include "vtkObjectFactory.h"
|
||||
|
||||
vtkStandardNewMacro(vtkMySpecialPolyDataMapper);
|
||||
//----------------------------------------------------------------------------
|
||||
vtkMySpecialPolyDataMapper::vtkMySpecialPolyDataMapper()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkMySpecialPolyDataMapper::~vtkMySpecialPolyDataMapper()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkMySpecialPolyDataMapper::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os, indent);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: vtkMySpecialPolyDataMapper.h
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
// .NAME vtkMySpecialPolyDataMapper - dummy special polydata mapper.
|
||||
// .SECTION Description
|
||||
// This is a place holder for a poly data mapper. This example simply uses the
|
||||
// standard polydata mapper
|
||||
// Note that it's essential that the mapper can handle composite datasets. If
|
||||
// your mapper cannot, then simply use an append filter internally to
|
||||
// merge the blocks into a single polydata.
|
||||
|
||||
#ifndef vtkMySpecialPolyDataMapper_h
|
||||
#define vtkMySpecialPolyDataMapper_h
|
||||
|
||||
#include "vtkCompositePolyDataMapper2.h"
|
||||
|
||||
class VTK_EXPORT vtkMySpecialPolyDataMapper : public vtkCompositePolyDataMapper2
|
||||
{
|
||||
public:
|
||||
static vtkMySpecialPolyDataMapper* New();
|
||||
vtkTypeMacro(vtkMySpecialPolyDataMapper, vtkCompositePolyDataMapper2);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
//BTX
|
||||
protected:
|
||||
vtkMySpecialPolyDataMapper();
|
||||
~vtkMySpecialPolyDataMapper();
|
||||
|
||||
private:
|
||||
vtkMySpecialPolyDataMapper(const vtkMySpecialPolyDataMapper&); // Not implemented
|
||||
void operator=(const vtkMySpecialPolyDataMapper&); // Not implemented
|
||||
//ETX
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
#include "vtkMySpecialRepresentation.h"
|
||||
|
||||
#include "vtkObjectFactory.h"
|
||||
#include "vtkMySpecialPolyDataMapper.h"
|
||||
|
||||
vtkStandardNewMacro(vtkMySpecialRepresentation);
|
||||
//----------------------------------------------------------------------------
|
||||
vtkMySpecialRepresentation::vtkMySpecialRepresentation()
|
||||
{
|
||||
// Replace the mappers created by the superclass.
|
||||
this->Mapper->Delete();
|
||||
this->LODMapper->Delete();
|
||||
|
||||
this->Mapper = vtkMySpecialPolyDataMapper::New();
|
||||
this->LODMapper = vtkMySpecialPolyDataMapper::New();
|
||||
|
||||
// Since we replaced the mappers, we need to call SetupDefaults() to ensure
|
||||
// the pipelines are setup correctly.
|
||||
this->SetupDefaults();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
vtkMySpecialRepresentation::~vtkMySpecialRepresentation()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void vtkMySpecialRepresentation::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os, indent);
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: $RCSfile$
|
||||
|
||||
Copyright (c) Kitware, Inc.
|
||||
All rights reserved.
|
||||
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notice for more information.
|
||||
|
||||
=========================================================================*/
|
||||
// .NAME vtkMySpecialRepresentation
|
||||
// .SECTION Description
|
||||
//
|
||||
|
||||
#ifndef vtkMySpecialRepresentation_h
|
||||
#define vtkMySpecialRepresentation_h
|
||||
|
||||
#include "vtkGeometryRepresentationWithFaces.h"
|
||||
|
||||
class VTK_EXPORT vtkMySpecialRepresentation : public vtkGeometryRepresentationWithFaces
|
||||
{
|
||||
public:
|
||||
static vtkMySpecialRepresentation* New();
|
||||
vtkTypeMacro(vtkMySpecialRepresentation, vtkGeometryRepresentationWithFaces);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
//BTX
|
||||
protected:
|
||||
vtkMySpecialRepresentation();
|
||||
~vtkMySpecialRepresentation();
|
||||
|
||||
private:
|
||||
vtkMySpecialRepresentation(const vtkMySpecialRepresentation&); // Not implemented
|
||||
void operator=(const vtkMySpecialRepresentation&); // Not implemented
|
||||
//ETX
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,48 @@
|
||||
# TODO: update this plugin to use the pipeline controller instead.
|
||||
# Create an auto-start plugin that will add custom representation behavior.
|
||||
# Typicialy when a representation will be created, the behavior will
|
||||
# try to set it representation to Surface and pick on of the scalar data array
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
|
||||
IF(NOT ParaView_BINARY_DIR)
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
ENDIF()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
IF (PARAVIEW_QT_VERSION VERSION_GREATER "4")
|
||||
QT5_WRAP_CPP(MOC_SRCS
|
||||
pqRepresentationBehaviorStarter.h
|
||||
pqSurfaceRepresentationBehavior.h)
|
||||
ELSE ()
|
||||
QT4_WRAP_CPP(MOC_SRCS
|
||||
pqRepresentationBehaviorStarter.h
|
||||
pqSurfaceRepresentationBehavior.h)
|
||||
ENDIF ()
|
||||
|
||||
ADD_PARAVIEW_AUTO_START(
|
||||
IFACES
|
||||
IFACE_SRCS
|
||||
CLASS_NAME
|
||||
pqRepresentationBehaviorStarter
|
||||
STARTUP
|
||||
onStartup
|
||||
SHUTDOWN
|
||||
onShutdown)
|
||||
|
||||
# create a plugin for this starter
|
||||
ADD_PARAVIEW_PLUGIN(AutoSurfaceRepresentation "1.0"
|
||||
GUI_INTERFACES
|
||||
${IFACES}
|
||||
SOURCES
|
||||
pqRepresentationBehaviorStarter.cxx
|
||||
pqSurfaceRepresentationBehavior.cxx
|
||||
${MOC_SRCS} ${RCS_SRCS} ${IFACE_SRCS}
|
||||
)
|
||||
@ -0,0 +1,63 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: pqRepresentationBehaviorStarter.cxx
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#include "pqRepresentationBehaviorStarter.h"
|
||||
|
||||
// Server Manager Includes.
|
||||
|
||||
// Qt Includes.
|
||||
#include <QtDebug>
|
||||
// ParaView Includes.
|
||||
#include "pqSurfaceRepresentationBehavior.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
pqRepresentationBehaviorStarter::pqRepresentationBehaviorStarter(QObject* p/*=0*/)
|
||||
: QObject(p)
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
pqRepresentationBehaviorStarter::~pqRepresentationBehaviorStarter()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void pqRepresentationBehaviorStarter::onStartup()
|
||||
{
|
||||
// Create the RepresentationBehavior
|
||||
new pqSurfaceRepresentationBehavior(this);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void pqRepresentationBehaviorStarter::onShutdown()
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: pqRepresentationBehaviorStarter.h
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#ifndef pqRepresentationBehaviorStarter_h
|
||||
#define pqRepresentationBehaviorStarter_h
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class pqRepresentationBehaviorStarter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
typedef QObject Superclass;
|
||||
public:
|
||||
pqRepresentationBehaviorStarter(QObject* p=0);
|
||||
~pqRepresentationBehaviorStarter();
|
||||
|
||||
// Callback for shutdown.
|
||||
void onShutdown();
|
||||
|
||||
// Callback for startup.
|
||||
void onStartup();
|
||||
private:
|
||||
pqRepresentationBehaviorStarter(const pqRepresentationBehaviorStarter&); // Not implemented.
|
||||
void operator=(const pqRepresentationBehaviorStarter&); // Not implemented.
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,161 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: pqSurfaceRepresentationBehavior.cxx
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#include "pqSurfaceRepresentationBehavior.h"
|
||||
|
||||
#include "pqApplicationCore.h"
|
||||
#include "pqObjectBuilder.h"
|
||||
#include "pqPipelineRepresentation.h"
|
||||
#include "pqRepresentation.h"
|
||||
#include "pqSMAdaptor.h"
|
||||
#include "pqScalarsToColors.h"
|
||||
#include "pqServerManagerModel.h"
|
||||
#include "pqView.h"
|
||||
#include "vtkPVArrayInformation.h"
|
||||
#include "vtkPVDataInformation.h"
|
||||
#include "vtkPVDataSetAttributesInformation.h"
|
||||
#include "vtkSMProperty.h"
|
||||
#include "vtkSMPropertyHelper.h"
|
||||
#include "vtkSMProxy.h"
|
||||
#include "vtkSMRepresentationProxy.h"
|
||||
#include "vtkSMSourceProxy.h"
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
pqSurfaceRepresentationBehavior::pqSurfaceRepresentationBehavior(QObject* parentObject)
|
||||
: Superclass(parentObject)
|
||||
{
|
||||
QObject::connect(pqApplicationCore::instance()->getServerManagerModel(),
|
||||
SIGNAL(viewAdded(pqView*)),
|
||||
this, SLOT(onViewAdded(pqView*)));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void pqSurfaceRepresentationBehavior::onRepresentationAdded(pqRepresentation* rep)
|
||||
{
|
||||
pqPipelineRepresentation* pipelineRep = qobject_cast<pqPipelineRepresentation*>(rep);
|
||||
vtkSMRepresentationProxy* smRep =
|
||||
vtkSMRepresentationProxy::SafeDownCast(rep->getProxy());
|
||||
if(pipelineRep && smRep)
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Let's pick a reptesentation type that we like instead of the default one
|
||||
// We will use our own set of priority order.
|
||||
// ------------------------------------------------------------------------
|
||||
QList<QVariant> list =
|
||||
pqSMAdaptor::getEnumerationPropertyDomain(
|
||||
pipelineRep->getProxy()->GetProperty("Representation"));
|
||||
|
||||
// Set a representation type based on a priority
|
||||
int priority = 0;
|
||||
std::string finalValue;
|
||||
foreach(QVariant v, list)
|
||||
{
|
||||
if(v.toString() == "Surface" && priority < 1)
|
||||
{
|
||||
finalValue = "Surface";
|
||||
priority = 1;
|
||||
}
|
||||
|
||||
if(v.toString() == "Slices" && priority < 2)
|
||||
{
|
||||
finalValue = "Slices";
|
||||
priority = 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Apply the new representation type is any available
|
||||
if(!finalValue.empty())
|
||||
{
|
||||
pipelineRep->setRepresentation(finalValue.c_str());
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Let's select some data array by default
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
vtkSMProxy* input = vtkSMPropertyHelper(smRep, "Input").GetAsProxy();
|
||||
vtkSMSourceProxy *sourceProxy = vtkSMSourceProxy::SafeDownCast(input);
|
||||
if(sourceProxy)
|
||||
{
|
||||
vtkPVDataInformation *dataInfo = sourceProxy->GetDataInformation();
|
||||
|
||||
if(dataInfo->GetPointDataInformation()->GetNumberOfArrays() > 0)
|
||||
{
|
||||
const char* scalarName =
|
||||
dataInfo->GetPointDataInformation()->GetArrayInformation(0)->GetName();
|
||||
pipelineRep->colorByArray(scalarName, 0); // 0: POINT_DATA / 1:CELL_DATA
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Let's change the data range for the lookup table to remove 1/8 of
|
||||
// the data range from the min and the max of the scalar range
|
||||
// --------------------------------------------------------------------
|
||||
QPair<double, double> range = pipelineRep->getLookupTable()->getScalarRange();
|
||||
double min = range.first + (range.second - range.first)/8;
|
||||
double max = range.second - (range.second - range.first)/8;
|
||||
|
||||
// Apply changes
|
||||
pipelineRep->getLookupTable()->setScalarRangeLock(true);
|
||||
pipelineRep->getLookupTable()->setScalarRange(min, max);
|
||||
}
|
||||
else if (dataInfo->GetCellDataInformation()->GetNumberOfArrays() > 0)
|
||||
{
|
||||
const char* scalarName =
|
||||
dataInfo->GetCellDataInformation()->GetArrayInformation(0)->GetName();
|
||||
pipelineRep->colorByArray(scalarName, 1); // 0: POINT_DATA / 1:CELL_DATA
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Let's change the data range for the lookup table to remove 1/8 of
|
||||
// the data range from the min and the max of the scalar range
|
||||
// --------------------------------------------------------------------
|
||||
QPair<double, double> range = pipelineRep->getLookupTable()->getScalarRange();
|
||||
double min = range.first + (range.second - range.first)/8;
|
||||
double max = range.second - (range.second - range.first)/8;
|
||||
|
||||
// Apply changes
|
||||
pipelineRep->getLookupTable()->setScalarRangeLock(true);
|
||||
pipelineRep->getLookupTable()->setScalarRange(min, max);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void pqSurfaceRepresentationBehavior::onViewAdded(pqView* view)
|
||||
{
|
||||
QObject::connect(view, SIGNAL(representationAdded(pqRepresentation*)),
|
||||
this, SLOT(onRepresentationAdded(pqRepresentation*)),
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: pqSurfaceRepresentationBehavior.h
|
||||
|
||||
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
========================================================================*/
|
||||
#ifndef pqSurfaceRepresentationBehavior_h
|
||||
#define pqSurfaceRepresentationBehavior_h
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class pqRepresentation;
|
||||
class pqView;
|
||||
|
||||
/// @ingroup Behaviors
|
||||
/// pqSurfaceRepresentationBehavior ensures that any created representation
|
||||
/// switch to Surface rendering if available and chose a given data array.
|
||||
class pqSurfaceRepresentationBehavior : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
typedef QObject Superclass;
|
||||
public:
|
||||
pqSurfaceRepresentationBehavior(QObject* parent=0);
|
||||
|
||||
protected slots:
|
||||
void onRepresentationAdded(pqRepresentation*);
|
||||
void onViewAdded(pqView*);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(pqSurfaceRepresentationBehavior);
|
||||
};
|
||||
|
||||
#endif
|
||||
33
ParaView-5.0.1/Examples/Plugins/SMProxy/CMakeLists.txt
Normal file
33
ParaView-5.0.1/Examples/Plugins/SMProxy/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
# create a paraview plugin containing custom classes that work on the client
|
||||
# side in the server manager
|
||||
|
||||
# in this example, a custom bounds domain is created so that
|
||||
# the low and high point of the elevation filter can be initialized
|
||||
# in the z-direction
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
IF(NOT ParaView_BINARY_DIR)
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
ENDIF()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
SET(SM_SOURCES vtkSMMyElevationProxy.cxx vtkSMMyBoundsDomain.cxx)
|
||||
|
||||
# we need server manager wrappings for SM_SOURCES
|
||||
# put instantiators in GUI_SOURCES because they are client side
|
||||
# and we need the plugin to be loaded on the client side
|
||||
ADD_PARAVIEW_PLUGIN(SMMyProxy "1.0"
|
||||
SERVER_MANAGER_XML MyProxy.xml
|
||||
SERVER_MANAGER_SOURCES ${SM_SOURCES})
|
||||
|
||||
84
ParaView-5.0.1/Examples/Plugins/SMProxy/MyProxy.xml
Normal file
84
ParaView-5.0.1/Examples/Plugins/SMProxy/MyProxy.xml
Normal file
@ -0,0 +1,84 @@
|
||||
|
||||
<ServerManagerConfiguration>
|
||||
<ProxyGroup name="filters">
|
||||
|
||||
<MyElevationProxy name="OrientedElevationFilter" class="vtkElevationFilter" label="Oriented Elevation">
|
||||
<Documentation
|
||||
long_help="Creates point array representing elevation defaulting in the z-direction"
|
||||
short_help="Creates point array representing elevation defaulting in the z-direction">
|
||||
The Elevation filter generates point scalar values for an input dataset along a specified direction vector.
|
||||
|
||||
The Input menu allows the user to select the data set to which this filter will be applied. Use the Scalar range entry boxes to specify the minimum and maximum scalar value to be generated. The Low Point and High Point define a line onto which each point of the data set is projected. The minimum scalar value is associated with the Low Point, and the maximum scalar value is associated with the High Point. The scalar value for each point in the data set is determined by the location along the line to which that point projects.
|
||||
</Documentation>
|
||||
<InputProperty
|
||||
name="Input"
|
||||
command="SetInputConnection">
|
||||
<ProxyGroupDomain name="groups">
|
||||
<Group name="sources"/>
|
||||
<Group name="filters"/>
|
||||
</ProxyGroupDomain>
|
||||
<DataTypeDomain name="input_type">
|
||||
<DataType value="vtkDataSet"/>
|
||||
</DataTypeDomain>
|
||||
<Documentation>
|
||||
This property specifies the input dataset to the Elevation filter.
|
||||
</Documentation>
|
||||
</InputProperty>
|
||||
|
||||
<DoubleVectorProperty
|
||||
name="ScalarRange"
|
||||
command="SetScalarRange"
|
||||
number_of_elements="2"
|
||||
default_values="0 1" >
|
||||
<DoubleRangeDomain name="range"/>
|
||||
<Documentation>
|
||||
This property determines the range into which scalars will be mapped.
|
||||
</Documentation>
|
||||
</DoubleVectorProperty>
|
||||
|
||||
<DoubleVectorProperty
|
||||
name="LowPoint"
|
||||
label="Low Point"
|
||||
command="SetLowPoint"
|
||||
number_of_elements="3"
|
||||
animateable="1"
|
||||
default_values="0 0 0" >
|
||||
<MyBoundsDomain name="range" default_mode="min" >
|
||||
<RequiredProperties>
|
||||
<Property name="Input" function="Input" />
|
||||
</RequiredProperties>
|
||||
</MyBoundsDomain>
|
||||
<Documentation>
|
||||
This property defines one end of the direction vector (small scalar values).
|
||||
</Documentation>
|
||||
</DoubleVectorProperty>
|
||||
|
||||
<DoubleVectorProperty
|
||||
name="HighPoint"
|
||||
label="High Point"
|
||||
command="SetHighPoint"
|
||||
number_of_elements="3"
|
||||
animateable="1"
|
||||
default_values="0 0 1" >
|
||||
<MyBoundsDomain name="range" default_mode="max" >
|
||||
<RequiredProperties>
|
||||
<Property name="Input" function="Input" />
|
||||
</RequiredProperties>
|
||||
</MyBoundsDomain>
|
||||
<Documentation>
|
||||
This property defines the other end of the direction vector (large scalar values).
|
||||
</Documentation>
|
||||
</DoubleVectorProperty>
|
||||
|
||||
<Hints>
|
||||
<PropertyGroup type="Line" label="Elevation Widget">
|
||||
<Property function="Point1WorldPosition" name="LowPoint" />
|
||||
<Property function="Point2WorldPosition" name="HighPoint" />
|
||||
</PropertyGroup>
|
||||
</Hints>
|
||||
<!-- End OrientedElevationFilter -->
|
||||
</MyElevationProxy>
|
||||
|
||||
</ProxyGroup>
|
||||
|
||||
</ServerManagerConfiguration>
|
||||
@ -0,0 +1,44 @@
|
||||
|
||||
#include "vtkSMMyBoundsDomain.h"
|
||||
|
||||
#include "vtkObjectFactory.h"
|
||||
#include "vtkPVDataInformation.h"
|
||||
|
||||
vtkStandardNewMacro(vtkSMMyBoundsDomain)
|
||||
|
||||
vtkSMMyBoundsDomain::vtkSMMyBoundsDomain()
|
||||
{
|
||||
}
|
||||
|
||||
vtkSMMyBoundsDomain::~vtkSMMyBoundsDomain()
|
||||
{
|
||||
}
|
||||
|
||||
void vtkSMMyBoundsDomain::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os, indent);
|
||||
}
|
||||
|
||||
void vtkSMMyBoundsDomain::Update(vtkSMProperty*)
|
||||
{
|
||||
vtkPVDataInformation* inputInformation = this->GetInputInformation();
|
||||
if (!inputInformation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double bounds[6];
|
||||
inputInformation->GetBounds(bounds);
|
||||
|
||||
// average the x, y
|
||||
double avgx = ( bounds[1] + bounds[0] ) / 2.0;
|
||||
double avgy = ( bounds[3] + bounds[2] ) / 2.0;
|
||||
|
||||
std::vector<vtkEntry> entries;
|
||||
entries.push_back(vtkEntry(avgx, avgx));
|
||||
entries.push_back(vtkEntry(avgy, avgy));
|
||||
entries.push_back(vtkEntry(bounds[4], bounds[5]));
|
||||
|
||||
this->SetEntries(entries);
|
||||
}
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
|
||||
#ifndef vtkSMMyBoundsDomain_h
|
||||
#define vtkSMMyBoundsDomain_h
|
||||
|
||||
#include "vtkSMBoundsDomain.h"
|
||||
|
||||
/// useless but just showing we can do it
|
||||
class vtkSMMyBoundsDomain : public vtkSMBoundsDomain
|
||||
{
|
||||
public:
|
||||
static vtkSMMyBoundsDomain* New();
|
||||
vtkTypeMacro(vtkSMMyBoundsDomain, vtkSMBoundsDomain);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
// overload setting of default values so we can orient them
|
||||
// our way
|
||||
void Update(vtkSMProperty* prop);
|
||||
|
||||
protected:
|
||||
vtkSMMyBoundsDomain();
|
||||
~vtkSMMyBoundsDomain();
|
||||
|
||||
};
|
||||
|
||||
#endif // vtkSMMyBoundsDomain_h
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
|
||||
#include "vtkSMMyElevationProxy.h"
|
||||
#include "vtkObjectFactory.h"
|
||||
|
||||
vtkStandardNewMacro(vtkSMMyElevationProxy);
|
||||
|
||||
vtkSMMyElevationProxy::vtkSMMyElevationProxy()
|
||||
{
|
||||
}
|
||||
|
||||
vtkSMMyElevationProxy::~vtkSMMyElevationProxy()
|
||||
{
|
||||
}
|
||||
|
||||
void vtkSMMyElevationProxy::PrintSelf(ostream& os, vtkIndent indent)
|
||||
{
|
||||
this->Superclass::PrintSelf(os, indent);
|
||||
}
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
|
||||
#ifndef vtkSMMyElevationProxy_h
|
||||
#define vtkSMMyElevationProxy_h
|
||||
|
||||
#include "vtkSMSourceProxy.h"
|
||||
|
||||
/// useless but just showing we can do it
|
||||
class vtkSMMyElevationProxy : public vtkSMSourceProxy
|
||||
{
|
||||
public:
|
||||
static vtkSMMyElevationProxy* New();
|
||||
vtkTypeMacro(vtkSMMyElevationProxy, vtkSMSourceProxy);
|
||||
void PrintSelf(ostream& os, vtkIndent indent);
|
||||
|
||||
protected:
|
||||
vtkSMMyElevationProxy();
|
||||
~vtkSMMyElevationProxy();
|
||||
|
||||
};
|
||||
|
||||
#endif // vtkSMMyElevationProxy_h
|
||||
|
||||
36
ParaView-5.0.1/Examples/Plugins/SourceToolbar/CMakeLists.txt
Normal file
36
ParaView-5.0.1/Examples/Plugins/SourceToolbar/CMakeLists.txt
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
IF(NOT ParaView_BINARY_DIR)
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
ENDIF()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
IF(PARAVIEW_BUILD_QT_GUI)
|
||||
# We need to wrap for Qt stuff such as signals/slots etc. to work correctly.
|
||||
IF (PARAVIEW_QT_VERSION VERSION_GREATER "4")
|
||||
QT5_WRAP_CPP(MOC_SRCS SourceToolbarActions.h)
|
||||
ELSE ()
|
||||
QT4_WRAP_CPP(MOC_SRCS SourceToolbarActions.h)
|
||||
ENDIF ()
|
||||
|
||||
# This is a macro for adding QActionGroup subclasses automatically as toolbars.
|
||||
ADD_PARAVIEW_ACTION_GROUP(IFACES IFACE_SRCS
|
||||
CLASS_NAME SourceToolbarActions
|
||||
GROUP_NAME "ToolBar/SourceToolbar")
|
||||
|
||||
# Now crete a plugin for the toolbar. Here we pass IFACES and IFACE_SRCS
|
||||
# which are filled up by the above macro with relevant entries
|
||||
ADD_PARAVIEW_PLUGIN(SourceToolbar "1.0"
|
||||
GUI_INTERFACES ${IFACES}
|
||||
SOURCES ${MOC_SRCS} ${IFACE_SRCS}
|
||||
SourceToolbarActions.cxx)
|
||||
ENDIF()
|
||||
@ -0,0 +1,83 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: SourceToolbarActions.cxx
|
||||
|
||||
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
=========================================================================*/
|
||||
#include "SourceToolbarActions.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStyle>
|
||||
|
||||
#include "pqApplicationCore.h"
|
||||
#include "pqObjectBuilder.h"
|
||||
#include "pqServer.h"
|
||||
#include "pqServerManagerModel.h"
|
||||
#include "pqUndoStack.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
SourceToolbarActions::SourceToolbarActions(QObject* p) : QActionGroup(p)
|
||||
{
|
||||
// let's use a Qt icon (we could make our own)
|
||||
QIcon icon = qApp->style()->standardIcon(QStyle::SP_MessageBoxCritical);
|
||||
QAction* a = new QAction(icon, "Create Sphere", this);
|
||||
a->setData("SphereSource");
|
||||
this->addAction(a);
|
||||
a = new QAction(icon, "Create Cylinder", this);
|
||||
a->setData("CylinderSource");
|
||||
this->addAction(a);
|
||||
QObject::connect(this, SIGNAL(triggered(QAction*)), this, SLOT(onAction(QAction*)));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SourceToolbarActions::onAction(QAction* a)
|
||||
{
|
||||
pqApplicationCore* core = pqApplicationCore::instance();
|
||||
pqObjectBuilder* builder = core->getObjectBuilder();
|
||||
pqServerManagerModel* sm = core->getServerManagerModel();
|
||||
pqUndoStack* stack = core->getUndoStack();
|
||||
|
||||
/// Check that we are connect to some server (either builtin or remote).
|
||||
if (sm->getNumberOfItems<pqServer*>())
|
||||
{
|
||||
// just create it on the first server connection
|
||||
pqServer* s = sm->getItemAtIndex<pqServer*>(0);
|
||||
QString source_type = a->data().toString();
|
||||
// make this operation undo-able if undo is enabled
|
||||
if(stack)
|
||||
{
|
||||
stack->beginUndoSet(QString("Create %1").arg(source_type));
|
||||
}
|
||||
builder->createSource("sources", source_type.toLatin1().data(), s);
|
||||
if(stack)
|
||||
{
|
||||
stack->endUndoSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: ParaView
|
||||
Module: SourceToolbarActions.h
|
||||
|
||||
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
|
||||
All rights reserved.
|
||||
|
||||
ParaView is a free software; you can redistribute it and/or modify it
|
||||
under the terms of the ParaView license version 1.2.
|
||||
|
||||
See License_v1.2.txt for the full ParaView license.
|
||||
A copy of this license can be obtained by contacting
|
||||
Kitware Inc.
|
||||
28 Corporate Drive
|
||||
Clifton Park, NY 12065
|
||||
USA
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
=========================================================================*/
|
||||
#ifndef SourceToolbarActions_h
|
||||
#define SourceToolbarActions_h
|
||||
|
||||
#include <QActionGroup>
|
||||
/// This example illustrates adding a toolbar to ParaView to create a sphere and
|
||||
/// a cylinder source.
|
||||
class SourceToolbarActions : public QActionGroup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SourceToolbarActions(QObject* p);
|
||||
|
||||
public slots:
|
||||
/// Callback for each action triggerred.
|
||||
void onAction(QAction* a);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
35
ParaView-5.0.1/Examples/Plugins/VisItReader/CMakeLists.txt
Normal file
35
ParaView-5.0.1/Examples/Plugins/VisItReader/CMakeLists.txt
Normal file
@ -0,0 +1,35 @@
|
||||
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
|
||||
|
||||
if (NOT ParaView_BINARY_DIR)
|
||||
find_package(ParaView REQUIRED)
|
||||
include(${PARAVIEW_USE_FILE})
|
||||
endif()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET vtkIOVisItBridge)
|
||||
message(FATAL_ERROR
|
||||
"Please rebuild ParaView with VisIt reader support enabled.")
|
||||
endif()
|
||||
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
|
||||
SET(SOURCES
|
||||
avtFluentFileFormat.h
|
||||
avtFluentFileFormat.C
|
||||
)
|
||||
|
||||
ADD_VISIT_PLUGIN_READER(VisItReaderExample "1.0"
|
||||
VISIT_READER_NAME "avtFluentFileFormat"
|
||||
VISIT_READER_TYPE "STMD"
|
||||
VISIT_READER_FILE_PATTERN "cas"
|
||||
SERVER_SOURCES ${SOURCES}
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(VisItReaderExample vtkVisItAVTAlgorithms)
|
||||
3853
ParaView-5.0.1/Examples/Plugins/VisItReader/avtFluentFileFormat.C
Normal file
3853
ParaView-5.0.1/Examples/Plugins/VisItReader/avtFluentFileFormat.C
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,200 @@
|
||||
// ************************************************************************* //
|
||||
// avtFluentFileFormat.h //
|
||||
// ************************************************************************* //
|
||||
|
||||
#ifndef AVT_Fluent_FILE_FORMAT_H
|
||||
#define AVT_Fluent_FILE_FORMAT_H
|
||||
#include <avtSTMDFileFormat.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
// Fluent plugin
|
||||
#include <visitstream.h>
|
||||
#include <stdlib.h>
|
||||
#include <sstream>
|
||||
|
||||
#include "vtkPoints.h"
|
||||
#include "vtkTriangle.h"
|
||||
#include "vtkTetra.h"
|
||||
#include "vtkQuad.h"
|
||||
#include "vtkHexahedron.h"
|
||||
#include "vtkPyramid.h"
|
||||
#include "vtkWedge.h"
|
||||
#include "vtkConvexPointSet.h"
|
||||
#include "vtkUnstructuredGrid.h"
|
||||
#include "vtkDoubleArray.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// Class: avtFluentFileFormat
|
||||
//
|
||||
// Purpose:
|
||||
// Reads in Fluent files as a plugin to VisIt.
|
||||
//
|
||||
// Programmer: bdotson -- generated by xml2avt
|
||||
// Creation: Fri Jun 30 15:02:33 PST 2006
|
||||
//
|
||||
// Modifications:
|
||||
//
|
||||
// Hank Childs, Fri Sep 8 14:30:04 PDT 2006
|
||||
// Added methods HasInvariantMetaData and HasInvariantSIL on the advice
|
||||
// of Terry Jordan.
|
||||
//
|
||||
// ****************************************************************************
|
||||
|
||||
class avtFluentFileFormat : public avtSTMDFileFormat
|
||||
{
|
||||
public:
|
||||
avtFluentFileFormat(const char *);
|
||||
virtual ~avtFluentFileFormat() {;};
|
||||
|
||||
virtual const char *GetType(void) { return "Fluent"; };
|
||||
virtual void FreeUpResources(void);
|
||||
|
||||
virtual vtkDataSet *GetMesh(int, const char *);
|
||||
virtual vtkDataArray *GetVar(int, const char *);
|
||||
virtual vtkDataArray *GetVectorVar(int, const char *);
|
||||
|
||||
//Number of variables is dynamic
|
||||
virtual bool HasInvariantMetaData(void) const
|
||||
{ return false; };
|
||||
//Number of Domains is dynamic
|
||||
virtual bool HasInvariantSIL(void) const
|
||||
{ return false; };
|
||||
|
||||
protected:
|
||||
|
||||
virtual void PopulateDatabaseMetaData(avtDatabaseMetaData *);
|
||||
int OpenCaseFile(const char *filename);
|
||||
int OpenDataFile(const char *filename);
|
||||
int GetCaseChunk ();
|
||||
void GetNumberOfCellZones();
|
||||
int GetCaseIndex();
|
||||
void LoadVariableNames();
|
||||
int GetDataIndex();
|
||||
int GetDataChunk();
|
||||
|
||||
void ParseCaseFile();
|
||||
int GetDimension();
|
||||
void GetLittleEndianFlag();
|
||||
void GetNodesAscii();
|
||||
void GetNodesSinglePrecision();
|
||||
void GetNodesDoublePrecision();
|
||||
void GetCellsAscii();
|
||||
void GetCellsBinary();
|
||||
void GetFacesAscii();
|
||||
void GetFacesBinary();
|
||||
void GetPeriodicShadowFacesAscii();
|
||||
void GetPeriodicShadowFacesBinary();
|
||||
void GetCellTreeAscii();
|
||||
void GetCellTreeBinary();
|
||||
void GetFaceTreeAscii();
|
||||
void GetFaceTreeBinary();
|
||||
void GetInterfaceFaceParentsAscii();
|
||||
void GetInterfaceFaceParentsBinary();
|
||||
void GetNonconformalGridInterfaceFaceInformationAscii();
|
||||
void GetNonconformalGridInterfaceFaceInformationBinary();
|
||||
void CleanCells();
|
||||
void PopulateCellNodes();
|
||||
int GetCaseBufferInt(int ptr);
|
||||
float GetCaseBufferFloat(int ptr);
|
||||
double GetCaseBufferDouble(int ptr);
|
||||
void PopulateTriangleCell(int i);
|
||||
void PopulateTetraCell(int i);
|
||||
void PopulateQuadCell(int i);
|
||||
void PopulateHexahedronCell(int i);
|
||||
void PopulatePyramidCell(int i);
|
||||
void PopulateWedgeCell(int i);
|
||||
void PopulatePolyhedronCell(int i);
|
||||
void ParseDataFile();
|
||||
int GetDataBufferInt(int ptr);
|
||||
float GetDataBufferFloat(int ptr);
|
||||
double GetDataBufferDouble(int ptr);
|
||||
void GetData(int dataType);
|
||||
|
||||
//
|
||||
// Variables
|
||||
//
|
||||
|
||||
ifstream FluentCaseFile;
|
||||
ifstream FluentDataFile;
|
||||
string CaseBuffer;
|
||||
string DataBuffer;
|
||||
|
||||
vtkPoints *Points;
|
||||
vtkTriangle *Triangle;
|
||||
vtkTetra *Tetra;
|
||||
vtkQuad *Quad;
|
||||
vtkHexahedron *Hexahedron;
|
||||
vtkPyramid *Pyramid;
|
||||
vtkWedge *Wedge;
|
||||
vtkConvexPointSet *ConvexPointSet;
|
||||
|
||||
struct Cell {
|
||||
int type;
|
||||
int zone;
|
||||
vector<int> faces;
|
||||
int parent;
|
||||
int child;
|
||||
vector<int> nodes;
|
||||
};
|
||||
|
||||
struct Face {
|
||||
int type;
|
||||
int zone;
|
||||
vector<int> nodes;
|
||||
int c0;
|
||||
int c1;
|
||||
int periodicShadow;
|
||||
int parent;
|
||||
int child;
|
||||
int interfaceFaceParent;
|
||||
int interfaceFaceChild;
|
||||
int ncgParent;
|
||||
int ncgChild;
|
||||
};
|
||||
|
||||
struct ScalarDataChunk {
|
||||
int subsectionId;
|
||||
int zoneId;
|
||||
vector<double> scalarData;
|
||||
};
|
||||
|
||||
struct VectorDataChunk {
|
||||
int subsectionId;
|
||||
int zoneId;
|
||||
vector<double> iComponentData;
|
||||
vector<double> jComponentData;
|
||||
vector<double> kComponentData;
|
||||
};
|
||||
|
||||
|
||||
vector< Cell > Cells;
|
||||
vector< Face > Faces;
|
||||
map< int, string > VariableNames;
|
||||
vector< int > CellZones;
|
||||
vector< ScalarDataChunk > ScalarDataChunks;
|
||||
vector< VectorDataChunk > VectorDataChunks;
|
||||
|
||||
vector< vector<int> > SubSectionZones;
|
||||
vector< int > SubSectionIds;
|
||||
vector< int > SubSectionSize;
|
||||
|
||||
vector< string > ScalarVariableNames;
|
||||
vector< int > ScalarSubSectionIds;
|
||||
vector< string > VectorVariableNames;
|
||||
vector< int > VectorSubSectionIds;
|
||||
|
||||
int LittleEndianFlag;
|
||||
int GridDimension;
|
||||
int DataPass;
|
||||
int NumberOfScalars;
|
||||
int NumberOfVectors;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
21
ParaView-5.0.1/Examples/Plugins/Writer/CMakeLists.txt
Normal file
21
ParaView-5.0.1/Examples/Plugins/Writer/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
# create a plugin that adds a reader to the ParaView GUI
|
||||
# it is added in the file dialog when doing opens/saves.
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
IF(NOT ParaView_BINARY_DIR)
|
||||
FIND_PACKAGE(ParaView REQUIRED)
|
||||
INCLUDE(${PARAVIEW_USE_FILE})
|
||||
ENDIF()
|
||||
|
||||
# Set a consistent MACOSX_RPATH default across all CMake versions.
|
||||
# When CMake 2.8.12 is required, change this default to 1.
|
||||
# When CMake 3.0.0 is required, remove this block (see CMP0042).
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
endif()
|
||||
|
||||
ADD_PARAVIEW_PLUGIN(MyTiffWriter "1.0"
|
||||
SERVER_MANAGER_XML writers.xml
|
||||
REQUIRED_ON_SERVER)
|
||||
65
ParaView-5.0.1/Examples/Plugins/Writer/writers.xml
Normal file
65
ParaView-5.0.1/Examples/Plugins/Writer/writers.xml
Normal file
@ -0,0 +1,65 @@
|
||||
<ServerManagerConfiguration>
|
||||
|
||||
<ProxyGroup name="writers">
|
||||
|
||||
<WriterProxy name="MyTIFFWriter"
|
||||
class="vtkTIFFWriter"
|
||||
label="My TIFF Writer">
|
||||
<Documentation short_help="Write image data as a TIF file.">
|
||||
Writes image data as a TIFF data file. Data can be written uncompressed or compressed. Several forms of compression are supported including packed bits, JPEG, and deflation. By setting a file pattern, you can write a sequence of slices.
|
||||
</Documentation>
|
||||
|
||||
<InputProperty name="Input" command="SetInputConnection">
|
||||
<ProxyGroupDomain name="groups">
|
||||
<Group name="sources"/>
|
||||
<Group name="filters"/>
|
||||
</ProxyGroupDomain>
|
||||
<DataTypeDomain name="input_type" composite_data_supported="0">
|
||||
<DataType value="vtkImageData"/>
|
||||
</DataTypeDomain>
|
||||
</InputProperty>
|
||||
|
||||
<StringVectorProperty name="FileName"
|
||||
command="SetFilePrefix"
|
||||
number_of_elements="1"
|
||||
label="File Prefix">
|
||||
<Documentation>
|
||||
The prefix of the file name.
|
||||
</Documentation>
|
||||
</StringVectorProperty>
|
||||
|
||||
<StringVectorProperty name="FilePattern"
|
||||
command="SetFilePattern"
|
||||
number_of_elements="1"
|
||||
default_values="%s">
|
||||
<Documentation>
|
||||
The sprintf format used to build filename from FilePrefix and number.
|
||||
</Documentation>
|
||||
</StringVectorProperty>
|
||||
|
||||
<IntVectorProperty name="Compression"
|
||||
command="SetCompression"
|
||||
number_of_elements="1"
|
||||
default_values="1">
|
||||
<Documentation>
|
||||
The type of compression used in the file.
|
||||
</Documentation>
|
||||
<EnumerationDomain name="enum">
|
||||
<Entry value="0" text="No Compression" />
|
||||
<Entry value="1" text="Pack Bits" />
|
||||
<Entry value="2" text="JPEG" />
|
||||
<Entry value="3" text="Deflate" />
|
||||
</EnumerationDomain>
|
||||
</IntVectorProperty>
|
||||
|
||||
<Hints>
|
||||
<Property name="Input" show="0"/>
|
||||
<WriterFactory extensions="tif"
|
||||
file_description="My Tiff Files" />
|
||||
</Hints>
|
||||
|
||||
</WriterProxy>
|
||||
|
||||
</ProxyGroup>
|
||||
|
||||
</ServerManagerConfiguration>
|
||||
Reference in New Issue
Block a user