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

Method SetNumberOfEntries

Rendering/Annotation/vtkLegendBoxActor.cxx:220–373  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

218
219//------------------------------------------------------------------------------
220void vtkLegendBoxActor::SetNumberOfEntries(int num)
221{
222 if (num == this->NumberOfEntries)
223 {
224 return;
225 }
226
227 else if (num < this->Size)
228 {
229 this->NumberOfEntries = num;
230 }
231
232 else // allocate space
233 {
234 int i;
235
236 // Create internal actors, etc.
237 vtkDoubleArray* colors = vtkDoubleArray::New();
238 colors->SetNumberOfComponents(3);
239 colors->SetNumberOfTuples(num);
240 vtkTextMapper** textMapper = new vtkTextMapper*[num];
241 vtkActor2D** textActor = new vtkActor2D*[num];
242
243 // Symbol
244 vtkPolyData** symbol = new vtkPolyData*[num];
245 vtkTransform** transform = new vtkTransform*[num];
246 vtkTransformPolyDataFilter** symbolTransform = new vtkTransformPolyDataFilter*[num];
247 vtkPolyDataMapper2D** symbolMapper = new vtkPolyDataMapper2D*[num];
248 vtkActor2D** symbolActor = new vtkActor2D*[num];
249
250 // Icon.
251 vtkPlaneSource** icon = new vtkPlaneSource*[num];
252 vtkTransform** iconTransform = new vtkTransform*[num];
253 vtkTransformPolyDataFilter** iconTransformFilter = new vtkTransformPolyDataFilter*[num];
254 vtkPolyDataMapper2D** iconMapper = new vtkPolyDataMapper2D*[num];
255 vtkTexturedActor2D** iconActor = new vtkTexturedActor2D*[num];
256 vtkImageData** iconImage = new vtkImageData*[num];
257
258 // copy old values
259 for (i = 0; i < this->NumberOfEntries; i++)
260 {
261 colors->SetTuple(i, this->Colors->GetTuple(i));
262 textMapper[i] = this->TextMapper[i];
263 textMapper[i]->Register(this);
264 textActor[i] = this->TextActor[i];
265 textActor[i]->Register(this);
266
267 // Symbol.
268 symbol[i] = this->Symbol[i];
269 if (symbol[i])
270 {
271 symbol[i]->Register(this);
272 }
273
274 transform[i] = this->Transform[i];
275 transform[i]->Register(this);
276
277 symbolTransform[i] = this->SymbolTransform[i];

Callers 12

ShallowCopyMethod · 0.95
vtkXYPlotActorMethod · 0.80
RenderOpaqueGeometryMethod · 0.80
vtkBarChartActorMethod · 0.80
vtkPieChartActorMethod · 0.80
vtkSpiderPlotActorMethod · 0.80
TestBarChartActorFunction · 0.80
TestLegendBoxActor2Function · 0.80
TestLegendBoxActorFunction · 0.80
TestPieChartActorFunction · 0.80
TestSpiderPlotActorFunction · 0.80

Calls 15

InitializeEntriesMethod · 0.95
NewFunction · 0.50
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45
SetTupleMethod · 0.45
GetTupleMethod · 0.45
RegisterMethod · 0.45
SetMapperMethod · 0.45
SetTransformMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
SetPoint1Method · 0.45

Tested by 5

TestBarChartActorFunction · 0.64
TestLegendBoxActor2Function · 0.64
TestLegendBoxActorFunction · 0.64
TestPieChartActorFunction · 0.64
TestSpiderPlotActorFunction · 0.64