MCPcopy Create free account
hub / github.com/Kitware/VTK / EqualProperties

Method EqualProperties

Common/DataModel/vtkSelectionNode.cxx:256–330  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

254
255//------------------------------------------------------------------------------
256bool vtkSelectionNode::EqualProperties(vtkSelectionNode* other, bool fullcompare /*=true*/)
257{
258 if (!other)
259 {
260 return false;
261 }
262
263 vtkNew<vtkInformationIterator> iterSelf;
264
265 iterSelf->SetInformation(this->Properties);
266
267 vtkInformation* otherProperties = other->GetProperties();
268 for (iterSelf->InitTraversal(); !iterSelf->IsDoneWithTraversal(); iterSelf->GoToNextItem())
269 {
270 vtkInformationKey* key = iterSelf->GetCurrentKey();
271 auto ikey = static_cast<vtkInformationIntegerKey*>(key);
272 if (ikey)
273 {
274 if (!otherProperties->Has(ikey) || this->Properties->Get(ikey) != otherProperties->Get(ikey))
275 {
276 return false;
277 }
278 }
279 else
280 {
281 auto okey = static_cast<vtkInformationObjectBaseKey*>(key);
282 if (okey)
283 {
284 if (!otherProperties->Has(okey) ||
285 this->Properties->Get(okey) != otherProperties->Get(okey))
286 {
287 return false;
288 }
289 }
290 }
291 }
292
293 // Also check that array names match for certain content types
294 // For VALUES and THRESHOLDS, names represent array where values come from.
295 // For PEDIGREEIDS, names represent the domain of the selection.
296 if (this->GetContentType() == vtkSelectionNode::VALUES ||
297 this->GetContentType() == vtkSelectionNode::PEDIGREEIDS ||
298 this->GetContentType() == vtkSelectionNode::THRESHOLDS)
299 {
300 int numArrays = other->SelectionData->GetNumberOfArrays();
301 if (this->SelectionData->GetNumberOfArrays() != numArrays)
302 {
303 return false;
304 }
305 for (int a = 0; a < numArrays; ++a)
306 {
307 vtkAbstractArray* arr = this->SelectionData->GetAbstractArray(a);
308 vtkAbstractArray* otherArr = other->SelectionData->GetAbstractArray(a);
309 if (!arr->GetName() && otherArr->GetName())
310 {
311 return false;
312 }
313 if (arr->GetName() && !otherArr->GetName())

Callers 2

UnionMethod · 0.80
SubtractMethod · 0.80

Calls 11

GetContentTypeMethod · 0.95
GetCurrentKeyMethod · 0.80
GetAbstractArrayMethod · 0.80
SetInformationMethod · 0.45
InitTraversalMethod · 0.45
IsDoneWithTraversalMethod · 0.45
GoToNextItemMethod · 0.45
HasMethod · 0.45
GetMethod · 0.45
GetNumberOfArraysMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected