Commit ad703671 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot

Merge topic '14873_fix_table_selections'

8e345d4d BUG #14873: Fixed selections on vtkTable datasets in spreadsheet.
parents a9bc9734 8e345d4d
......@@ -53,6 +53,7 @@ namespace
"vtkOriginalIndices",
"vtkOriginalCellIds",
"vtkOriginalPointIds",
"vtkOriginalRowIds",
"Structured Coordinates",
NULL};
std::string a1Name = a1->GetName()? a1->GetName() : "";
......
......@@ -187,13 +187,26 @@ int vtkMarkSelectedRows::RequestDataInternal(vtkTable* input,
vtkIdTypeArray *selectedIdsArray = 0;
if (this->FieldAssociation == vtkDataObject::FIELD_ASSOCIATION_POINTS)
switch (this->FieldAssociation)
{
selectedIdsArray = vtkIdTypeArray::SafeDownCast(extractedInput->GetColumnByName("vtkOriginalPointIds"));
}
else if (this->FieldAssociation == vtkDataObject::FIELD_ASSOCIATION_CELLS)
{
selectedIdsArray = vtkIdTypeArray::SafeDownCast(extractedInput->GetColumnByName("vtkOriginalCellIds"));
case vtkDataObject::FIELD_ASSOCIATION_POINTS:
selectedIdsArray = vtkIdTypeArray::SafeDownCast(
extractedInput->GetColumnByName("vtkOriginalPointIds"));
break;
case vtkDataObject::FIELD_ASSOCIATION_CELLS:
selectedIdsArray = vtkIdTypeArray::SafeDownCast(
extractedInput->GetColumnByName("vtkOriginalCellIds"));
break;
case vtkDataObject::FIELD_ASSOCIATION_ROWS:
selectedIdsArray = vtkIdTypeArray::SafeDownCast(
extractedInput->GetColumnByName("vtkOriginalRowIds"));
break;
default:
vtkWarningMacro("FieldAssociation type not supported yet. Selected elements "
"may not be shown correctly.");
}
if (!selectedIdsArray)
......
......@@ -601,6 +601,11 @@ QVariant pqSpreadSheetViewModel::headerData (
{
title = "Point ID";
}
else if (title == "vtkOriginalRowIds" &&
view->GetShowExtractedSelection())
{
title = "Row ID";
}
else if (title == "vtkCompositeIndexArray")
{
title = "Block Number";
......
......@@ -38,18 +38,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class pqSpreadSheetViewModel;
class vtkSMSourceProxy;
/// This is the selection model used by spread sheet view. It manages two
/// operations:
/// \li When user changes the selection by clicking on the view, it updates the
/// selection source proxy on the visible source proxy to reflect the
/// current selection.
/// \li When vtkSelection changes, is updated the selection in the view
/// accordingly.
/// When the model is updated by the Qt View, we intercept the select() calls
/// and don't update the QItemSelectionModel, instead the updates are pushed on
/// to the vtkSelection for the source. The Qt model is updated only when the
/// vtkSelection delivered to the client changes.
/// \li When the QItemSelectionModel is updated by the QAbstractItemView
/// due to user interaction, pqSpreadSheetViewModel::select() gets called.
/// In that overload, this class creates a 'ParaView Selection' i.e. create a
/// selection source proxy for an ID based selection and set it as the
/// selection-input (vtkSMSourceProxy::SetSelectionInput) on the
/// data-source being shown in the view.
/// \li Whenever the pqSpreadSheetViewModel receives new selection data from the
/// data-server, it updates its internal QItemSelection and fires
/// pqSpreadSheetViewModel::selectionChanged signal.
/// pqSpreadSheetViewSelectionModel handles that signal by updating itself to
/// mark the corresponding elements as selected.
class PQCORE_EXPORT pqSpreadSheetViewSelectionModel : public QItemSelectionModel
{
Q_OBJECT
......
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