<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#ffffff">
Hello, <br>
<br>
I would like to access information about an object from the actor.<br>
It is working but it is very inefficient and I would like to improve
it.<br>
<br>
Let's say I have a polydata which represent the object #9.<br>
When I click on the associated actor, I would like to know that it
is object #9.<br>
<br>
So far, I am storing the object ID in an array.<br>
<br>
<small>//----------------------------------------------------------<br>
// FILL THE POLYDATA<br>
vtkPolydata* myPolyData; // Object #9<br>
vtkDataArray* array;<br>
array->SetName("ID");<br>
for(int i=0; i<</small><small>myPolyData</small><small>->GetNumberOfPoints();
++i)<br>
{<br>
</small><small>array</small><small>->InsertNextValue(ObjectID);<br>
}<br>
myPolyData->GetPointData()->AddArray( </small><small>array</small><small>
);<br>
</small><br>
<small>// APPLY FILTER</small><br>
<small>vtkCutter* myCutter;<br>
cutter->SetInput(myPolyData);<br>
cutter->SetCutFunction(myCutFunction);<br>
<br>
//ADD TO VISU<br>
</small><small>vtkMapper* myMapper;<br>
vtkActor* myActor;</small><br>
<small>mapper->SetInput( cutter->GetOutput() );<br>
actor->setMapper(mapper);<br>
</small><small>//----------------------------------------------------------</small><br>
<br>
I can then access it:<br>
<br>
<small>//----------------------------------------------------------</small><br>
<small>actor->GetMapper()->GetInput()->GetPointData()->GetArray("ID")</small>;<br>
<small>//----------------------------------------------------------</small><br>
<br>
The problem is that filling such an array if you have thousands of
polydatas (500 points each) is quite time consuming.<br>
<br>
Would somebody have any recommendation? I guess the best practice
would be to add the information directly in the actor but I couldn't
figure out how to proceed.<br>
<br>
Thanks,<br>
<br>
<br>
Nicolas<br>
</body>
</html>