Version: 9.16.0
SVTK_AreaPicker.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
6// This library is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 2.1 of the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public
17// License along with this library; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23// SALOME VTKViewer : build VTK viewer into Salome desktop
24// File : SVTK_AreaPicker.h
25// Author :
26// Module : SALOME
27//
28#ifndef __SVTK_AreaPicker_h
29#define __SVTK_AreaPicker_h
30
31#include "SVTK.h"
32#include "VTKViewer.h"
33
34#include <map>
35#include <vector>
36
37#include <vtkAbstractPropPicker.h>
38#include <vtkDataSet.h>
39#include <QVector>
40#include <QPoint>
41
42class vtkRenderer;
43
44#ifdef WIN32
45#pragma warning ( disable:4251 )
46#endif
47
55{
56 public:
57
58 enum SelectionMode { RectangleMode, PolygonMode };
59
60 static
62
64
65
70 vtkSetMacro(Tolerance,double);
71 vtkGetMacro(Tolerance,double);
72
74 vtkSetMacro(PickPoints,int);
75 vtkGetMacro(PickPoints,int);
76 vtkBooleanMacro(PickPoints,int);
77
78 int
79 Pick( QVector<QPoint>& thePoints,
80 vtkRenderer *theRenderer,
81 SelectionMode theMode );
82
83 int
84 Pick( double theSelectionX,
85 double theSelectionY,
86 double theSelectionX2,
87 double theSelectionY2,
88 vtkRenderer *theRenderer,
89 SelectionMode theMode );
90
91 static bool
92 isPointInPolygon( const QPoint& thePoint,const QVector<QPoint>& thePolygon );
93
94 typedef std::vector<vtkIdType> TVectorIds;
95 typedef std::map<vtkActor*,TVectorIds> TVectorIdsMap;
96
97 const TVectorIdsMap&
98 GetPointIdsMap() const;
99
100 const TVectorIdsMap&
101 GetCellIdsMap() const;
102
103 protected:
106
108 double Tolerance;
109
111 int PickPoints;
112
114 int mySelection[4];
115
116 TVectorIdsMap myPointIdsMap;
117 TVectorIdsMap myCellIdsMap;
118
119 private:
120 virtual
121 int
122 Pick(double,
123 double,
124 double,
125 vtkRenderer*);
126
127 void
128 SelectVisiblePoints( QVector<QPoint>& thePoints,
129 vtkRenderer *theRenderer,
130 vtkDataSet *theInput,
131 SVTK_AreaPicker::TVectorIds& theVisibleIds,
132 SVTK_AreaPicker::TVectorIds& theInVisibleIds,
133 double theTolerance,
134 SelectionMode theMode );
135 void
136 SelectVisibleCells( QVector<QPoint>& thePoints,
137 vtkRenderer *theRenderer,
138 vtkDataSet *theInput,
139 SVTK_AreaPicker::TVectorIds& theVectorIds,
140 double theTolerance,
141 SelectionMode theMode );
142};
143
144#ifdef WIN32
145#pragma warning ( default:4251 )
146#endif
147
148#endif
149
150
#define SVTK_EXPORT
Definition: SVTK.h:37
Rectangular picker class.
Definition: SVTK_AreaPicker.h:55
SelectionMode
Definition: SVTK_AreaPicker.h:58
std::map< vtkActor *, TVectorIds > TVectorIdsMap
Definition: SVTK_AreaPicker.h:95
static SVTK_AreaPicker * New()
vtkTypeMacro(SVTK_AreaPicker, vtkAbstractPropPicker) vtkSetMacro(Tolerance
std::vector< vtkIdType > TVectorIds
Definition: SVTK_AreaPicker.h:94
For more information see VTK documentation.