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

Method AddDataSetInputConnection

Rendering/Annotation/vtkXYPlotActor.cxx:415–466  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Add a dataset and array to the list of data to plot.

Source from the content-addressed store, hash-verified

413//------------------------------------------------------------------------------
414// Add a dataset and array to the list of data to plot.
415void vtkXYPlotActor::AddDataSetInputConnection(
416 vtkAlgorithmOutput* in, const char* arrayName, int component)
417{
418 int idx, num;
419 char** newNames;
420
421 // I cannot change the input list, because the user has direct
422 // access to the collection. I cannot store the index of the array,
423 // because the index might change from render to render ...
424 // I have to store the list of string array names.
425
426 idx = this->IsInputPresent(in, arrayName, component);
427 // idx starts at 1 and goes to "NumberOfItems".
428 if (idx != 0)
429 {
430 return;
431 }
432
433 // The input/array/component must be a unique combination. Add it to our input list.
434
435 // Now reallocate the list of strings and add the new value.
436 num = this->InputConnectionHolder->GetNumberOfInputConnections(0);
437 newNames = new char*[num + 1];
438 for (idx = 0; idx < num; ++idx)
439 {
440 newNames[idx] = this->SelectedInputScalars[idx];
441 }
442 if (arrayName == nullptr)
443 {
444 newNames[num] = nullptr;
445 }
446 else
447 {
448 newNames[num] = new char[strlen(arrayName) + 1];
449 strcpy(newNames[num], arrayName);
450 }
451 delete[] this->SelectedInputScalars;
452 this->SelectedInputScalars = newNames;
453
454 // Save the component in the int array.
455 this->SelectedInputScalarsComponent->InsertValue(num, component);
456
457 // Add the data set to the collection
458 this->InputConnectionHolder->AddInputConnection(0, in);
459
460 // In case of multiple use of a XYPlotActor the NumberOfEntries could be set
461 // to n. Then when a call to SetEntryString( n+1, bla ) was done the string was lost
462 // Need to update the number of entries for the legend actor
463 this->LegendActor->SetNumberOfEntries(this->LegendActor->GetNumberOfEntries() + 1);
464
465 this->Modified();
466}
467
468//------------------------------------------------------------------------------
469void vtkXYPlotActor::RemoveAllDataSetInputConnections()

Callers 8

AddDataSetInputMethod · 0.95
TestSplineWidgetFunction · 0.80
TestPolyPlaneFunction · 0.80
xyPlot2.pyFile · 0.80
xyPlot3.pyFile · 0.80
xyPlot.pyFile · 0.80
xyPlot4.pyFile · 0.80

Calls 6

IsInputPresentMethod · 0.95
SetNumberOfEntriesMethod · 0.80
InsertValueMethod · 0.45
AddInputConnectionMethod · 0.45
ModifiedMethod · 0.45

Tested by 2

TestSplineWidgetFunction · 0.64
TestPolyPlaneFunction · 0.64