f751596e |
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_DefineHandle.hxx> |
23 | |
24 | #include <Handle_Graphic3d_Group.hxx> |
25 | #include <Handle_Graphic3d_Structure.hxx> |
26 | #include <Graphic3d_SequenceOfHClipPlane.hxx> |
27 | #include <SelectMgr_ViewerSelector.hxx> |
28 | #include <SelectMgr_Selection.hxx> |
29 | #include <Handle_V3d_View.hxx> |
30 | #include <Handle_SelectMgr_EntityOwner.hxx> |
31 | #include <NCollection_Handle.hxx> |
32 | |
33 | class Graphic3d_Group; |
34 | class Graphic3d_Structure; |
35 | class V3d_View; |
36 | class TColgp_Array1OfPnt2d; |
37 | class SelectMgr_EntityOwner; |
38 | class SelectMgr_SelectableObjectSet; |
39 | |
40 | |
41 | //! Selector Usable by Viewers from V3d |
42 | class StdSelect_ViewerSelector3d : public SelectMgr_ViewerSelector |
43 | { |
44 | |
45 | public: |
46 | |
47 | //! Constructs an empty 3D selector object. |
48 | Standard_EXPORT StdSelect_ViewerSelector3d(); |
49 | |
50 | //! Sets the pixel tolerance <theTolerance>. |
51 | Standard_EXPORT void SetPixelTolerance (const Standard_Real theTolerance); |
52 | |
53 | //! Returns the pixel tolerance. |
54 | Standard_Real PixelTolerance() const; |
55 | |
56 | //! Picks the sensitive entity at the pixel coordinates of |
57 | //! the mouse <theXPix> and <theYPix>. The selector looks for touched areas and owners. |
58 | Standard_EXPORT void Pick (const Standard_Integer theXPix, |
59 | const Standard_Integer theYPix, |
60 | const Handle(V3d_View)& theView); |
61 | |
62 | //! Picks the sensitive entity according to the minimum |
63 | //! and maximum pixel values <theXPMin>, <theYPMin>, <theXPMax> |
64 | //! and <theYPMax> defining a 2D area for selection in the 3D view aView. |
65 | Standard_EXPORT void Pick (const Standard_Integer theXPMin, |
66 | const Standard_Integer theYPMin, |
67 | const Standard_Integer theXPMax, |
68 | const Standard_Integer theYPMax, |
69 | const Handle(V3d_View)& theView); |
70 | |
71 | //! pick action - input pixel values for polyline selection for selection. |
72 | Standard_EXPORT void Pick (const TColgp_Array1OfPnt2d& thePolyline, |
73 | const Handle(V3d_View)& theView); |
74 | |
75 | //! Displays sensitives in view <theView>. |
76 | Standard_EXPORT void DisplaySensitive (const Handle(V3d_View)& theView); |
77 | |
78 | Standard_EXPORT void ClearSensitive (const Handle(V3d_View)& theView); |
79 | |
80 | Standard_EXPORT void DisplaySensitive (const Handle(SelectMgr_Selection)& theSel, |
81 | const gp_Trsf& theTrsf, |
82 | const Handle(V3d_View)& theView, |
83 | const Standard_Boolean theToClearOthers = Standard_True); |
84 | |
85 | //! Marks all sensitive entities, stored in viewer selector, as inactive for selection |
86 | Standard_EXPORT void ResetSelectionActivationStatus(); |
87 | |
88 | Standard_EXPORT virtual Standard_Boolean HasDepthClipping (const Handle(SelectMgr_EntityOwner)& theOwner) const Standard_OVERRIDE; |
89 | |
2157d6ac |
90 | //! Is used for rectangular selection only |
91 | //! If theIsToAllow is false, only fully included sensitives will be detected, otherwise the algorithm will |
92 | //! mark both included and overlapped entities as matched |
93 | Standard_EXPORT void AllowOverlapDetection (const Standard_Boolean theIsToAllow); |
94 | |
f751596e |
95 | DEFINE_STANDARD_RTTI(StdSelect_ViewerSelector3d) |
96 | |
97 | protected: |
98 | |
99 | //! Set view clipping for the selector. |
100 | //! @param thePlanes [in] the view planes. |
101 | Standard_EXPORT void SetClipping (const Graphic3d_SequenceOfHClipPlane& thePlanes); |
102 | |
103 | private: |
104 | |
105 | void ComputeSensitivePrs (const Handle(SelectMgr_Selection)& theSel, const gp_Trsf& theLoc); |
106 | |
107 | Handle_Graphic3d_Group myareagroup; |
108 | Handle_Graphic3d_Group mysensgroup; |
109 | Handle_Graphic3d_Structure mystruct; |
110 | Graphic3d_SequenceOfHClipPlane myClipPlanes; |
111 | }; |
112 | |
113 | DEFINE_STANDARD_HANDLE(StdSelect_ViewerSelector3d, SelectMgr_ViewerSelector) |
114 | |
115 | #include <StdSelect_ViewerSelector3d.lxx> |
116 | |
117 | #endif |