Commit 5d21e6dd authored by David Thompson's avatar David Thompson
Browse files

Fix client-server categorical color test.

Change-Id: Ibf5060253eeb88b642a544ee6f785621378c4b9d
parent a1db41d2
......@@ -9,6 +9,8 @@
<pqevent object="pqClientMainWindow/objectInspectorDock/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/Function" command="set_string" arguments="floor(Iterations)" />
<pqevent object="pqClientMainWindow/objectInspectorDock/objectInspector/ScrollArea/qt_scrollarea_viewport/PanelArea/Editor/Function" command="key" arguments="16777248" />
<pqevent object="pqClientMainWindow/objectInspectorDock/objectInspector/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="set_string" arguments="Surface" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionResetCamera" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/variableToolbar/actionScalarBarVisibility" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/variableToolbar/actionEditColorMap" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/pqColorScaleDialog/SwitchToAdvanced" command="set_boolean" arguments="true" />
......
......@@ -784,25 +784,20 @@ void vtkPVArrayInformation::CopyToStream(vtkClientServerStream* css)
*css << location << name;
}
int haveUniqueValues = this->UniqueValues ? 1 : 0;
*css << haveUniqueValues;
if (haveUniqueValues)
int numberOfUniqueValueComponents = this->UniqueValues ? this->UniqueValues->size() : 0;
*css << numberOfUniqueValueComponents;
if (numberOfUniqueValueComponents)
{
for ( vtkIdType i = 0; i < this->GetNumberOfComponents(); ++ i )
// Iterate over component numbers:
vtkInternalUniqueValues::iterator cit;
for (cit = this->UniqueValues->begin(); cit != this->UniqueValues->end(); ++cit)
{
unsigned nuv = (*this->UniqueValues)[i].size();
*css << i << nuv;
if ( nuv )
unsigned nuv = cit->second.size();
*css << cit->first << nuv;
vtkInternalUniqueValues::mapped_type::iterator vit;
for (vit = cit->second.begin(); vit != cit->second.end(); ++ vit)
{
vtkVariantArray* aa = vtkVariantArray::New();
aa->Allocate( nuv );
vtkInternalUniqueValues::mapped_type::iterator vit = (*this->UniqueValues)[i].begin();
for ( vit = (*this->UniqueValues)[i].begin(); vit != (*this->UniqueValues)[i].end(); ++ vit )
{
aa->InsertNextValue( *vit );
}
*css << aa;
aa->Delete();
*css << *vit;
}
}
}
......@@ -934,55 +929,51 @@ void vtkPVArrayInformation::CopyFromStream(const vtkClientServerStream* css)
this->AddInformationKey(key_location, key_name);
}
int haveUniqueVals;
if ( ! css->GetArgument( 0, pos++, &haveUniqueVals ) )
int numberOfUniqueValueComponents;
if ( ! css->GetArgument( 0, pos++, &numberOfUniqueValueComponents ) )
{
vtkErrorMacro("Error parsing unique value existence from message.");
return;
}
if ( ! haveUniqueVals && this->UniqueValues )
if ( ! numberOfUniqueValueComponents && this->UniqueValues )
{
delete this->UniqueValues;
this->UniqueValues = 0;
}
else if ( haveUniqueVals )
else if ( numberOfUniqueValueComponents )
{
if ( ! this->UniqueValues )
{
this->UniqueValues = new vtkInternalUniqueValues;
}
unsigned nuv;
for ( int i = 0; i < this->NumberOfComponents; ++ i )
else
{
if ( ! css->GetArgument( 0, pos++, &nuv ) )
{
vtkErrorMacro( "Error decoding the number of unique values for component " << i );
return;
}
vtkAbstractArray* aa;
vtkObjectBase* obj;
if ( ! css->GetArgument( 0, pos++, &obj ) || ! obj )
this->UniqueValues->clear();
}
for ( int i = 0; i < numberOfUniqueValueComponents; ++ i )
{
int component;
if (!css->GetArgument(0, pos++, &component))
{
vtkErrorMacro( "Error decoding the list of unique values for component " << i );
vtkErrorMacro( "Error decoding the " << i << "-th unique-value component ID." );
return;
}
aa = vtkAbstractArray::SafeDownCast( obj );
if ( ! aa )
unsigned nuv;
if ( ! css->GetArgument( 0, pos++, &nuv ) )
{
vtkErrorMacro(
<< "Received " << obj->GetClassName() << " instead of vtkAbstractArray "
<< "for list of unique values for component " << i );
obj->Delete();
vtkErrorMacro( "Error decoding the number of unique values for component " << i );
return;
}
vtkInternalUniqueValues::mapped_type empty;
vtkInternalUniqueValues::value_type blank( i, empty );
this->UniqueValues->insert( blank );
for ( vtkIdType vi = 0; vi <= aa->GetMaxId(); ++ vi )
for (unsigned j = 0; j < nuv; ++j)
{
(*this->UniqueValues)[i].insert( aa->GetVariantValue( vi ) );
vtkVariant val;
if (!css->GetArgument(0, pos, &val))
{
vtkErrorMacro("Error decoding the " << j << "-th unique value for component " << i);
return;
}
(*this->UniqueValues)[component].insert(val);
}
aa->Delete();
}
}
}
......
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