[vtkusers] how to get information about picked actors from vtkAreaPicker when vtkAssembly is picked up

Alex Malyushytskyy alexmalvtk at gmail.com
Tue Dec 8 21:23:38 EST 2009


Hi,

I successfully was able to perform area pick with vtkAreaPicker AreaPick.
Now I need to determine which actors were picked.

All my actors are added to vtkPropAssembly and this property assembly
is added to the renderer,
picking is successfully initiated and in callback on EndPickEvent I
can get  pointer to vtkPropAssembly.


		vtkProp3DCollection* collection = areaPicker->GetProp3Ds();
		if( collection )
		{
			vtkPropAssembly* assembly;
			vtkActor* actor;
			vtkProp3D *prop3D;
			vtkAssemblyPath *path;

			vtkCollectionSimpleIterator p3dit;
			for (collection->InitTraversal(p3dit); (prop3D =
collection->GetNextProp3D(p3dit)); )
			{
				if ( prop3D != NULL )
				{
					qDebug() << "prop3D->GetClassName()" << prop3D->GetClassName() <<
(void*) prop3D;

					actor = vtkActor::SafeDownCast( prop3D );
					if(  actor ) // FALSE in my case
					{
						qDebug() << "actor->GetClassName()" << actor->GetClassName() <<
(void*) actor;
						continue;
					}

					assembly = vtkPropAssembly::SafeDownCast( prop3D ); // I

					if( assembly ) // TRUE
					{

						if ( propAssembly() == assembly )
						{
							qDebug() << " we got propAssembly() which has all actors picked";
						}
        ......................


Question is how I can get actors which geometry were inside frustum at
least partially.
I definitely could find all the actors which belong to assembly with:

						if ( selectionType == 0 )
						{ // this select all actors in assembly, even though such actors
are not picked
							vtkPropCollection* propCollection = assembly->GetParts();
							if( propCollection )
							{
								vtkProp* prop;
								vtkCollectionSimpleIterator pit;
								for ( propCollection->InitTraversal(pit); (prop =
propCollection->GetNextProp(pit)); )
								{
									qDebug() << "prop->GetClassName()" << prop->GetClassName() <<
(void*) prop;
									actor = vtkActor::SafeDownCast( prop );
									if(  actor )
									{
										qDebug() << "actor->GetClassName()" << actor->GetClassName()
<< (void*) actor;
										updateSelectionForActor( actor );
									}
								}
							}
						}


But above code will select  all actors in assembly, even though such
actors are not picked.
I probably missing something trivial.

So a few questions:

1. Is it possible to get actors inside frustum if such actors are
added to the vtkPropAssembly and are not directly added to renderer?
2. If it is possible how?


Many thanks for your time and help,
         Alex



More information about the vtkusers mailing list