#include <vtkVisibleCellSelector.h>
DEPRECATED: Please refer to vtkHardwareSelector instead. This class can be used to determine what cells are visible within a given rectangle of the RenderWindow. To use it, call in order, SetRenderer(), SetArea(), SetProcessorId(), SetRenderPasses(), and then Select(). Select will cause the attached vtkRenderer to render in a special color mode, where each cell is given it own color so that later inspection of the Rendered Pixels can determine what cells are visible. In practice up to five different rendering passes may occur depending on your choices in SetRenderPasses. After Select(), a list of the visible cells can be obtained by calling GetSelectedIds().
Limitations: Antialiasing will break this class. If your graphics card settings force their use this class will return invalid results.
Currently only cells from PolyDataMappers can be selected from. When vtkRenderer is put into a SelectMode, it temporarily swaps in a new vtkIdentColoredPainter to do the color index rendering of each cell in each vtkProp that it renders. Until alternatives to vtkIdentColoredPainter exist that can do a similar coloration of other vtkDataSet types, only polygonal data can be selected. If you need to select other data types, consider using vtkDataSetMapper and turning on it's PassThroughCellIds feature, or using vtkFrustumExtractor.
Only Opaque geometry in Actors is selected from. Assemblies and LODMappers are not currently supported.
During selection, visible datasets that can not be selected from are temporarily hidden so as not to produce invalid indices from their colors.
Definition at line 67 of file vtkVisibleCellSelector.h.
Public Types | |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
void | PrintSelf (ostream &os, vtkIndent indent) |
virtual void | SetRenderer (vtkRenderer *) |
void | Select () |
void | GetSelectedIds (vtkIdTypeArray *ToCopyInto) |
void | GetSelectedIds (vtkSelection *ToCopyInto) |
vtkProp * | GetActorFromId (vtkIdType id) |
void | PrintSelectedIds (vtkIdTypeArray *IdsToPrint) |
void | SetArea (unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1) |
void | GetArea (unsigned int &x0, unsigned int &y0, unsigned int &x1, unsigned int &y1) |
virtual void | SetProcessorId (unsigned int pid) |
virtual unsigned int | GetProcessorId () |
void | SetRenderPasses (int DoProcessor, int DoActor, int DoCellIdHi, int DoCellIdMid, int DoCellIdLo, int DoVertexId=0) |
void | GetSelectedVertices (vtkIdTypeArray *VertexPointers, vtkIdTypeArray *VertexIds) |
void | GetPixelSelection (int displayPos[2], vtkIdType &procId, vtkIdType &cellId, vtkIdType &vertId, vtkProp *&actorPtr) |
Static Public Member Functions | |
static int | IsTypeOf (const char *type) |
static vtkVisibleCellSelector * | SafeDownCast (vtkObject *o) |
static vtkVisibleCellSelector * | New () |
Protected Member Functions | |
vtkVisibleCellSelector () | |
~vtkVisibleCellSelector () | |
void | SavePixelBuffer (int pass, unsigned char *src) |
void | ComputeSelectedIds () |
void | SetSelectMode (int mode) |
void | SetSelectConst (unsigned int constant) |
void | SetIdentPainter (vtkIdentColoredPainter *) |
Protected Attributes | |
vtkRenderer * | Renderer |
int | DoProcessor |
int | DoActor |
int | DoCellIdHi |
int | DoCellIdMid |
int | DoCellIdLo |
int | DoVertices |
unsigned int | ProcessorId |
unsigned int | X0 |
unsigned int | Y0 |
unsigned int | X1 |
unsigned int | Y1 |
unsigned char * | PixBuffer [6] |
vtkIdentColoredPainter * | IdentPainter |
vtkIdTypeArray * | SelectedIds |
vtkIntArray * | PixelCounts |
vtkIdTypeArray * | VertexPointers |
vtkIdTypeArray * | VertexLists |
vtkVisibleCellSelector::vtkVisibleCellSelector | ( | ) | [protected] |
vtkVisibleCellSelector::~vtkVisibleCellSelector | ( | ) | [protected] |
virtual const char* vtkVisibleCellSelector::GetClassName | ( | ) | [virtual] |
Reimplemented from vtkObject.
static int vtkVisibleCellSelector::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
virtual int vtkVisibleCellSelector::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
static vtkVisibleCellSelector* vtkVisibleCellSelector::SafeDownCast | ( | vtkObject * | o | ) | [static] |
Reimplemented from vtkObject.
void vtkVisibleCellSelector::PrintSelf | ( | ostream & | os, | |
vtkIndent | indent | |||
) | [virtual] |
static vtkVisibleCellSelector* vtkVisibleCellSelector::New | ( | ) | [static] |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Reimplemented from vtkObject.
virtual void vtkVisibleCellSelector::SetRenderer | ( | vtkRenderer * | ) | [virtual] |
Call to let this know where to select within.
void vtkVisibleCellSelector::SetArea | ( | unsigned int | x0, | |
unsigned int | y0, | |||
unsigned int | x1, | |||
unsigned int | y1 | |||
) |
Call to set the selection area region. This crops the selected area to the renderers pixel limits.
void vtkVisibleCellSelector::GetArea | ( | unsigned int & | x0, | |
unsigned int & | y0, | |||
unsigned int & | x1, | |||
unsigned int & | y1 | |||
) |
The caller of SetArea can use to check for cropped limits.
virtual void vtkVisibleCellSelector::SetProcessorId | ( | unsigned int | pid | ) | [virtual] |
Call to let this know what processor number to render as in the processor select pass. Internally this adds 1 to pid because 0 is reserved for miss.
virtual unsigned int vtkVisibleCellSelector::GetProcessorId | ( | ) | [virtual] |
Call to let this know what processor number to render as in the processor select pass. Internally this adds 1 to pid because 0 is reserved for miss.
void vtkVisibleCellSelector::SetRenderPasses | ( | int | DoProcessor, | |
int | DoActor, | |||
int | DoCellIdHi, | |||
int | DoCellIdMid, | |||
int | DoCellIdLo, | |||
int | DoVertexId = 0 | |||
) |
Call to let this know what selection render passes to do. If you have only one processor or one actor, you can leave DoProcessor and DoActor as false (the default). If you have less than 2^48 cells in any actor, you do not need the CellIdHi pass, or similarly if you have less than 2^24 cells, you do not need DoCellIdMid. The DoPointId will enable another render pass for determining visible vertices.
void vtkVisibleCellSelector::Select | ( | ) |
Execute the selection algorithm.
void vtkVisibleCellSelector::GetSelectedIds | ( | vtkIdTypeArray * | ToCopyInto | ) |
After Select(), this will return the list of selected Ids. The ProcessorId and Actor Id are returned in the first two components. The CellId is returned in the last two components (only 64 bits total).
void vtkVisibleCellSelector::GetSelectedIds | ( | vtkSelection * | ToCopyInto | ) |
After Select(), this will return the list of selected Ids.
void vtkVisibleCellSelector::GetSelectedVertices | ( | vtkIdTypeArray * | VertexPointers, | |
vtkIdTypeArray * | VertexIds | |||
) |
After Select(), (assuming DoVertexId is on), the will return arrays that describe which cell vertices are visible. The VertexPointers array contains one index into the VertexIds array for every visible cell. Any index may be -1 in which case no vertices were visible for that cell. The VertexIds array contains a set of integers for each cell that has visible vertices. The first entry in the set is the number of visible vertices. The rest are visible vertex ranks. A set such at 2,0,4, means that a particular polygon's first and fifth vertices were visible.
After a select, this will return a pointer to the actor corresponding to a particular id. This will return NULL if id is out of range.
void vtkVisibleCellSelector::PrintSelectedIds | ( | vtkIdTypeArray * | IdsToPrint | ) |
For debugging - prints out the list of selected ids.
void vtkVisibleCellSelector::GetPixelSelection | ( | int | displayPos[2], | |
vtkIdType & | procId, | |||
vtkIdType & | cellId, | |||
vtkIdType & | vertId, | |||
vtkProp *& | actorPtr | |||
) |
Get the cellId, vertexIds, actor, processor rendering the actor at a given display position. Makes sense only after Select() has been called.
void vtkVisibleCellSelector::SavePixelBuffer | ( | int | pass, | |
unsigned char * | src | |||
) | [protected] |
Give this a selected region of the render window after a selection render with one of the passes defined above.
void vtkVisibleCellSelector::ComputeSelectedIds | ( | ) | [protected] |
After one or more calls to SavePixelBuffer(), this will convert the saved pixel buffers into a list of Ids.
void vtkVisibleCellSelector::SetSelectMode | ( | int | mode | ) | [protected] |
Simply calls this->Renderer's method of the same name.
void vtkVisibleCellSelector::SetSelectConst | ( | unsigned int | constant | ) | [protected] |
void vtkVisibleCellSelector::SetIdentPainter | ( | vtkIdentColoredPainter * | ) | [protected] |
vtkRenderer* vtkVisibleCellSelector::Renderer [protected] |
Definition at line 174 of file vtkVisibleCellSelector.h.
int vtkVisibleCellSelector::DoProcessor [protected] |
Definition at line 176 of file vtkVisibleCellSelector.h.
int vtkVisibleCellSelector::DoActor [protected] |
Definition at line 177 of file vtkVisibleCellSelector.h.
int vtkVisibleCellSelector::DoCellIdHi [protected] |
Definition at line 178 of file vtkVisibleCellSelector.h.
int vtkVisibleCellSelector::DoCellIdMid [protected] |
Definition at line 179 of file vtkVisibleCellSelector.h.
int vtkVisibleCellSelector::DoCellIdLo [protected] |
Definition at line 180 of file vtkVisibleCellSelector.h.
int vtkVisibleCellSelector::DoVertices [protected] |
Definition at line 181 of file vtkVisibleCellSelector.h.
unsigned int vtkVisibleCellSelector::ProcessorId [protected] |
Definition at line 183 of file vtkVisibleCellSelector.h.
unsigned int vtkVisibleCellSelector::X0 [protected] |
Definition at line 185 of file vtkVisibleCellSelector.h.
unsigned int vtkVisibleCellSelector::Y0 [protected] |
Definition at line 186 of file vtkVisibleCellSelector.h.
unsigned int vtkVisibleCellSelector::X1 [protected] |
Definition at line 187 of file vtkVisibleCellSelector.h.
unsigned int vtkVisibleCellSelector::Y1 [protected] |
Definition at line 188 of file vtkVisibleCellSelector.h.
unsigned char* vtkVisibleCellSelector::PixBuffer[6] [protected] |
Definition at line 191 of file vtkVisibleCellSelector.h.
vtkIdTypeArray* vtkVisibleCellSelector::SelectedIds [protected] |
The results of the selection: processorIds, ActorIds, CellIds.
Definition at line 195 of file vtkVisibleCellSelector.h.
vtkIntArray* vtkVisibleCellSelector::PixelCounts [protected] |
The results of the selection: processorIds, ActorIds, CellIds.
Definition at line 196 of file vtkVisibleCellSelector.h.
vtkIdTypeArray* vtkVisibleCellSelector::VertexPointers [protected] |
The results of the selection: processorIds, ActorIds, CellIds.
Definition at line 197 of file vtkVisibleCellSelector.h.
vtkIdTypeArray* vtkVisibleCellSelector::VertexLists [protected] |
The results of the selection: processorIds, ActorIds, CellIds.
Definition at line 198 of file vtkVisibleCellSelector.h.
Definition at line 201 of file vtkVisibleCellSelector.h.