Commit bed8567e authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

ENH: Adding support for vtkTables as first class data objects in Paraview.

Fixes BUG #7786. This covers a broad array of fixes/enhancments including:
* Histrogram filter produces vtkTable.
* Charts now use vtkTable (instead of vtkRectilinear grid).
* Charts can plot any attribute data.
* CSV Reader reads in vtkTable instead of vtkRectilinear.
* Spreadsheet view cleanup --  the streaming logic is now more streamlined :).
* Selection widget performance -- when a large number of cells/points were
  selected/unselected, the client would take a lot of time updating the
  selection inspector panel. This is now fixed.
* Merging vtkTimeSeriesWriter into vtkParallelSerialWriter and fixing it to work
  with arbitrary data-objects rather than just vtkPolyData.
parent 108b49df
......@@ -108,7 +108,6 @@ QT4_WRAP_CPP(MOC_BUILT_SOURCES
pqExodusIIPanel.h
pqExodusPanel.h
pqExtractCTHPartsPanel.h
pqExtractDataSetsPanel.h
pqExtractSelectionsPanel.h
pqFileChooserWidget.h
pqFilterInputDialog.h
......@@ -248,7 +247,6 @@ SET(UI_FORMS
Resources/UI/pqEmptyView.ui
Resources/UI/pqExodusIIPanel.ui
Resources/UI/pqExodusPanel.ui
Resources/UI/pqExtractDataSetsPanel.ui
Resources/UI/pqExtractSelectionsPanel.ui
Resources/UI/pqGlobalRenderViewOptions.ui
Resources/UI/pqHandleWidget.ui
......@@ -458,8 +456,6 @@ ADD_LIBRARY(pqComponents
pqExodusPanel.h
pqExtractCTHPartsPanel.cxx
pqExtractCTHPartsPanel.h
pqExtractDataSetsPanel.cxx
pqExtractDataSetsPanel.h
pqExtractSelectionsPanel.cxx
pqExtractSelectionsPanel.h
pqFileChooserWidget.cxx
......
......@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>265</width>
<height>300</height>
<width>311</width>
<height>481</height>
</rect>
</property>
<property name="windowTitle" >
......@@ -18,23 +18,8 @@
<property name="title" >
<string>View</string>
</property>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>6</number>
</property>
<property name="topMargin" >
<number>6</number>
</property>
<property name="rightMargin" >
<number>6</number>
</property>
<property name="bottomMargin" >
<number>6</number>
</property>
<item>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="2" >
<widget class="QCheckBox" name="ViewData" >
<property name="toolTip" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:Sans Serif; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Toggle visibility of this dataset's geometry.&lt;/p>&lt;/body>&lt;/html></string>
......@@ -44,62 +29,67 @@
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>X Axis</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="2" >
<widget class="QCheckBox" name="UsePoints" >
<property name="toolTip" >
<string>&lt;html>When checked the chart will use points instead of point data on the X axis.&lt;/html></string>
</property>
<property name="text" >
<string>Use Points</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="labelPointComponent" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Component</string>
<string>Attribute</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="PointComponent" >
<widget class="QComboBox" name="FieldAssociation" >
<item>
<property name="text" >
<string>Points</string>
</property>
</item>
<item>
<property name="text" >
<string>X</string>
<string>Cells</string>
</property>
</item>
<item>
<property name="text" >
<string>Y</string>
<string>Field Data</string>
</property>
</item>
<item>
<property name="text" >
<string>Z</string>
<string>Vertices</string>
</property>
</item>
<item>
<property name="text" >
<string>Edges</string>
</property>
</item>
<item>
<property name="text" >
<string>Rows</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0" >
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>X Axis</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="labelXArrayName" >
<property name="text" >
<string>Array Name</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<item row="0" column="1" >
<widget class="QComboBox" name="XArrayName" />
</item>
<item row="3" column="0" colspan="2" >
<item row="1" column="0" colspan="2" >
<layout class="QHBoxLayout" >
<item>
<spacer>
......@@ -170,6 +160,15 @@
</layout>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="CompositeTree" >
<column>
<property name="text" >
<string>Structure</string>
</property>
</column>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
......@@ -177,8 +176,8 @@
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>0</height>
<width>352</width>
<height>101</height>
</size>
</property>
</spacer>
......@@ -186,70 +185,5 @@
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>UsePoints</sender>
<signal>toggled(bool)</signal>
<receiver>PointComponent</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>101</x>
<y>111</y>
</hint>
<hint type="destinationlabel" >
<x>143</x>
<y>141</y>
</hint>
</hints>
</connection>
<connection>
<sender>UsePoints</sender>
<signal>toggled(bool)</signal>
<receiver>labelPointComponent</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>101</x>
<y>111</y>
</hint>
<hint type="destinationlabel" >
<x>59</x>
<y>141</y>
</hint>
</hints>
</connection>
<connection>
<sender>UsePoints</sender>
<signal>toggled(bool)</signal>
<receiver>labelXArrayName</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>101</x>
<y>111</y>
</hint>
<hint type="destinationlabel" >
<x>59</x>
<y>173</y>
</hint>
</hints>
</connection>
<connection>
<sender>UsePoints</sender>
<signal>toggled(bool)</signal>
<receiver>XArrayName</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>101</x>
<y>111</y>
</hint>
<hint type="destinationlabel" >
<x>143</x>
<y>173</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>
<ui version="4.0" >
<class>ExtractDataSetsPanel</class>
<widget class="QWidget" name="ExtractDataSetsPanel" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>293</width>
<height>289</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="pqTreeWidget" name="DataSetsList" >
<property name="rootIsDecorated" >
<bool>false</bool>
</property>
<column>
<property name="text" >
<string>DataSets</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>pqTreeWidget</class>
<extends>QTreeWidget</extends>
<header>pqTreeWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -72,14 +72,17 @@
</item>
<item row="2" column="2" >
<widget class="QComboBox" name="AttributeMode" >
<property name="sizeAdjustPolicy" >
<enum>QComboBox::AdjustToContents</enum>
</property>
<item>
<property name="text" >
<string>Cell Data</string>
<string>Points</string>
</property>
</item>
<item>
<property name="text" >
<string>Point Data</string>
<string>Cells</string>
</property>
</item>
<item>
......@@ -87,6 +90,21 @@
<string>Field Data</string>
</property>
</item>
<item>
<property name="text" >
<string>Vertices</string>
</property>
</item>
<item>
<property name="text" >
<string>Edges</string>
</property>
</item>
<item>
<property name="text" >
<string>Rows</string>
</property>
</item>
</widget>
</item>
<item row="3" column="2" >
......
......@@ -51,14 +51,17 @@
</item>
<item>
<widget class="QComboBox" name="Attribute" >
<property name="sizeAdjustPolicy" >
<enum>QComboBox::AdjustToContents</enum>
</property>
<item>
<property name="text" >
<string>Cell Data</string>
<string>Points</string>
</property>
</item>
<item>
<property name="text" >
<string>Point Data</string>
<string>Cells</string>
</property>
</item>
<item>
......@@ -66,6 +69,21 @@
<string>Field Data</string>
</property>
</item>
<item>
<property name="text" >
<string>Vertices</string>
</property>
</item>
<item>
<property name="text" >
<string>Edges</string>
</property>
</item>
<item>
<property name="text" >
<string>Rows</string>
</property>
</item>
</widget>
</item>
<item>
......
......@@ -284,7 +284,7 @@
<widget class="QComboBox" name="AttributeMode" >
<item>
<property name="text" >
<string>Point Data</string>
<string>Points</string>
</property>
<property name="icon" >
<iconset resource="../pqComponents.qrc" >:/pqWidgets/Icons/pqPointData16.png</iconset>
......@@ -292,12 +292,33 @@
</item>
<item>
<property name="text" >
<string>Cell Data</string>
<string>Cells</string>
</property>
<property name="icon" >
<iconset resource="../pqComponents.qrc" >:/pqWidgets/Icons/pqCellData16.png</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Vertices</string>
</property>
<property name="icon" >
<iconset resource="../pqComponents.qrc" >:/pqWidgets/Icons/pqPointData16.png</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Edges</string>
</property>
<property name="icon" >
<iconset resource="../pqComponents.qrc" >:/pqWidgets/Icons/pqRamp24.png</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Rows</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0" colspan="2" >
......
......@@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ui_pqBarChartDisplayEditor.h"
#include "vtkEventQtSlotConnect.h"
#include "vtkSMProperty.h"
#include "vtkSMIntVectorProperty.h"
#include "vtkSMProxy.h"
#include <QPointer>
......@@ -43,11 +43,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqBarChartRepresentation.h"
#include "pqColorScaleToolbar.h"
#include "pqComboBoxDomain.h"
#include "pqRepresentation.h"
#include "pqPropertyLinks.h"
#include "pqRepresentation.h"
#include "pqSignalAdaptorCompositeTreeWidget.h"
#include "pqSignalAdaptors.h"
//-----------------------------------------------------------------------------
class pqBarChartDisplayProxyEditor::pqInternal : public Ui::BarCharDisplayEditor
{
......@@ -55,11 +55,13 @@ public:
QPointer<pqRepresentation> Representation;
QPointer<pqComboBoxDomain> XDomain;
QPointer<pqComboBoxDomain> YDomain;
QPointer<pqComboBoxDomain> FieldAssociationDomain;
vtkEventQtSlotConnect* VTKConnect;
pqPropertyLinks Links;
pqSignalAdaptorComboBox* XArrayNameAdaptor;
pqSignalAdaptorComboBox* PointComponentAdaptor;
pqSignalAdaptorComboBox* YArrayNameAdaptor;
pqSignalAdaptorComboBox* FieldAssociationAdaptor;
pqSignalAdaptorCompositeTreeWidget* CompositeTreeAdaptor;
};
//-----------------------------------------------------------------------------
......@@ -72,10 +74,16 @@ pqBarChartDisplayProxyEditor::pqBarChartDisplayProxyEditor(pqRepresentation* rep
this->Internal->XArrayNameAdaptor = new pqSignalAdaptorComboBox(
this->Internal->XArrayName);
this->Internal->PointComponentAdaptor = new pqSignalAdaptorComboBox(
this->Internal->PointComponent);
this->Internal->YArrayNameAdaptor = new pqSignalAdaptorComboBox(
this->Internal->YArrayName);
this->Internal->FieldAssociationAdaptor = new pqSignalAdaptorComboBox(
this->Internal->FieldAssociation);
this->Internal->CompositeTreeAdaptor = new pqSignalAdaptorCompositeTreeWidget(
this->Internal->CompositeTree,
vtkSMIntVectorProperty::SafeDownCast(
repr->getProxy()->GetProperty("CompositeDataSetIndex")),
/*autoUpdateVisibility=*/true,
/*showSelectedElementCounts=*/true);
QObject::connect(
this->Internal->EditColorMapButton, SIGNAL(clicked()),
......@@ -86,8 +94,6 @@ pqBarChartDisplayProxyEditor::pqBarChartDisplayProxyEditor(pqRepresentation* rep
QObject::connect(&this->Internal->Links, SIGNAL(qtWidgetChanged()),
this, SLOT(updateAllViews()));
this->Internal->UsePoints->setCheckState(Qt::Checked);
this->setRepresentation(repr);
}
......@@ -133,8 +139,11 @@ void pqBarChartDisplayProxyEditor::setRepresentation(pqRepresentation* repr)
this->Internal->XArrayName, proxy->GetProperty("XArrayName"));
this->Internal->YDomain = new pqComboBoxDomain(
this->Internal->YArrayName, proxy->GetProperty("YArrayName"));
this->Internal->FieldAssociationDomain = new pqComboBoxDomain(
this->Internal->FieldAssociation, proxy->GetProperty("FieldAssociation"));
this->Internal->XDomain->forceDomainChanged();
this->Internal->YDomain->forceDomainChanged();
this->Internal->FieldAssociationDomain->forceDomainChanged();
// Initialize links.
this->Internal->Links.addPropertyLink(this->Internal->ViewData,
......@@ -146,23 +155,26 @@ void pqBarChartDisplayProxyEditor::setRepresentation(pqRepresentation* repr)
this->Internal->Links.addPropertyLink(this->Internal->YArrayNameAdaptor,
"currentText", SIGNAL(currentTextChanged(const QString&)),
proxy, proxy->GetProperty("YArrayName"));
this->Internal->Links.addPropertyLink(this->Internal->PointComponentAdaptor,
this->Internal->Links.addPropertyLink(this->Internal->FieldAssociationAdaptor,
"currentText", SIGNAL(currentTextChanged(const QString&)),
proxy, proxy->GetProperty("XAxisPointComponent"));
this->Internal->Links.addPropertyLink(this->Internal->UsePoints,
"checked", SIGNAL(stateChanged(int)),
proxy, proxy->GetProperty("XAxisUsePoints"));
proxy, proxy->GetProperty("FieldAssociation"));
this->Internal->Links.addPropertyLink(this->Internal->CompositeTreeAdaptor,
"values", SIGNAL(valuesChanged()),
proxy, proxy->GetProperty("CompositeDataSetIndex"));
this->Internal->VTKConnect->Connect(proxy->GetProperty("FieldAssociation"),
vtkCommand::ModifiedEvent, repr, SLOT(updateLookupTable()), 0, 0,
Qt::QueuedConnection);
this->Internal->VTKConnect->Connect(proxy->GetProperty("XArrayName"),
vtkCommand::ModifiedEvent, repr, SLOT(updateLookupTable()), 0, 0,
Qt::QueuedConnection);
this->Internal->VTKConnect->Connect(proxy->GetProperty("YArrayName"),
vtkCommand::ModifiedEvent, repr, SLOT(updateLookupTable()), 0, 0,
Qt::QueuedConnection);
this->Internal->VTKConnect->Connect(proxy->GetProperty("XAxisUsePoints"),
this->Internal->VTKConnect->Connect(proxy->GetProperty("XArrayComponent"),
vtkCommand::ModifiedEvent, repr, SLOT(updateLookupTable()), 0, 0,
Qt::QueuedConnection);
this->Internal->VTKConnect->Connect(proxy->GetProperty("XAxisPointComponent"),
this->Internal->VTKConnect->Connect(proxy->GetProperty("YArrayComponent"),
vtkCommand::ModifiedEvent, repr, SLOT(updateLookupTable()), 0, 0,
Qt::QueuedConnection);
......
/*=========================================================================
Program: ParaView
Module: pqExtractDataSetsPanel.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 "pqExtractDataSetsPanel.h"
// Qt includes
#include <QAction>
#include <QCheckBox>
#include <QDoubleSpinBox>
#include <QLabel>
#include <QTimer>
#include <QTreeWidget>
#include <QVariant>
#include <QVector>
// VTK includes
// ParaView Server Manager includes
#include "vtkPVDataSetAttributesInformation.h"
#include "vtkPVArrayInformation.h"
#include "vtkPVDataInformation.h"
#include "vtkSMSourceProxy.h"
#include "vtkSMProperty.h"
#include "vtkSMProxyManager.h"
#include "vtkSMProxyProperty.h"
#include "vtkPVCompositeDataInformation.h"
#include "vtkSMIntVectorProperty.h"
// ParaView includes
#include "pqPropertyManager.h"
#include "pqProxy.h"
#include "pqSMAdaptor.h"
#include "pqTreeWidgetItemObject.h"
#include "vtkSMDoubleVectorProperty.h"
#include <assert.h>
//----------------------------------------------------------------------------
/*
class pqExtractDataSetsPanel::pqUI : public QObject, public Ui::ExtractDataSetsPanel
{
public:
pqUI(pqExtractDataSetsPanel* p) : QObject(p)
{
}
};
*/
//----------------------------------------------------------------------------
typedef vtkstd::pair<int,int> GroupIndex;
typedef vtkstd::pair<Qt::CheckState,QTreeWidgetItem*> StateItem;
typedef vtkstd::map< GroupIndex, StateItem> DataSetsMap;
class pqExtractDataSetsPanelInternals
{
public:
pqExtractDataSetsPanelInternals() {};
// store a list of <group, index> selected items
DataSetsMap SelectedData;
// make a copy of original state so we can put hings back when reset clicked
DataSetsMap SelectedDataCopy;
};
//----------------------------------------------------------------------------
pqExtractDataSetsPanel::pqExtractDataSetsPanel(pqProxy* object_proxy, QWidget* p) :
pqObjectPanel(object_proxy, p)
{
this->UI = new Ui::ExtractDataSetsPanel();
this->UI->setupUi(this);
this->UpdateInProgress = false;
this->Internals = new pqExtractDataSetsPanelInternals();
if(vtkSMProxyProperty* const input_property =
vtkSMProxyProperty::SafeDownCast(
this->proxy()->GetProperty("Input")))
{
if(vtkSMSourceProxy* const input_proxy = vtkSMSourceProxy::SafeDownCast(
input_property->GetProxy(0)))
{
vtkPVCompositeDataInformation* cdi =
input_proxy->GetDataInformation()->GetCompositeDataInformation();
unsigned int numGroups = cdi->GetNumberOfChildren();
QList<QString> strings;
int firstTime = 1;
pqTreeWidgetItemObject *groupitem;
for (unsigned int G=0; G<numGroups; G++)
{
// If there are more than one group, add a label showing
// the group number before listing the blocks for that
// group. Store the index of this item to be used later.
QString groupStr = QString("Group %1:").arg(G);
strings.clear();
strings.append(groupStr);
groupitem = new pqTreeWidgetItemObject(this->UI->DataSetsList, strings);
groupitem->setData(0, Qt::ToolTipRole, groupStr);
groupitem->setData(0, Qt::UserRole, -1);
groupitem->setChecked(0);
/*
// loop over datasets
unsigned int numDataSets = cdi->GetNumberOfDataSets(G);
for (unsigned int i=0; i<numDataSets; i++)
{
vtkPVDataInformation* dataInfo = cdi->GetDataInformation(G, i);
QString dataStr;
if (dataInfo)
{
dataStr = QString(" %1").arg(dataInfo->GetName());
}
else
{
dataStr = QString(" block %1").arg(i);
}
strings.clear();
strings.append(dataStr);
pqTreeWidgetItemObject *dataitem = new pqTreeWidgetItemObject(groupitem, strings);
dataitem->setData(0, Qt::ToolTipRole, dataStr);
dataitem->setData(0, Qt::UserRole, G); //group number
if (firstTime)
{
// By default select all first group