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

Method Build

Rendering/Core/vtkDiscretizableColorTransferFunction.cxx:189–291  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

187
188//------------------------------------------------------------------------------
189void vtkDiscretizableColorTransferFunction::Build()
190{
191 this->Superclass::Build();
192
193 if (this->LookupTableUpdateTime > this->GetMTime())
194 {
195 // no need to rebuild anything.
196 return;
197 }
198
199 this->LookupTable->SetVectorMode(this->VectorMode);
200 this->LookupTable->SetVectorComponent(this->VectorComponent);
201 this->LookupTable->SetIndexedLookup(this->IndexedLookup);
202 this->LookupTable->SetUseBelowRangeColor(this->UseBelowRangeColor);
203 this->LookupTable->SetUseAboveRangeColor(this->UseAboveRangeColor);
204
205 double rgba[4];
206 this->GetBelowRangeColor(rgba);
207 rgba[3] = 1.0;
208 this->LookupTable->SetBelowRangeColor(rgba);
209
210 this->GetAboveRangeColor(rgba);
211 rgba[3] = 1.0;
212 this->LookupTable->SetAboveRangeColor(rgba);
213
214 // this is essential since other the LookupTable doesn't update the
215 // annotations map. That's a bug in the implementation of
216 // vtkScalarsToColors::SetAnnotations(..,..);
217 this->LookupTable->SetAnnotations(nullptr, nullptr);
218 this->LookupTable->SetAnnotations(this->AnnotatedValues, this->Annotations);
219
220 if (this->IndexedLookup)
221 {
222 if (this->GetNumberOfIndexedColors() > 0)
223 {
224 // Use the specified indexed-colors.
225 vtkIdType count = this->GetNumberOfAnnotatedValues();
226 this->LookupTable->SetNumberOfTableValues(count);
227 for (size_t cc = 0;
228 cc < this->Internals->IndexedColors.size() && cc < static_cast<size_t>(count); cc++)
229 {
230 rgba[0] = this->Internals->IndexedColors[cc].GetData()[0];
231 rgba[1] = this->Internals->IndexedColors[cc].GetData()[1];
232 rgba[2] = this->Internals->IndexedColors[cc].GetData()[2];
233 rgba[3] = this->Internals->IndexedColors[cc].GetData()[3];
234 this->LookupTable->SetTableValue(static_cast<int>(cc), rgba);
235 }
236 }
237 else
238 {
239 // old logic for backwards compatibility.
240 int nv = this->GetSize();
241 this->LookupTable->SetNumberOfTableValues(nv);
242 double nodeVal[6];
243 for (int i = 0; i < nv; ++i)
244 {
245 this->GetNodeValue(i, nodeVal);
246 nodeVal[4] = 1.;

Callers 15

MapValueMethod · 0.95
GetColorMethod · 0.95
RenderMethod · 0.45
labeledContours.pyFile · 0.45
MapScalarsToColorsMethod · 0.45
RenderMethod · 0.45
BuildRenderValuesMethod · 0.45
RenderMethod · 0.45

Calls 15

GetMTimeMethod · 0.95
SetBelowRangeColorMethod · 0.80
SetAboveRangeColorMethod · 0.80
SetAnnotationsMethod · 0.80
SetTableValueMethod · 0.80
BuildSpecialColorsMethod · 0.80
SetVectorModeMethod · 0.45
SetVectorComponentMethod · 0.45
sizeMethod · 0.45