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

Method InsertNextBlankRow

Common/DataModel/vtkTable.cxx:319–359  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

317
318//------------------------------------------------------------------------------
319vtkIdType vtkTable::InsertNextBlankRow(double default_num_val)
320{
321 vtkIdType ncol = this->GetNumberOfColumns();
322 std::vector<double> tuple(32, default_num_val);
323 for (vtkIdType i = 0; i < ncol; i++)
324 {
325 vtkAbstractArray* arr = this->GetColumn(i);
326 const size_t comps = static_cast<size_t>(arr->GetNumberOfComponents());
327 if (vtkArrayDownCast<vtkDataArray>(arr))
328 {
329 if (comps > tuple.size())
330 { // We initialize this to 32 components, but just in case...
331 tuple.resize(comps, default_num_val);
332 }
333
334 vtkDataArray* data = vtkArrayDownCast<vtkDataArray>(arr);
335 data->InsertNextTuple(tuple.data());
336 }
337 else if (vtkArrayDownCast<vtkStringArray>(arr))
338 {
339 vtkStringArray* data = vtkArrayDownCast<vtkStringArray>(arr);
340 for (size_t j = 0; j < comps; j++)
341 {
342 data->InsertNextValue(std::string());
343 }
344 }
345 else if (vtkArrayDownCast<vtkVariantArray>(arr))
346 {
347 vtkVariantArray* data = vtkArrayDownCast<vtkVariantArray>(arr);
348 for (size_t j = 0; j < comps; j++)
349 {
350 data->InsertNextValue(vtkVariant());
351 }
352 }
353 else
354 {
355 vtkErrorMacro(<< "Unsupported array type for InsertNextBlankRow");
356 }
357 }
358 return this->GetNumberOfRows() - 1;
359}
360
361//------------------------------------------------------------------------------
362vtkIdType vtkTable::InsertNextRow(vtkVariantArray* values)

Callers 15

InsertNextRowMethod · 0.95
InitializeDataFunction · 0.80
RequestDataMethod · 0.80
RequestDataMethod · 0.80
ReorderTableMethod · 0.80
InsertEmptyRowsFunction · 0.80
RequestDataMethod · 0.80
RequestDataMethod · 0.80
RequestDataMethod · 0.80
ArrayTableToSparseArrayFunction · 0.80

Calls 11

GetNumberOfColumnsMethod · 0.95
GetColumnMethod · 0.95
GetNumberOfRowsMethod · 0.95
vtkVariantClass · 0.70
stringClass · 0.50
GetNumberOfComponentsMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
InsertNextTupleMethod · 0.45
dataMethod · 0.45
InsertNextValueMethod · 0.45

Tested by 2

InitializeDataFunction · 0.64
InsertEmptyRowsFunction · 0.64