48c428322da8c1e5b6ba532b8f1beba669ab2269
[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_SequenceOfStructure.hxx>
25 #include <Graphic3d_SequenceOfHClipPlane.hxx>
26 #include <SelectMgr_ViewerSelector.hxx>
27 #include <SelectMgr_Selection.hxx>
28 #include <NCollection_Handle.hxx>
29
30 class Graphic3d_Group;
31 class Graphic3d_Structure;
32 class Graphic3d_TransformPers;
33 class V3d_View;
34 class SelectMgr_EntityOwner;
35 class SelectMgr_SelectableObjectSet;
36
37
38 //! Selector Usable by Viewers from V3d
39 class StdSelect_ViewerSelector3d : public SelectMgr_ViewerSelector
40 {
41
42 public:
43
44   //! Constructs an empty 3D selector object.
45   Standard_EXPORT StdSelect_ViewerSelector3d();
46
47   //! Sets the pixel tolerance <theTolerance>.
48   Standard_EXPORT void SetPixelTolerance (const Standard_Integer theTolerance);
49
50   //! Returns the pixel tolerance.
51   inline Standard_Integer PixelTolerance() const;
52
53   //! Picks the sensitive entity at the pixel coordinates of
54   //! the mouse <theXPix> and <theYPix>. The selector looks for touched areas and owners.
55   Standard_EXPORT void Pick (const Standard_Integer theXPix,
56                              const Standard_Integer theYPix,
57                              const Handle(V3d_View)& theView);
58
59   //! Picks the sensitive entity according to the minimum
60   //! and maximum pixel values <theXPMin>, <theYPMin>, <theXPMax>
61   //! and <theYPMax> defining a 2D area for selection in the 3D view aView.
62   Standard_EXPORT void Pick (const Standard_Integer theXPMin,
63                              const Standard_Integer theYPMin,
64                              const Standard_Integer theXPMax,
65                              const Standard_Integer theYPMax,
66                              const Handle(V3d_View)& theView);
67
68   //! pick action - input pixel values for polyline selection for selection.
69   Standard_EXPORT void Pick (const TColgp_Array1OfPnt2d& thePolyline,
70                              const Handle(V3d_View)& theView);
71
72   //! Displays sensitives in view <theView>.
73   Standard_EXPORT void DisplaySensitive (const Handle(V3d_View)& theView);
74   
75   Standard_EXPORT void ClearSensitive (const Handle(V3d_View)& theView);
76   
77   Standard_EXPORT void DisplaySensitive (const Handle(SelectMgr_Selection)& theSel,
78                                          const gp_Trsf& theTrsf,
79                                          const Handle(V3d_View)& theView,
80                                          const Standard_Boolean theToClearOthers = Standard_True);
81
82   Standard_EXPORT virtual Standard_Boolean HasDepthClipping (const Handle(SelectMgr_EntityOwner)& theOwner) const Standard_OVERRIDE;
83
84   DEFINE_STANDARD_RTTIEXT(StdSelect_ViewerSelector3d,SelectMgr_ViewerSelector)
85
86 protected:
87
88   Standard_EXPORT void computeSensitivePrs (const Handle(Graphic3d_Structure)& theStructure,
89                                             const Handle(SelectMgr_Selection)& theSel,
90                                             const gp_Trsf& theLoc,
91                                             const Handle(Graphic3d_TransformPers)& theTrsfPers);
92
93   //! Update z-layers order map.
94   Standard_EXPORT void updateZLayers (const Handle(V3d_View)& theView);
95
96 protected:
97
98   Graphic3d_SequenceOfStructure myStructs;
99 };
100
101 DEFINE_STANDARD_HANDLE(StdSelect_ViewerSelector3d, SelectMgr_ViewerSelector)
102
103 #include <StdSelect_ViewerSelector3d.lxx>
104
105 #endif