std::vector<int> selectedIdx =
vtkSMPropertyHelper(proxyRepresentation,"SelectedIDInfo").GetIntArray();
+ std::cout << "(Client) Received selected entries from server:" << std::endl;
+
if (selectedIdx.empty())
{
qWarning() << "There is no selected id for now.";
{
// Convert all selectedId from Representation in entry type and insert them in set
for(std::size_t i = 0; i < selectedIdx.size(); i++)
+ {
+ std::cout << selectedIdx[i] << std::endl;
EntryList.insert( SPV3D_Prs::FromVtkIdToEntry(static_cast<vtkIdType>(selectedIdx[i])) );
+ }
}
return EntryList;
void SPV3D_CADSelection::SetSelectionFromEntrySet(std::set<std::string> EntryList)
{
- // Solid Ids list to be provided to server
- std::vector<vtkIdType> SolidIds;
- for (std::string entry : EntryList)
- SolidIds.push_back( SPV3D_Prs::FromEntryToVtkId(entry.c_str()) );
-
- if (this->Representation == nullptr)
- {
+ if (this->Representation == nullptr) {
qWarning() << "There is no pqDataRepresentation";
+ return;
}
- return ;
+
vtkSMProxy* proxyRepresentation = this->Representation->getProxy();
- if (!proxyRepresentation)
+ if (!proxyRepresentation)
+ {
+ qWarning() << "There is no representation";
+ return;
+ }
+
+ std::cout << "(Client) Sending selected entries to server:" << std::endl;
+
+ // Retrieve entry ids and put them in a vector
+ std::vector<int> selectedIds;
+ selectedIds.reserve(EntryList.size());
+ for (const std::string& entryName: EntryList)
{
- qWarning()<< "There is no representation";
+ vtkIdType id = SPV3D_Prs::FromEntryToVtkId(entryName.c_str());
+ std::cout << "(Client) " << id << std::endl;
+ selectedIds.push_back(id);
}
- //TODO:
- // Send SolidIds vector<vtkIdType> to server
- // On server update the Selection with this SolidIds
-}
\ No newline at end of file
+
+ vtkSMProperty* selectedIDsProperty = proxyRepresentation->GetProperty("SelectedIDs");
+ vtkSMPropertyHelper(selectedIDsProperty).Set(selectedIds.data(), selectedIds.size());
+ proxyRepresentation->UpdateVTKObjects();
+}