42cf5bc1 |
1 | // Created on: 1998-03-26 |
2 | // Created by: Robert COUBLANC |
3 | // Copyright (c) 1998-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 _SelectMgr_SortCriterion_HeaderFile |
18 | #define _SelectMgr_SortCriterion_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Integer.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | |
28 | |
29 | //! This class provides data and criterion for sorting candidate |
30 | //! entities in the process of interactive selection by mouse click |
31 | class SelectMgr_SortCriterion |
32 | { |
33 | public: |
34 | |
35 | DEFINE_STANDARD_ALLOC |
36 | |
37 | |
38 | Standard_EXPORT SelectMgr_SortCriterion(); |
39 | |
40 | //! Defines parameters of selection criterion: |
41 | //! - Priority: selection priority |
42 | //! - Depth: distance from the view plane to the entity |
43 | //! - MinDist: distance from the clicked point to the entity on the view plane |
44 | //! - Tol: tolerance used for selecting candidates |
45 | //! - PreferClosest: specify whether closest object is preferred even if |
46 | //! if has less priority |
47 | Standard_EXPORT SelectMgr_SortCriterion(const Standard_Integer thePriority, const Standard_Real theDepth, const Standard_Real theMinDist, const Standard_Real theTol, const Standard_Boolean PreferClosest); |
48 | |
49 | void SetPriority (const Standard_Integer P); |
50 | |
51 | void SetDepth (const Standard_Real D); |
52 | |
53 | void SetMinDist (const Standard_Real D); |
54 | |
55 | void SetTol (const Standard_Real T); |
56 | |
57 | Standard_Integer Priority() const; |
58 | |
59 | Standard_Real Depth() const; |
60 | |
61 | Standard_Real MinDist() const; |
62 | |
63 | Standard_Real Tol() const; |
64 | |
65 | Standard_EXPORT Standard_Boolean IsGreater (const SelectMgr_SortCriterion& anOtherCriterion) const; |
66 | Standard_Boolean operator > (const SelectMgr_SortCriterion& anOtherCriterion) const |
67 | { |
68 | return IsGreater(anOtherCriterion); |
69 | } |
70 | |
71 | Standard_EXPORT Standard_Boolean IsLower (const SelectMgr_SortCriterion& anOtherCriterion) const; |
72 | Standard_Boolean operator < (const SelectMgr_SortCriterion& anOtherCriterion) const |
73 | { |
74 | return IsLower(anOtherCriterion); |
75 | } |
76 | |
77 | |
78 | |
79 | |
80 | protected: |
81 | |
82 | |
83 | |
84 | |
85 | |
86 | private: |
87 | |
88 | |
89 | |
90 | Standard_Integer myPrior; |
91 | Standard_Real myDepth; |
92 | Standard_Real myDist; |
93 | Standard_Real myTol; |
94 | Standard_Boolean myPreferClosest; |
95 | |
96 | |
97 | }; |
98 | |
99 | |
100 | #include <SelectMgr_SortCriterion.lxx> |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | #endif // _SelectMgr_SortCriterion_HeaderFile |