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

Method RequestData

Filters/Programmable/vtkProgrammableGlyphFilter.cxx:70–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70int vtkProgrammableGlyphFilter::RequestData(vtkInformation* vtkNotUsed(request),
71 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
72{
73 // get the info objects
74 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
75 vtkInformation* sourceInfo = inputVector[1]->GetInformationObject(0);
76 vtkInformation* outInfo = outputVector->GetInformationObject(0);
77
78 // get the input and output
79 vtkDataSet* input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
80 vtkPolyData* source = vtkPolyData::SafeDownCast(sourceInfo->Get(vtkDataObject::DATA_OBJECT()));
81 vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
82
83 vtkPointData* inputPD = input->GetPointData();
84 vtkCellData* inputCD = input->GetCellData();
85 vtkPointData* outputPD = output->GetPointData();
86 vtkCellData* outputCD = output->GetCellData();
87 vtkPoints *newPts, *sourcePts;
88 vtkFloatArray *ptScalars = nullptr, *cellScalars = nullptr;
89 vtkDataArray *inPtScalars = nullptr, *inCellScalars = nullptr;
90 vtkIdType numPts = input->GetNumberOfPoints();
91 vtkPointData* sourcePD;
92 vtkCellData* sourceCD;
93 vtkIdType numSourcePts, numSourceCells, ptOffset = 0, cellId, ptId, id, idx;
94 int i, npts;
95 vtkIdList* pts;
96 vtkIdList* cellPts;
97 vtkCell* cell;
98
99 // Initialize
100 vtkDebugMacro(<< "Generating programmable glyphs!");
101
102 if (numPts < 1)
103 {
104 vtkErrorMacro(<< "No input points to glyph");
105 }
106
107 pts = vtkIdList::New();
108 pts->Allocate(VTK_CELL_SIZE);
109 sourcePD = source->GetPointData();
110 sourceCD = source->GetCellData();
111 numSourcePts = source->GetNumberOfPoints();
112 numSourceCells = source->GetNumberOfCells();
113
114 outputPD->CopyScalarsOff(); //'cause we control the coloring process
115 outputCD->CopyScalarsOff();
116
117 output->AllocateEstimate(numSourceCells * numPts, 1);
118 outputPD->CopyAllocate(sourcePD, numSourcePts * numPts, numSourcePts * numPts);
119 outputCD->CopyAllocate(sourceCD, numSourceCells * numPts, numSourceCells * numPts);
120 newPts = vtkPoints::New();
121 newPts->Allocate(numSourcePts * numPts);
122
123 // figure out how to color the data and setup
124 if (this->ColorMode == VTK_COLOR_BY_INPUT)
125 {
126 if ((inPtScalars = inputPD->GetScalars()))
127 {

Callers

nothing calls this directly

Calls 15

GetInformationObjectMethod · 0.80
AllocateEstimateMethod · 0.80
InsertIdMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetMethod · 0.45
GetPointDataMethod · 0.45
GetCellDataMethod · 0.45
GetNumberOfPointsMethod · 0.45
AllocateMethod · 0.45
GetNumberOfCellsMethod · 0.45
CopyAllocateMethod · 0.45

Tested by

no test coverage detected