Commit a2dd2fc2 authored by David Thompson's avatar David Thompson
Browse files

Fix color test regression.

This change forces the color editor to allow duplicate scalar
values for control points (i.e., you can have color discontinuities).
Previous to this change, coincident control points were not allowed
and this was enforced by deleting one of them. However, the order
was not consistent across other changes and there is no reason to
prevent discontinuous maps, so the constraint is being removed.

Change-Id: I1f44b707af6a9e6c3da213626ab16a2253d41352
parent d4633551
......@@ -274,11 +274,7 @@ void pqColorMapModel::addPoint(const pqChartValue &value, const QColor &color,
QList<pqColorMapModelItem *>::Iterator iter = this->InternalPts->begin();
for( ; iter != this->InternalPts->end(); ++iter)
{
if(value == (*iter)->Value)
{
return;
}
else if(value < (*iter)->Value)
if(value < (*iter)->Value)
{
break;
}
......
......@@ -2358,7 +2358,7 @@ void pqColorScaleEditor::updateScalarRange(double min, double max)
vtkColorTransferFunction* colors = this->currentColorFunction();
if(colors)
{
colors->SetAllowDuplicateScalars(min==max);
colors->SetAllowDuplicateScalars(1);
this->ColorMapViewer->chartBounds(chartBounds);
chartBounds[2] = min;
chartBounds[3] = max;
......@@ -2377,7 +2377,7 @@ void pqColorScaleEditor::updateScalarRange(double min, double max)
vtkPiecewiseFunction* pwf = this->currentOpacityFunction();
if(pwf)
{
pwf->SetAllowDuplicateScalars(min==max);
pwf->SetAllowDuplicateScalars(1);
}
if(this->ColorMap)
{
......
......@@ -7,7 +7,7 @@
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.
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
......@@ -148,7 +148,7 @@ void pqScalarsToColors::hideUnusedScalarBars()
pqApplicationCore* core = pqApplicationCore::instance();
pqServerManagerModel* smmodel = core->getServerManagerModel();
QList<pqPipelineRepresentation*> displays =
QList<pqPipelineRepresentation*> displays =
smmodel->findItems<pqPipelineRepresentation*>(this->getServer());
bool used_at_all = false;
......@@ -200,9 +200,8 @@ void pqScalarsToColors::setScalarRange(double min, double max)
dnew = (dnew >= 0) ? dnew : 1;
double scale = dnew/dold;
int allowDuplicateScalars = (min == max) ? 1 : 0;
pqSMAdaptor::setElementProperty(
this->getProxy()->GetProperty("AllowDuplicateScalars"), allowDuplicateScalars);
this->getProxy()->GetProperty("AllowDuplicateScalars"), 1);
vtkSMDoubleVectorProperty* dvp = vtkSMDoubleVectorProperty::SafeDownCast(
this->getProxy()->GetProperty("RGBPoints"));
QList<QVariant> controlPoints = pqSMAdaptor::getMultipleElementProperty(dvp);
......@@ -210,7 +209,7 @@ void pqScalarsToColors::setScalarRange(double min, double max)
int num_elems_per_command = dvp->GetNumberOfElementsPerCommand();
for (int cc=0; cc < controlPoints.size(); cc += num_elems_per_command)
{
// These checks ensure that the first and last control points match the
// These checks ensure that the first and last control points match the
// min and max values exactly.
if (cc==0)
{
......@@ -222,7 +221,7 @@ void pqScalarsToColors::setScalarRange(double min, double max)
}
else
{
controlPoints[cc] =
controlPoints[cc] =
scale * (controlPoints[cc].toDouble()-current_range.first) + min;
}
}
......
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