[vtkusers] VTK slow to display 300 vtkArrowSource in real-time

Olivier Ameline olivameline at gmail.com
Mon Oct 17 05:17:08 EDT 2016


Hello,

I think I can manage with no zoom on the labels.

I just have a last question : I can't manage to use a array of different
labels (with vtkStringArray).
I get the error message "vtkDynamic2DLabelMapper (000001FE6E572970): Could
not find label array (labels) in input", and no labels are displayed but
only the arrows.

Here is a part of my code :

        int num_pts = 10;

        vtkPoints *ptsText = vtkPoints::New();
	ptsText->SetNumberOfPoints(num_pts);

	for (int i = 1; i < num_pts; i++)
	{
		ptsText->InsertNextPoint(i, 0, 0);
	}

	vtkStringArray *strings = vtkStringArray::New();
	strings->SetNumberOfValues(num_pts);
	strings->SetName("labels");
	for (int i = 1; i < 5; i++)
	{
		strings->InsertNextValue("bob");
	}
	for (int i = 5; i < 10; i++)
	{
		strings->InsertNextValue("bob2");
	}
	
	vtkPolyData *polydata = vtkPolyData::New();
	polydata->SetPoints(ptsText);
	polydata->GetFieldData()->AddArray(strings);

	vtkDynamic2DLabelMapper *labeledDataMapper =
vtkDynamic2DLabelMapper::New();
		
	labeledDataMapper->SetInputData(polydata);
	labeledDataMapper->SetLabelModeToLabelFieldData();
	labeledDataMapperBis->SetFieldDataName(strings->GetName());
	
	vtkActor2D *actorText = vtkActor2D::New();
	actorText->SetMapper(labeledDataMapper);


Do you see where the problem come from ? 

Thanks

Olivier



--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-slow-to-display-300-vtkArrowSource-in-real-time-tp5740730p5740797.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list