Commit f858774b authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot
Browse files

Merge topic '13491_fix_statics_panel'

643e9b4d Fixed comment.
8e80797f Fixed BUG #13491. Update array lists for statistics filters.
parents 4d85afdb 643e9b4d
......@@ -10473,11 +10473,6 @@ found and the point will be rejected.</Documentation>
<Documentation>A previously-calculated model with which to assess a
separate dataset. This input is optional.</Documentation>
</InputProperty>
<StringVectorProperty information_only="1"
name="SelectArrayInfo">
<ArraySelectionInformationHelper attribute_name="Attribute" />
<!-- attribute_name => GetNumberOf___Arrays -->
</StringVectorProperty>
<IntVectorProperty command="SetAttributeMode"
default_values="0"
name="AttributeMode"
......@@ -10636,11 +10631,6 @@ found and the point will be rejected.</Documentation>
<Documentation>A previously-calculated model with which to assess a
separate dataset. This input is optional.</Documentation>
</InputProperty>
<StringVectorProperty information_only="1"
name="SelectArrayInfo">
<ArraySelectionInformationHelper attribute_name="Attribute" />
<!-- attribute_name => GetNumberOf___Arrays -->
</StringVectorProperty>
<IntVectorProperty command="SetAttributeMode"
default_values="0"
name="AttributeMode"
......@@ -10840,11 +10830,6 @@ found and the point will be rejected.</Documentation>
<Documentation>A previously-calculated model with which to assess a
separate dataset. This input is optional.</Documentation>
</InputProperty>
<StringVectorProperty information_only="1"
name="SelectArrayInfo">
<ArraySelectionInformationHelper attribute_name="Attribute" />
<!-- attribute_name => GetNumberOf___Arrays -->
</StringVectorProperty>
<IntVectorProperty command="SetAttributeMode"
default_values="0"
name="AttributeMode"
......@@ -10996,11 +10981,6 @@ found and the point will be rejected.</Documentation>
<Documentation>A previously-calculated model with which to assess a
separate dataset. This input is optional.</Documentation>
</InputProperty>
<StringVectorProperty information_only="1"
name="SelectArrayInfo">
<ArraySelectionInformationHelper attribute_name="Attribute" />
<!-- attribute_name => GetNumberOf___Arrays -->
</StringVectorProperty>
<IntVectorProperty command="SetAttributeMode"
default_values="0"
name="AttributeMode"
......
......@@ -71,6 +71,8 @@ set (Module_SRCS
pqApplicationOptions.h
pqApplyPropertiesManager.cxx
pqApplyPropertiesManager.h
pqArrayListDomain.cxx
pqArrayListDomain.h
pqArrayStatusPropertyWidget.cxx
pqArrayStatusPropertyWidget.h
pqAutoGeneratedObjectPanel.cxx
......@@ -436,6 +438,7 @@ set (Module_MOC_HDRS
pqApplicationOptionsDialog.h
pqApplicationOptions.h
pqApplyPropertiesManager.h
pqArrayListDomain.h
pqArrayStatusPropertyWidget.h
pqAutoGeneratedObjectPanel.h
pqBoxWidget.h
......
/*=========================================================================
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 "pqArrayListDomain.h"
#include "pqSMAdaptor.h"
#include "vtkCommand.h"
#include "vtkSMArrayListDomain.h"
#include "vtkSMProperty.h"
#include "vtkSMProxy.h"
#include <QWidget>
#include <QtDebug>
class pqArrayListDomain::pqInternals
{
public:
QString QProperty;
vtkWeakPointer<vtkSMProxy> SMProxy;
vtkWeakPointer<vtkSMProperty> SMProperty;
vtkWeakPointer<vtkSMArrayListDomain> SMDomain;
unsigned long ObserverId;
pqInternals() : ObserverId(0)
{
}
~pqInternals()
{
if (this->SMDomain && this->ObserverId)
{
this->SMDomain->RemoveObserver(this->ObserverId);
}
this->ObserverId = 0;
}
};
//-----------------------------------------------------------------------------
pqArrayListDomain::pqArrayListDomain(
QWidget* selectorWidget, const QString& qproperty,
vtkSMProxy* proxy, vtkSMProperty* smproperty, vtkSMArrayListDomain* domain)
: Superclass(selectorWidget), Internals(new pqInternals())
{
Q_ASSERT(selectorWidget && proxy && smproperty && domain);
this->Internals->QProperty = qproperty;
this->Internals->SMProxy = proxy;
this->Internals->SMProperty = smproperty;
this->Internals->SMDomain = domain;
this->Internals->ObserverId = domain->AddObserver(
vtkCommand::DomainModifiedEvent,
this, &pqArrayListDomain::domainChanged);
}
//-----------------------------------------------------------------------------
pqArrayListDomain::~pqArrayListDomain()
{
delete this->Internals;
}
//-----------------------------------------------------------------------------
void pqArrayListDomain::domainChanged()
{
// reset the widget's value using the domain.
QList<QList<QVariant> > newVal = pqSMAdaptor::getSelectionProperty(
this->Internals->SMProperty, pqSMAdaptor::UNCHECKED);
QVariant variantVal;
variantVal.setValue(newVal);
this->parent()->setProperty(
this->Internals->QProperty.toAscii().data(), variantVal);
}
/*=========================================================================
Program: ParaView
Module: pqArrayListDomain.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 __pqArrayListDomain_h
#define __pqArrayListDomain_h
#include <QObject>
#include "pqComponentsModule.h"
class QWidget;
class vtkSMProperty;
class vtkSMProxy;
class vtkSMArrayListDomain;
/// pqArrayListDomain is used to connect a widget showing a selection of arrays
/// with its vtkSMArrayListDomain. Whenever the vtkSMArrayListDomain changes,
/// the widget is "reset" to update using the property's new domain. This is
/// useful for DescriptiveStatistics panel, for example. Whenever the attribute
/// selection changes (i.e. user switches from cell-data to point-data), we need
/// to update the widget's contents to show the list of array in the
/// corresponding attribute. This class takes care of that.
class PQCOMPONENTS_EXPORT pqArrayListDomain : public QObject
{
Q_OBJECT
typedef QObject Superclass;
public:
pqArrayListDomain(
QWidget* selectorWidget, const QString& qproperty,
vtkSMProxy* proxy, vtkSMProperty* smproperty, vtkSMArrayListDomain* domain);
virtual ~pqArrayListDomain();
private slots:
void domainChanged();
private:
Q_DISABLE_COPY(pqArrayListDomain)
class pqInternals;
pqInternals* Internals;
};
#endif
......@@ -137,6 +137,35 @@ public:
this->Items[key].push_back(item);
return item;
}
// returns the strings for the given key.
QStringList texts(const QString& key)
{
QStringList values;
foreach (pqTreeWidgetItemObject* item, this->Items[key])
{
if (item)
{
values << item->text(0);
}
}
return values;
}
// remove a particular item
void purge(const QString& key, const QString& text)
{
for (int cc=0; cc < this->Items[key].size(); cc++)
{
pqTreeWidgetItemObject* item = this->Items[key][cc];
if (item && item->text(0) == text)
{
delete item;
this->Items[key].removeAt(cc);
break;
}
}
}
QVariant value(const QString& key)
{
......@@ -209,6 +238,8 @@ void pqExodusIIVariableSelectionWidget::propertyChanged(const QString& pname)
}
else
{
QStringList currentStatiiKeys = this->Internals->texts(pname);
QList<QList<QVariant> > status_values =
properyValue.value<QList<QList<QVariant> > >();
foreach (const QList<QVariant>& tuple, status_values)
......@@ -216,8 +247,15 @@ void pqExodusIIVariableSelectionWidget::propertyChanged(const QString& pname)
if (tuple.size() == 2)
{
this->setStatus(pname, tuple[0].toString(), tuple[1].toBool());
currentStatiiKeys.removeAll(tuple[0].toString());
}
}
// remove any keys that are no longer present.
foreach (const QString& key, currentStatiiKeys)
{
this->Internals->purge(pname, key);
}
}
}
......
......@@ -47,6 +47,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkSMStringVectorProperty.h"
#include "pqApplicationCore.h"
#include "pqArrayListDomain.h"
#include "pqComboBoxDomain.h"
#include "pqExodusIIVariableSelectionWidget.h"
#include "pqFileChooserWidget.h"
......@@ -187,9 +188,6 @@ pqStringVectorPropertyWidget::pqStringVectorPropertyWidget(vtkSMProperty *smProp
selectorWidget->setObjectName("ArraySelectionWidget");
selectorWidget->setRootIsDecorated(false);
selectorWidget->setHeaderLabel(smProperty->GetXMLLabel());
this->addPropertyLink(
selectorWidget, smProxy->GetPropertyName(smProperty),
SIGNAL(widgetModified()), smProperty);
// hide widget label
this->setShowLabel(false);
......@@ -199,6 +197,22 @@ pqStringVectorPropertyWidget::pqStringVectorPropertyWidget(vtkSMProperty *smProp
this->setReason() << "pqExodusIIVariableSelectionWidget for a "
<< "StringVectorProperty with a repeatable "
<< "ArrayListDomain (" << arrayListDomain->GetXMLName() << ")";
// unlike vtkSMArraySelectionDomain which is doesn't tend to change based
// on values of other properties, typically, vtkSMArrayListDomain changes
// on other property values e.g. when one switches from point-data to
// cell-data, the available arrays change. Hence we "reset" the widget
// every time the domain changes.
new pqArrayListDomain(selectorWidget,
smProxy->GetPropertyName(smProperty),
smProxy, smProperty, arrayListDomain);
this->setReason()
<< " Also creating pqArrayListDomain to keep the list updated.";
this->addPropertyLink(
selectorWidget, smProxy->GetPropertyName(smProperty),
SIGNAL(widgetModified()), smProperty);
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment