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

Method RequestData

Infovis/Core/vtkContinuousScatterplot.cxx:86–932  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

84}
85//------------------------------------------------------------------------------
86int vtkContinuousScatterplot::RequestData(
87 vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
88{
89 // get the input and output ports information.
90 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
91 vtkInformation* outInfo = outputVector->GetInformationObject(0);
92
93 // get the input data set, which is required to be a vtkUnstructuredGrid.
94 vtkUnstructuredGrid* input =
95 vtkUnstructuredGrid::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
96 // get the output data set, which is required to be a vtkImageData.
97 vtkImageData* output = vtkImageData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
98
99 // get the number of points and cells of the input grid.
100 vtkIdType numCells = input->GetNumberOfCells();
101 vtkIdType numPts = input->GetNumberOfPoints();
102
103 // get the dataset statistics and check if it is not an empty grid.
104 if (numCells < 1 || numPts < 1)
105 {
106 vtkErrorMacro("No input data.");
107 return 1;
108 }
109
110 // check if the output image resolution is a valid number.
111 if (this->ResX <= 0 || this->ResY <= 0)
112 {
113 vtkErrorMacro("The resolution of the output image has to be a positive number.");
114 return 1;
115 }
116
117 // check if the names of the input scalar fields are specified.
118 if (!this->Fields[0] || !this->Fields[1])
119 {
120 vtkErrorMacro("At least two fields need to be specified.");
121 return 1;
122 }
123
124 // Input point data, which should include the arrays defining the range space.
125 vtkDataSetAttributes* inPD = input->GetPointData();
126 // current data array of the given array names from the user input.
127 vtkSmartPointer<vtkDataArray> array;
128 // scalar range in two fields, where fieldInterval[0] = f1_max - f1_min,
129 // fieldInterval[1] = f2_max - f2_min
130 float fieldInterval[2];
131
132 // fragment width of two fields, where fragWidth[0] = fieldInterval[0] / resX,
133 // fragWidth[0] = fieldInterval[1] / resY, (resX, resY) is the output image
134 // resolution.
135 float fragWidth[2];
136
137 // Collect the first scalar field based on array names,
138 array = inPD->GetArray(this->Fields[0]);
139 // confirming that this field is present in the input.
140 if (array)
141 {
142 // Collect field ranges for later use.
143 fieldInterval[0] = array->GetRange()[1] - array->GetRange()[0];

Callers

nothing calls this directly

Calls 15

GetInformationObjectMethod · 0.80
InterpolateAllocateMethod · 0.80
SetNumberOfIdsMethod · 0.80
InsertNextIdMethod · 0.80
IsIdMethod · 0.80
InsertNextTuple2Method · 0.80
pop_backMethod · 0.80
AllocateEstimateMethod · 0.80
backMethod · 0.80
GetScalarPointerMethod · 0.80
NewFunction · 0.50
swapFunction · 0.50

Tested by

no test coverage detected