Commit 71e69d8a authored by Mathieu Westphal's avatar Mathieu Westphal

Improvement to PointGaussianRepresentation

Better default configuration now managed by the domain
Multiple corrections to the widget/dialog duality
Added a "Reset to domain" button
Updated tests
Fix #18561
parent c59a1f2f
......@@ -27,9 +27,11 @@
<pqcheck object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/OpacityArray/ComboBox" property="currentText" arguments="thickness9" />
<pqcompareview object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/Viewport" baseline="$PARAVIEW_DATA_ROOT/Baseline/PointGaussianScaleOpacityArrayA.png" threshold="5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/ScaleTransferFunction/1QPushButton0" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/ScaleTransferFunction/groupBox/resetButton/QAction0" command="activate" arguments="" />
<pqcheck object="pqClientMainWindow/ScaleTransferFunction/groupBox/minX" property="text" arguments="-2.02298" />
<pqcheck object="pqClientMainWindow/ScaleTransferFunction/groupBox/maxX" property="text" arguments="5.05441" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/ScaleArrayComponent/ComboBox" command="activated" arguments="X" />
<pqevent object="pqClientMainWindow/ScaleTransferFunction/groupBox/resetButton/QAction0" command="activate" arguments="" />
<pqcheck object="pqClientMainWindow/ScaleTransferFunction/groupBox/minX" property="text" arguments="0" />
<pqcheck object="pqClientMainWindow/ScaleTransferFunction/groupBox/maxX" property="text" arguments="5.10369" />
<pqevent object="pqClientMainWindow/ScaleTransferFunction/TransferFunctionEditor/1QVTKWidget0" command="mousePress" arguments="(0.15,0.54065,1,1,0)" />
......@@ -40,6 +42,7 @@
<pqevent object="pqClientMainWindow/ScaleTransferFunction/TransferFunctionEditor/1QVTKWidget0" command="mouseRelease" arguments="(0.789474,0.626016,1,0,0)" />
<pqevent object="pqClientMainWindow/ScaleTransferFunction/ButtonBox/1QPushButton0" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/OpacityTransferFunction/1QPushButton0" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/OpacityTransferFunction/groupBox/resetButton/QAction0" command="activate" arguments="" />
<pqcheck object="pqClientMainWindow/OpacityTransferFunction/groupBox/minX" property="text" arguments="0.126328" />
<pqcheck object="pqClientMainWindow/OpacityTransferFunction/groupBox/maxX" property="text" arguments="1.14768" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/OpacityArray/ComboBox" command="activated" arguments="thickness7" />
......@@ -49,6 +52,7 @@
<pqevent object="pqClientMainWindow/OpacityTransferFunction/TransferFunctionEditor/1QVTKWidget0" command="mousePress" arguments="(0.45,0.353659,1,1,0)" />
<pqevent object="pqClientMainWindow/OpacityTransferFunction/TransferFunctionEditor/1QVTKWidget0" command="mouseMove" arguments="(0.45,0.353659,1,0,0)" />
<pqevent object="pqClientMainWindow/OpacityTransferFunction/TransferFunctionEditor/1QVTKWidget0" command="mouseRelease" arguments="(0.45,0.353659,1,0,0)" />
<pqevent object="pqClientMainWindow/OpacityTransferFunction/groupBox/resetButton/QAction0" command="activate" arguments="" />
<pqcheck object="pqClientMainWindow/OpacityTransferFunction/groupBox/minX" property="text" arguments="0.340609" />
<pqcheck object="pqClientMainWindow/OpacityTransferFunction/groupBox/maxX" property="text" arguments="0.907029" />
<pqevent object="pqClientMainWindow/OpacityTransferFunction/ButtonBox/1QPushButton0" command="activate" arguments="" />
......
......@@ -104,7 +104,6 @@ set (Module_SRCS
vtkSMProxyProperty.cxx
vtkSMProxySelectionModel.cxx
vtkSMRangeDomainTemplate.txx
vtkSMRangedTransferFunctionDomain.cxx
vtkSMReaderFactory.cxx
vtkSMRemoteObject.cxx
vtkSMRemoteObjectUpdateUndoElement.cxx
......
......@@ -56,6 +56,7 @@ set (Module_SRCS
vtkSMPlotMatrixViewProxy.cxx
vtkSMPVRepresentationProxy.cxx
vtkSMRenderViewProxy.cxx
vtkSMRangedTransferFunctionDomain.cxx
vtkSMRepresentationProxy.cxx
vtkSMRepresentationTypeDomain.cxx
vtkSMRepresentedArrayListDomain.cxx
......
......@@ -18,6 +18,8 @@
#include "vtkNew.h"
#include "vtkObjectFactory.h"
#include "vtkSMArrayRangeDomain.h"
#include "vtkSMProxyProperty.h"
#include "vtkSMTransferFunctionProxy.h"
class vtkSMRangedTransferFunctionDomainInternals
{
......@@ -132,3 +134,50 @@ void vtkSMRangedTransferFunctionDomain::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
//-----------------------------------------------------------------------------
int vtkSMRangedTransferFunctionDomain::SetDefaultValues(
vtkSMProperty* prop, bool use_unchecked_values)
{
vtkSMProxyProperty* proxyProp = vtkSMProxyProperty::SafeDownCast(prop);
vtkSMTransferFunctionProxy* transferFunctionProxy = nullptr;
if (proxyProp)
{
if (use_unchecked_values)
{
if (proxyProp->GetNumberOfUncheckedProxies() > 0)
{
transferFunctionProxy =
vtkSMTransferFunctionProxy::SafeDownCast(proxyProp->GetUncheckedProxy(0));
}
}
else
{
if (proxyProp->GetNumberOfProxies() > 0)
{
transferFunctionProxy = vtkSMTransferFunctionProxy::SafeDownCast(proxyProp->GetProxy(0));
}
}
}
if (transferFunctionProxy)
{
double rangeMin = 0.0;
double rangeMax = 1.0;
if (this->GetRangeMinimumExists(0) && this->GetRangeMaximumExists(0))
{
rangeMin = this->GetRangeMinimum(0);
rangeMax = this->GetRangeMaximum(0);
}
else if (this->GetRangeMinimumExists(0))
{
rangeMin = rangeMax = this->GetRangeMinimum(0);
}
else if (this->GetRangeMaximumExists(0))
{
rangeMin = rangeMax = this->GetRangeMaximum(0);
}
transferFunctionProxy->RescaleTransferFunction(rangeMin, rangeMax, false);
}
return this->Superclass::SetDefaultValues(prop, use_unchecked_values);
}
......@@ -36,13 +36,14 @@
#ifndef vtkSMRangedTransferFunctionDomain_h
#define vtkSMRangedTransferFunctionDomain_h
#include "vtkClientServerID.h" // needed for saving animation in batch script
#include "vtkPVServerManagerCoreModule.h" //needed for exports
#include "vtkClientServerID.h" // needed for saving animation in batch script
#include "vtkPVServerManagerRenderingModule.h" //needed for exports
#include "vtkSMProxyListDomain.h"
class vtkSMRangedTransferFunctionDomainInternals;
class VTKPVSERVERMANAGERCORE_EXPORT vtkSMRangedTransferFunctionDomain : public vtkSMProxyListDomain
class VTKPVSERVERMANAGERRENDERING_EXPORT vtkSMRangedTransferFunctionDomain
: public vtkSMProxyListDomain
{
public:
static vtkSMRangedTransferFunctionDomain* New();
......@@ -71,6 +72,7 @@ public:
bool GetRangeMaximumExists(unsigned int idx);
//@}
//@{
/**
* Returns the range minimum/maximum value, is exists, otherwise
* 0 is returned. Use GetMaximumExists() GetMaximumExists() to make sure that
......@@ -86,6 +88,13 @@ public:
int not_used;
return this->GetRangeMaximum(idx, not_used);
}
//@}
/**
* If prop is a vtkSMProxyProperty containing a vtkSMTransferFunctionProxy
* this set its range based on this domain min and max values.
*/
int SetDefaultValues(vtkSMProperty* prop, bool use_unchecked_values) override;
protected:
vtkSMRangedTransferFunctionDomain();
......
......@@ -4687,39 +4687,6 @@
</RequiredProperties>
</FieldDataDomain>
</StringVectorProperty>
<StringVectorProperty name="SetScaleArray"
command="SelectScaleArray"
number_of_elements="5"
element_types="0 0 0 0 2"
label="Gaussian Scale Array"
panel_visibility="advanced">
<ArrayListDomain name="array_list"
input_domain_name="input_point_array">
<RequiredProperties>
<Property name="Input" function="Input"/>
</RequiredProperties>
</ArrayListDomain>
<Documentation>
This property specifies the name of the input array to scale the splats by.
</Documentation>
</StringVectorProperty>
<IntVectorProperty animateable="0"
command="SelectScaleArrayComponent"
default_values="0"
name="ScaleArrayComponent"
number_of_elements="1">
<NumberOfComponentsDomain name="comps" enable_magnitude="1">
<RequiredProperties>
<Property function="Input"
name="Input" />
<Property function="ArraySelection"
name="SetScaleArray" />
</RequiredProperties>
</NumberOfComponentsDomain>
<Documentation>
This property indicates the component of the array to be used for scaling.
</Documentation>
</IntVectorProperty>
<IntVectorProperty command="SetMapScalars"
default_values="1"
name="MapScalars"
......@@ -4732,7 +4699,6 @@
floating point type) and then directly used as
color.</Documentation>
</IntVectorProperty>
<ProxyProperty command="SetLookupTable"
name="LookupTable" >
<Documentation>Set the lookup-table to use to map data array to colors.
......@@ -4741,20 +4707,94 @@
<Group name="lookup_tables" />
</ProxyGroupDomain>
</ProxyProperty>
<ProxyProperty command="SetScaleTransferFunction"
name="ScaleTransferFunction"
panel_visibility="advanced"
panel_widget="transfer_function_editor" >
<Documentation>Set the piecewise function used to map data array to sprite size.
ScaleTransferFunction is only used if ScaleByArray is set.</Documentation>
<RangedTransferFunctionDomain name="proxy_list">
<DoubleVectorProperty command="SetSplatSize"
default_values="0.0"
name="GaussianRadius"
label="Gaussian Radius"
number_of_elements="1">
<BoundsDomain name="range" mode="scaled_extent" scale_factor="0.005">
<RequiredProperties>
<Property function="Input" name="Input" />
<Property function="ArraySelection" name="SetScaleArray" />
<Property function="ComponentSelection" name="ScaleArrayComponent" />
</RequiredProperties>
</RangedTransferFunctionDomain>
</ProxyProperty>
</BoundsDomain>
<Documentation>
The radius of the gaussian blur for each point.
</Documentation>
</DoubleVectorProperty>
<IntVectorProperty command="SelectShaderPreset"
default_values="1"
name="ShaderPreset"
number_of_elements="1">
<EnumerationDomain name="enum">
<Entry text="Gaussian Blur"
value="0" />
<Entry text="Sphere"
value="1" />
<Entry text="Black-edged circle"
value="2" />
<Entry text="Plain circle"
value="3" />
<Entry text="Triangle"
value="4" />
<Entry text="Square Outline"
value="5" />
<Entry text="Custom"
value="6" />
</EnumerationDomain>
</IntVectorProperty>
<IntVectorProperty animateable="0"
command="SetCustomTriangleScale"
default_values="3"
name="CustomTriangleScale"
number_of_elements="1"
panel_visibility="advanced">
<Documentation>
Sets the scale of the triangle geometry drawn, automatically
set when using preset but needed with custom shader code
</Documentation>
<Hints>
<PropertyWidgetDecorator type="GenericDecorator"
mode="visibility"
property="ShaderPreset"
value="6" />
<!-- show this widget when using CustomShader -->
</Hints>
</IntVectorProperty>
<StringVectorProperty command="SetCustomShader"
default_values="
// This custom shader code define a gaussian blur&#xa;
// Please take a look into vtkSMPointGaussianRepresentation.cxx&#xa;
// for other custom shader examples&#xa;
//VTK::Color::Impl&#xa;
float dist2 = dot(offsetVCVSOutput.xy,offsetVCVSOutput.xy);&#xa;
float gaussian = exp(-0.5*dist2);&#xa;
opacity = opacity*gaussian;&#xa;"
label="Custom Shader Code"
name="CustomShader"
number_of_elements="1"
panel_visibility="advanced">
<Documentation>
Sets the custom shader code
</Documentation>
<Hints>
<Widget type="multi_line" />
<PropertyWidgetDecorator type="GenericDecorator"
mode="visibility"
property="ShaderPreset"
value="6" />
<!-- show this widget when using CustomShader -->
</Hints>
</StringVectorProperty>
<IntVectorProperty command="SetEmissive"
default_values="0"
name="Emissive"
number_of_elements="1"
panel_visibility="advanced">
<BooleanDomain name="bool" />
<Documentation>
Should the splat be emissive like a light source or not. For cosmology emissive should be on. For scanned point clouds typically it would be off.
</Documentation>
</IntVectorProperty>
<IntVectorProperty command="SetScaleByArray"
default_values="0"
name="ScaleByArray"
......@@ -4767,6 +4807,49 @@
of the gaussians. Otherwise the Default Radius will be used.
</Documentation>
</IntVectorProperty>
<StringVectorProperty name="SetScaleArray"
command="SelectScaleArray"
number_of_elements="5"
element_types="0 0 0 0 2"
label="Gaussian Scale Array"
panel_visibility="advanced">
<ArrayListDomain name="array_list"
input_domain_name="input_point_array">
<RequiredProperties>
<Property name="Input" function="Input"/>
</RequiredProperties>
</ArrayListDomain>
<Documentation>
This property specifies the name of the input array to scale the splats by.
</Documentation>
<Hints>
<PropertyWidgetDecorator type="ShowWidgetDecorator">
<Property name="ScaleByArray" function="boolean" />
</PropertyWidgetDecorator>
</Hints>
</StringVectorProperty>
<IntVectorProperty animateable="0"
command="SelectScaleArrayComponent"
default_values="0"
name="ScaleArrayComponent"
number_of_elements="1">
<NumberOfComponentsDomain name="comps" enable_magnitude="1">
<RequiredProperties>
<Property function="Input"
name="Input" />
<Property function="ArraySelection"
name="SetScaleArray" />
</RequiredProperties>
</NumberOfComponentsDomain>
<Documentation>
This property indicates the component of the array to be used for scaling.
</Documentation>
<Hints>
<PropertyWidgetDecorator type="ShowWidgetDecorator">
<Property name="ScaleByArray" function="boolean" />
</PropertyWidgetDecorator>
</Hints>
</IntVectorProperty>
<IntVectorProperty command="SetUseScaleFunction"
default_values="1"
name="UseScaleFunction"
......@@ -4778,21 +4861,37 @@
If this property is enabled, the Scale Transfer Function is used to map
the scale values of the Scale Array. Otherwise, the scale values are used as-is.
</Documentation>
<Hints>
<PropertyWidgetDecorator type="ShowWidgetDecorator">
<Property name="ScaleByArray" function="boolean" />
</PropertyWidgetDecorator>
</Hints>
</IntVectorProperty>
<ProxyProperty command="SetOpacityTransferFunction"
name="OpacityTransferFunction"
<ProxyProperty command="SetScaleTransferFunction"
name="ScaleTransferFunction"
panel_visibility="advanced"
panel_widget="transfer_function_editor">
<Documentation>Set the piecewise function used to map data array to sprite opacity.
OpacityTransferFunction is only used if ScaleByArray is set and OpacityArray is
also given.</Documentation>
panel_widget="transfer_function_editor" >
<Documentation>Set the piecewise function used to map data array to sprite size.
ScaleTransferFunction is only used if ScaleByArray is set.</Documentation>
<RangedTransferFunctionDomain name="proxy_list">
<RequiredProperties>
<Property function="Input" name="Input" />
<Property function="ArraySelection" name="OpacityArray" />
<Property function="ComponentSelection" name="OpacityArrayComponent" />
<Property function="ArraySelection" name="SetScaleArray" />
<Property function="ComponentSelection" name="ScaleArrayComponent" />
</RequiredProperties>
</RangedTransferFunctionDomain>
<Hints>
<PropertyWidgetDecorator type="CompositeDecorator">
<Expression type="and">
<PropertyWidgetDecorator type="ShowWidgetDecorator">
<Property name="ScaleByArray" function="boolean" />
</PropertyWidgetDecorator>
<PropertyWidgetDecorator type="ShowWidgetDecorator">
<Property name="UseScaleFunction" function="boolean" />
</PropertyWidgetDecorator>
</Expression>
</PropertyWidgetDecorator>
</Hints>
</ProxyProperty>
<IntVectorProperty command="SetOpacityByArray"
default_values="0"
......@@ -4821,6 +4920,11 @@
<Documentation>
This property specifies the name of the input array to map to point opacity.
</Documentation>
<Hints>
<PropertyWidgetDecorator type="ShowWidgetDecorator">
<Property name="OpacityByArray" function="boolean" />
</PropertyWidgetDecorator>
</Hints>
</StringVectorProperty>
<IntVectorProperty animateable="0"
command="SelectOpacityArrayComponent"
......@@ -4838,7 +4942,32 @@
<Documentation>
This property indicates the component of the array to be used for opacity.
</Documentation>
<Hints>
<PropertyWidgetDecorator type="ShowWidgetDecorator">
<Property name="OpacityByArray" function="boolean" />
</PropertyWidgetDecorator>
</Hints>
</IntVectorProperty>
<ProxyProperty command="SetOpacityTransferFunction"
name="OpacityTransferFunction"
panel_visibility="advanced"
panel_widget="transfer_function_editor">
<Documentation>Set the piecewise function used to map data array to sprite opacity.
OpacityTransferFunction is only used if ScaleByArray is set and OpacityArray is
also given.</Documentation>
<RangedTransferFunctionDomain name="proxy_list">
<RequiredProperties>
<Property function="Input" name="Input" />
<Property function="ArraySelection" name="OpacityArray" />
<Property function="ComponentSelection" name="OpacityArrayComponent" />
</RequiredProperties>
</RangedTransferFunctionDomain>
<Hints>
<PropertyWidgetDecorator type="ShowWidgetDecorator">
<Property name="OpacityByArray" function="boolean" />
</PropertyWidgetDecorator>
</Hints>
</ProxyProperty>
<DoubleVectorProperty command="SetOpacity"
default_values="1.0"
name="Opacity"
......@@ -4848,30 +4977,6 @@
The opacity to use when rendering the model.
</Documentation>
</DoubleVectorProperty>
<DoubleVectorProperty command="SetSplatSize"
default_values="0.0"
name="GaussianRadius"
label="Gaussian Radius"
number_of_elements="1">
<BoundsDomain name="range" mode="scaled_extent" scale_factor="0.005">
<RequiredProperties>
<Property function="Input" name="Input" />
</RequiredProperties>
</BoundsDomain>
<Documentation>
The radius of the gaussian blur for each point.
</Documentation>
</DoubleVectorProperty>
<IntVectorProperty command="SetEmissive"
default_values="0"
name="Emissive"
number_of_elements="1"
panel_visibility="advanced">
<BooleanDomain name="bool" />
<Documentation>
Should the splat be emissive like a light source or not. For cosmology emissive should be on. For scanned point clouds typically it would be off.
</Documentation>
</IntVectorProperty>
<DoubleVectorProperty command="SetColor"
default_values="1.0 1.0 1.0"
name="Color"
......@@ -4974,71 +5079,6 @@
</Hints>
<BooleanDomain name="bool" />
</IntVectorProperty>
<IntVectorProperty command="SelectShaderPreset"
default_values="1"
name="ShaderPreset"
number_of_elements="1">
<EnumerationDomain name="enum">
<Entry text="Gaussian Blur"
value="0" />
<Entry text="Sphere"
value="1" />
<Entry text="Black-edged circle"
value="2" />
<Entry text="Plain circle"
value="3" />
<Entry text="Triangle"
value="4" />
<Entry text="Square Outline"
value="5" />
<Entry text="Custom"
value="6" />
</EnumerationDomain>
</IntVectorProperty>
<IntVectorProperty animateable="0"
command="SetCustomTriangleScale"
default_values="3"
name="CustomTriangleScale"
number_of_elements="1"
panel_visibility="advanced">
<Documentation>
Sets the scale of the triangle geometry drawn, automatically
set when using preset but needed with custom shader code
</Documentation>
<Hints>
<PropertyWidgetDecorator type="GenericDecorator"
mode="visibility"
property="ShaderPreset"
value="6" />
<!-- show this widget when using CustomShader -->
</Hints>
</IntVectorProperty>
<StringVectorProperty command="SetCustomShader"
default_values="
// This custom shader code define a gaussian blur&#xa;
// Please take a look into vtkSMPointGaussianRepresentation.cxx&#xa;
// for other custom shader examples&#xa;
//VTK::Color::Impl&#xa;
float dist2 = dot(offsetVCVSOutput.xy,offsetVCVSOutput.xy);&#xa;
float gaussian = exp(-0.5*dist2);&#xa;
opacity = opacity*gaussian;&#xa;"
label="Custom Shader Code"
name="CustomShader"
number_of_elements="1"
panel_visibility="advanced">
<Documentation>
Sets the custom shader code
</Documentation>
<Hints>
<Widget type="multi_line" />
<PropertyWidgetDecorator type="GenericDecorator"
mode="visibility"
property="ShaderPreset"
value="6" />
<!-- show this widget when using CustomShader -->
</Hints>
</StringVectorProperty>
<!-- End of PointGaussianRepresentation -->
</RepresentationProxy>
......
......@@ -56,6 +56,9 @@
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="pqHighlightableToolButton" name="resetButton"/>
</item>
</layout>
</widget>
</item>
......@@ -72,6 +75,11 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>pqHighlightableToolButton</class>
<extends>QToolButton</extends>
<header>pqHighlightableToolButton.h</header>
</customwidget>
<customwidget>
<class>pqTransferFunctionWidget</class>
<extends>QWidget</extends>
......
......@@ -34,9 +34,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqTransferFunctionWidgetPropertyWidget.h"
#include "vtkPiecewiseFunction.h"
#include <QString>
#include <QAction>
#include <QDoubleValidator>
#include <QString>
#include <QStyle>
class pqTransferFunctionWidgetPropertyDialog::pqInternals
{
......@@ -47,7 +49,7 @@ public:
};
pqTransferFunctionWidgetPropertyDialog::pqTransferFunctionWidgetPropertyDialog(const QString& label,
double* xrange, vtkPiecewiseFunction* transferFunction, QWidget* propertyWdg, QWidget* parentWdg)
vtkPiecewiseFunction* transferFunction, QWidget* propertyWdg, QWidget* parentWdg)
: QDialog(parentWdg)
, TransferFunction(transferFunction)
, PropertyWidget(propertyWdg)
......@@ -62,32 +64,45 @@ pqTransferFunctionWidgetPropertyDialog::pqTransferFunctionWidgetPropertyDialog(c
QDoubleValidator* validator = new QDoubleValidator(this);
this->Internals->Ui.minX->setValidator(validator);
this->Internals->Ui.maxX->setValidator(validator);
this->Internals->Ui.minX->setText(QString::number(xrange[0]));
this->Internals->Ui.maxX->setText(QString::number(xrange[1]));
this->updateRange();
QObject::connect(this->Internals->Ui.minX, SIGNAL(textChangedAndEditingFinished()), this,
SLOT(onRangeChanged()));
QObject::connect(this->Internals->Ui.maxX, SIGNAL(textChangedAndEditingFinished()), this,
SLOT(onRangeChanged()));
QObject::connect(
this->Internals->Ui.minX, SIGNAL(textChangedAndEditingFinished()), this, SLOT(onRangeEdited()));
QObject::connect(
this->Internals->Ui.maxX, SIGNAL(textChangedAndEditingFinished()), this, SLOT(onRangeEdited()));
QObject::connect(this->Internals->Ui.TransferFunctionEditor, SIGNAL(controlPointsModified()),
this->PropertyWidget, SLOT(propagateProxyPointsProperty()));
QObject::connect(this->PropertyWidget, SIGNAL(domainChanged()), this, SLOT(onDomainChanged()));
QAction* resetActn = new QAction(this->Internals->Ui.resetButton);
resetActn->setToolTip("Reset using current data values");
resetActn->setIcon(
this->Internals->Ui.resetButton->style()->standardIcon(QStyle::SP_BrowserReload));
this->Internals->Ui.resetButton->addAction(resetActn);
this->Internals->Ui.resetButton->setDefaultAction(resetActn);
QObject::connect(this->PropertyWidget, SIGNAL(domainChanged()), this->Internals->Ui.resetButton,
SLOT(highlight()));
QObject::connect(this->Internals->Ui.resetButton, SIGNAL(clicked()),
this->Internals->Ui.resetButton, SLOT(clear()));
QObject::connect(
resetActn, SIGNAL(triggered(bool)), this->PropertyWidget, SLOT(resetRangeToDomainDefault()));
QObject::connect(resetActn, SIGNAL(triggered(bool)), this, SLOT(updateRange()));
}
pqTransferFunctionWidgetPropertyDialog::~pqTransferFunctionWidgetPropertyDialog()
{
}
void pqTransferFunctionWidgetPropertyDialog::onDomainChanged()
void pqTransferFunctionWidgetPropertyDialog::updateRange()
{
pqTransferFunctionWidgetPropertyWidget* propertyWdg =
qobject_cast<pqTransferFunctionWidgetPropertyWidget*>(this->PropertyWidget);
const double* range = propertyWdg->getRange();
double range[2];
propertyWdg->getRange(range);
this->Internals->Ui.minX->setText(QString::number(range[0]));
this->Internals->Ui.maxX->setText(QString::number(range[1]));
}
void pqTransferFunctionWidgetPropertyDialog::onRangeChanged()
void pqTransferFunctionWidgetPropertyDialog::onRangeEdited()
{
pqTransferFunctionWidgetPropertyWidget* propertyWdg =
qobject_cast<pqTransferFunctionWidgetPropertyWidget*>(this->PropertyWidget);
......
......@@ -44,13 +44,13 @@ class PQAPPLICATIONCOMPONENTS_EXPORT pqTransferFunctionWidgetPropertyDialog : pu
Q_OBJECT
public:
pqTransferFunctionWidgetPropertyDialog(const QString& label, double* xrange,
pqTransferFunctionWidgetPropertyDialog(const QString& label,
vtkPiecewiseFunction* transferFunction, QWidget* propertyWdg, QWidget* parentWdg = NULL);
~pqTransferFunctionWidgetPropertyDialog();
protected slots:
void onRangeChanged();
void onDomainChanged();
void onRangeEdited();
void updateRange();
private:
vtkSmartPointer<vtkPiecewiseFunction> TransferFunction;
......
......@@ -79,8 +79,6 @@ pqTransferFunctionWidgetPropertyWidget::pqTransferFunctionWidgetPropertyWidget(
return;
}
this->TFProxy = vtkSMTransferFunctionProxy::SafeDownCast(pxy);
this->Range[0] = 0.0;
this->Range[1] = 1.0;
this->Connection = vtkEventQtSlotConnect::New();
this->Domain =
......@@ -88,9 +86,8 @@ pqTransferFunctionWidgetPropertyWidget::pqTransferFunctionWidgetPropertyWidget(
if (this->Domain)
{
this->Connection->Connect(
this->Domain, vtkCommand::DomainModifiedEvent, this, SLOT(onDomainChanged()));
this->Domain, vtkCommand::DomainModifiedEvent, this, SIGNAL(domainChanged()));
}
this->onDomainChanged();
QVBoxLayout* l = new QVBoxLayout;
l->setMargin(0);
......@@ -111,36 +108,26 @@ pqTransferFunctionWidgetPropertyWidget::~pqTransferFunctionWidgetPropertyWidget(
{
this->Connection->Delete();
}
delete this->Dialog;
}