0026413: Visualization, SelectMgr_ViewerSelector - Pixel tolerance is overridden...
[occt.git] / src / StdSelect / StdSelect_ViewerSelector3d.hxx
1 // Created on: 1995-03-15
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _StdSelect_ViewerSelector3d_HeaderFile
18 #define _StdSelect_ViewerSelector3d_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22 #include <Standard_Type.hxx>
23
24 #include <Graphic3d_SequenceOfHClipPlane.hxx>
25 #include <SelectMgr_ViewerSelector.hxx>
26 #include <SelectMgr_Selection.hxx>
27 #include <NCollection_Handle.hxx>
28
29 class Graphic3d_Group;
30 class Graphic3d_Structure;
31 class V3d_View;
32 class SelectMgr_EntityOwner;
33 class SelectMgr_SelectableObjectSet;
34
35
36 //! Selector Usable by Viewers from V3d
37 class StdSelect_ViewerSelector3d : public SelectMgr_ViewerSelector
38 {
39
40 public:
41
42   //! Constructs an empty 3D selector object.
43   Standard_EXPORT StdSelect_ViewerSelector3d();
44
45   //! Sets the pixel tolerance <theTolerance>.
46   Standard_EXPORT void SetPixelTolerance (const Standard_Real theTolerance);
47
48   //! Returns the pixel tolerance.
49   Standard_Real PixelTolerance() const;
50
51   //! Picks the sensitive entity at the pixel coordinates of
52   //! the mouse <theXPix> and <theYPix>. The selector looks for touched areas and owners.
53   Standard_EXPORT void Pick (const Standard_Integer theXPix,
54                              const Standard_Integer theYPix,
55                              const Handle(V3d_View)& theView);
56
57   //! Picks the sensitive entity according to the minimum
58   //! and maximum pixel values <theXPMin>, <theYPMin>, <theXPMax>
59   //! and <theYPMax> defining a 2D area for selection in the 3D view aView.
60   Standard_EXPORT void Pick (const Standard_Integer theXPMin,
61                              const Standard_Integer theYPMin,
62                              const Standard_Integer theXPMax,
63                              const Standard_Integer theYPMax,
64                              const Handle(V3d_View)& theView);
65
66   //! pick action - input pixel values for polyline selection for selection.
67   Standard_EXPORT void Pick (const TColgp_Array1OfPnt2d& thePolyline,
68                              const Handle(V3d_View)& theView);
69
70   //! Displays sensitives in view <theView>.
71   Standard_EXPORT void DisplaySensitive (const Handle(V3d_View)& theView);
72   
73   Standard_EXPORT void ClearSensitive (const Handle(V3d_View)& theView);
74   
75   Standard_EXPORT void DisplaySensitive (const Handle(SelectMgr_Selection)& theSel,
76                                          const gp_Trsf& theTrsf,
77                                          const Handle(V3d_View)& theView,
78                                          const Standard_Boolean theToClearOthers = Standard_True);
79
80   Standard_EXPORT virtual Standard_Boolean HasDepthClipping (const Handle(SelectMgr_EntityOwner)& theOwner) const Standard_OVERRIDE;
81
82   DEFINE_STANDARD_RTTI(StdSelect_ViewerSelector3d, SelectMgr_ViewerSelector)
83
84 protected:
85
86   //! Set view clipping for the selector.
87   //! @param thePlanes [in] the view planes.
88   Standard_EXPORT void SetClipping (const Graphic3d_SequenceOfHClipPlane& thePlanes);
89
90 private:
91
92   void ComputeSensitivePrs (const Handle(SelectMgr_Selection)& theSel, const gp_Trsf& theLoc);
93
94   Handle(Graphic3d_Group) myareagroup;
95   Handle(Graphic3d_Group) mysensgroup;
96   Handle(Graphic3d_Structure) mystruct;
97   Graphic3d_SequenceOfHClipPlane myClipPlanes;
98 };
99
100 DEFINE_STANDARD_HANDLE(StdSelect_ViewerSelector3d, SelectMgr_ViewerSelector)
101
102 #include <StdSelect_ViewerSelector3d.lxx>
103
104 #endif