#include <vtkSMStringVectorProperty.h>
#include <vtkSMRepresentationProxy.h>
#include <vtkPVDataSetAttributesInformation.h>
-
+#include <vtkSMSelectionHelper.h>
+#include <vtkSMOutputPort.h>
#include <QDebug>
+#include <vtkSelectionSource.h>
+#include <vtkSelectionNode.h>
+#include <pqPVApplicationCore.h>
+#include <pqSelectionManager.h>
+#include <pqServerManagerModel.h>
#include "SPV3D_Prs.h"
std::cout << "(Client) Sending selected entries to server:" << std::endl;
+ auto producerPort = vtkSMPropertyHelper(proxyRepresentation, "Input").GetAsOutputPort();
+ if (producerPort)
+ {
+ std::cout << producerPort->GetDataClassName() << std::endl;
+ }
+
+ vtkNew<vtkSelectionSource> selectionSource;
+ selectionSource->SetFieldType(vtkSelectionNode::CELL);
+ selectionSource->SetContentType(vtkSelectionNode::BLOCKS);
+ selectionSource->SetArrayName("name"); // TODO
+
// Retrieve entry ids and put them in a vector
std::vector<int> selectedIds;
selectedIds.reserve(EntryList.size());
vtkIdType id = SPV3D_Prs::FromEntryToVtkId(entryName.c_str());
std::cout << "(Client) " << id << std::endl;
selectedIds.push_back(id);
+
+ // TODO: I'm not sure what ids reference
+ selectionSource->AddBlock(id);
+
+
}
+ selectionSource->Update();
+
+ auto producer = producerPort->GetSourceProxy();
+
+ auto selectionSourceProxy = vtk::TakeSmartPointer(
+ vtkSMSourceProxy::SafeDownCast(vtkSMSelectionHelper::NewSelectionSourceFromSelection(
+ producer->GetSession(), selectionSource->GetOutput())));
+ // create append selection proxy from selection source proxy
+ auto appendSelections = vtk::TakeSmartPointer(vtkSMSourceProxy::SafeDownCast(
+ vtkSMSelectionHelper::NewAppendSelectionsFromSelectionSource(selectionSourceProxy)));
+ if (appendSelections)
+ {
+ producer->SetSelectionInput(producerPort->GetPortIndex(), appendSelections, 0);
+
+ auto smmodel = pqApplicationCore::instance()->getServerManagerModel();
+ auto selManager = pqPVApplicationCore::instance()->selectionManager();
+ selManager->select(smmodel->findItem<pqOutputPort*>(producerPort));
+ }
+
+
+
+ // vtkSMSelectionHelper::NewSelectionSourceFromSelection(, vtkSelection *selection);
+ vtkSMProperty* selectionProperty = proxyRepresentation->GetProperty("Selection");
+ // vtkSMPropertyHelper(selectionProperty)
+
vtkSMProperty* selectedIDsProperty = proxyRepresentation->GetProperty("SelectedIDs");
vtkSMPropertyHelper(selectedIDsProperty).Set(selectedIds.data(), selectedIds.size());
proxyRepresentation->UpdateVTKObjects();