File: vtkKdTreeSelector.h

package info (click to toggle)
vtk6 6.3.0%2Bdfsg2-8.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 118,972 kB
  • sloc: cpp: 1,442,790; ansic: 113,395; python: 72,383; tcl: 46,998; xml: 8,119; yacc: 4,525; java: 4,239; perl: 3,108; lex: 1,694; sh: 1,093; asm: 154; makefile: 68; objc: 17
file content (119 lines) | stat: -rw-r--r-- 4,152 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkKdTreeSelector.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
/*----------------------------------------------------------------------------
 Copyright (c) Sandia Corporation
 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
----------------------------------------------------------------------------*/
// .NAME vtkKdTreeSelector - Selects point ids using a kd-tree.
//
// .SECTION Description
// If SetKdTree is used, the filter ignores the input and selects based on that
// kd-tree.  If SetKdTree is not used, the filter builds a kd-tree using the
// input point set and uses that tree for selection.  The output is a
// vtkSelection containing the ids found in the kd-tree using the specified
// bounds.

#ifndef vtkKdTreeSelector_h
#define vtkKdTreeSelector_h

#include "vtkFiltersSelectionModule.h" // For export macro
#include "vtkSelectionAlgorithm.h"

class vtkKdTree;

class VTKFILTERSSELECTION_EXPORT vtkKdTreeSelector : public vtkSelectionAlgorithm
{
public:
  static vtkKdTreeSelector* New();
  vtkTypeMacro(vtkKdTreeSelector, vtkSelectionAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // The kd-tree to use to find selected ids.
  // The kd-tree must be initialized with the desired set of points.
  // When this is set, the optional input is ignored.
  void SetKdTree(vtkKdTree* tree);
  vtkGetObjectMacro(KdTree, vtkKdTree);

  // Description:
  // The bounds of the form (xmin,xmax,ymin,ymax,zmin,zmax).
  // To perform a search in 2D, use the bounds
  // (xmin,xmax,ymin,ymax,VTK_DOUBLE_MIN,VTK_DOUBLE_MAX).
  vtkSetVector6Macro(SelectionBounds, double);
  vtkGetVector6Macro(SelectionBounds, double);

  // Description:
  // The field name to use when generating the selection.
  // If set, creates a VALUES selection.
  // If not set (or is set to NULL), creates a INDICES selection.
  // By default this is not set.
  vtkSetStringMacro(SelectionFieldName);
  vtkGetStringMacro(SelectionFieldName);

  // Description:
  // The field attribute to use when generating the selection.
  // If set, creates a PEDIGREEIDS or GLOBALIDS selection.
  // If not set (or is set to -1), creates a INDICES selection.
  // By default this is not set.
  // NOTE: This should be set a constant in vtkDataSetAttributes,
  // not vtkSelection.
  vtkSetMacro(SelectionAttribute, int);
  vtkGetMacro(SelectionAttribute, int);

  // Description:
  // Whether to only allow up to one value in the result.
  // The item selected is closest to the center of the bounds,
  // if there are any points within the selection threshold.
  // Default is off.
  vtkSetMacro(SingleSelection, bool);
  vtkGetMacro(SingleSelection, bool);
  vtkBooleanMacro(SingleSelection, bool);

  // Description:
  // The threshold for the single selection.
  // A single point is added to the selection if it is within
  // this threshold from the bounds center.
  // Default is 1.
  vtkSetMacro(SingleSelectionThreshold, double);
  vtkGetMacro(SingleSelectionThreshold, double);

  unsigned long GetMTime();

protected:
  vtkKdTreeSelector();
  ~vtkKdTreeSelector();

  vtkKdTree* KdTree;
  double SelectionBounds[6];
  char* SelectionFieldName;
  bool BuildKdTreeFromInput;
  bool SingleSelection;
  double SingleSelectionThreshold;
  int SelectionAttribute;

  virtual int FillInputPortInformation(
    int port, vtkInformation* info);

  int RequestData(
    vtkInformation*,
    vtkInformationVector**,
    vtkInformationVector*);

private:
  vtkKdTreeSelector(const vtkKdTreeSelector&); // Not implemented
  void operator=(const vtkKdTreeSelector&);   // Not implemented
};

#endif