[Paraview] [vtkusers] vtkSelection

David E DeMarle dave.demarle at kitware.com
Thu Nov 13 11:56:04 EST 2008


Look carefully at TestExtraction.cxx, it sets up a selection of each
type in turn.
For instance:
  sel->Clear();
  ext->PreserveTopologyOff();
  sel->GetProperties()->Set(
    vtkSelection::CONTENT_TYPE(), vtkSelection::FRUSTUM);
  vtkDoubleArray *frustcorners = vtkDoubleArray::New();
  frustcorners->SetNumberOfComponents(4);
  frustcorners->SetNumberOfTuples(8);
  //a small frustum within the 3 lower left (-X,-Y) cells
  frustcorners->SetTuple4(0,  0.1, 0.1,  3.1, 0.0);
  frustcorners->SetTuple4(1,  0.1, 0.1, 0.1, 0.0);
  frustcorners->SetTuple4(2,  0.1,  0.9,  3.1, 0.0);
  frustcorners->SetTuple4(3,  0.1,  0.9, 0.1, 0.0);
  frustcorners->SetTuple4(4,  0.9, 0.1,  3.1, 0.0);
  frustcorners->SetTuple4(5,  0.9, 0.1, 0.1, 0.0);
  frustcorners->SetTuple4(6,  0.9,  0.9,  3.1, 0.0);
  frustcorners->SetTuple4(7,  0.9,  0.9, 0.1, 0.0);
  sel->SetSelectionList(frustcorners);
  frustcorners->Delete();

I think you can get the points from AreaPicker::GetClipPoints().


On Thu, Nov 13, 2008 at 11:37 AM, Bryn Lloyd <blloyd at vision.ee.ethz.ch> wrote:
> Hi David,
>
> Thanks a lot for your reply.
>
>>
>> You might not need to use AreaPicker. It's job is to pick entire
>> Props, you seem more interested in cells and points on a particular
>> prop. VisibleCellSelector can determine props on its own if you want
>> it to, and the FrustumExtractor could be reapplied to all the props in
>> the scene if you don't end up using AreaPicker to narrow down the
>> list.
>>
>> The InteractorStyle is useful for giving the user a rubber band to
>> draw on the screen with, so you might as well use that part.
>> Converting that 2D rectangle into a 3D rectangle is only needed if you
>> are selecting through. The AreaPicker can help with that if you need
>> it.
>
> I need to select through (i.e. non-visible). So I could use the AreaPicker
> to calculate the Frustum and pass it to the vtkExtractSelectedFrustum object
> in order to select the points or cells?
>
> So vtkExtractSelectedFrustum knows the Frustum, how do I setup the
> vtkSelection object?
>
> My guess is:
>
>  selection->SetContentType(vtkSelection::FRUSTUM);
>  if(mode==POINTS)
>    selection->SetFieldType(vtkSelection::POINT);
>  else
>    selection->SetFieldType(vtkSelection::CELL);
>
> But what about the SetSelectionList? Is this where I need to set the
> parameters of the Frustum (again)?, or will vtkExtractSelectedFrustum ignore
> this list, since it already knows the Frustum?
>
>
>
>> Take a look at TestExtraction first to investigate what Selections and
>> Extraction are and how to use them,
>>
>> Then take a look at TestAreaSelections to see how to use them to grab
>> things that the user identifies behind the rubber band.
>
> I have looked at these tests, and the java example
> Examples/Infovis/Java/Focus.java.
>
> There are, however, many different combinations of
> vtkSelection::SetContentType, vtkSelection::SetFieldType and it is not clear
> how the SelectionList must be created for each situation, or if it must be
> set at all.
>
>
> Thanks,
>
> Bryn
>
>
>
>
>
>



-- 
David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109


More information about the ParaView mailing list