b311480e |
1 | // Created on: 1993-06-23 |
2 | // Created by: Jean Yves LEBEY |
3 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
18 | #include <gp_Pnt.hxx> |
19 | #include <TopoDS_Shape.hxx> |
20 | #include <TopOpeBRepDS_Point.hxx> |
7fd59977 |
21 | #include <TopOpeBRepTool_ShapeTool.hxx> |
22 | |
23 | //======================================================================= |
24 | //function : TopOpeBRepDS_Point |
25 | //purpose : |
26 | //======================================================================= |
7fd59977 |
27 | TopOpeBRepDS_Point::TopOpeBRepDS_Point() |
28 | : myKeep(Standard_True) |
29 | { |
30 | } |
31 | |
32 | |
33 | //======================================================================= |
34 | //function : TopOpeBRepDS_Point |
35 | //purpose : |
36 | //======================================================================= |
37 | |
38 | TopOpeBRepDS_Point::TopOpeBRepDS_Point(const gp_Pnt& P, |
39 | const Standard_Real T) |
40 | : myPoint(P), |
41 | myTolerance(T), |
42 | myKeep(Standard_True) |
43 | { |
44 | } |
45 | |
46 | |
47 | //======================================================================= |
48 | //function : TopOpeBRepDS_Point |
49 | //purpose : |
50 | //======================================================================= |
51 | |
52 | TopOpeBRepDS_Point::TopOpeBRepDS_Point(const TopoDS_Shape& S) |
53 | { |
54 | myPoint = TopOpeBRepTool_ShapeTool::Pnt(S); |
55 | myTolerance = TopOpeBRepTool_ShapeTool::Tolerance(S); |
56 | } |
57 | |
58 | |
59 | //======================================================================= |
60 | //function : IsEqual |
61 | //purpose : |
62 | //======================================================================= |
63 | |
64 | Standard_Boolean TopOpeBRepDS_Point::IsEqual(const TopOpeBRepDS_Point& P) const |
65 | { |
66 | Standard_Real t = Max(myTolerance,P.Tolerance()); |
67 | Standard_Boolean b = myPoint.IsEqual(P.Point(),t); |
68 | return b; |
69 | } |
70 | |
71 | |
72 | //======================================================================= |
73 | //function : Point |
74 | //purpose : |
75 | //======================================================================= |
76 | |
77 | const gp_Pnt& TopOpeBRepDS_Point::Point()const |
78 | { |
79 | return myPoint; |
80 | } |
81 | |
82 | //======================================================================= |
83 | //function : ChangePoint |
84 | //purpose : |
85 | //======================================================================= |
86 | |
87 | gp_Pnt& TopOpeBRepDS_Point::ChangePoint() |
88 | { |
89 | return myPoint; |
90 | } |
91 | |
92 | |
93 | //======================================================================= |
94 | //function : Tolerance |
95 | //purpose : |
96 | //======================================================================= |
97 | |
98 | Standard_Real TopOpeBRepDS_Point::Tolerance()const |
99 | { |
100 | return myTolerance; |
101 | } |
102 | |
103 | //======================================================================= |
104 | //function : Tolerance |
105 | //purpose : |
106 | //======================================================================= |
107 | |
108 | void TopOpeBRepDS_Point::Tolerance(const Standard_Real Tol) |
109 | { |
110 | myTolerance = Tol; |
111 | } |
112 | |
113 | //======================================================================= |
114 | //function : Keep |
115 | //purpose : |
116 | //======================================================================= |
117 | |
118 | Standard_Boolean TopOpeBRepDS_Point::Keep() const |
119 | { |
120 | return myKeep; |
121 | } |
122 | //======================================================================= |
123 | //function : ChangeKeep |
124 | //purpose : |
125 | //======================================================================= |
126 | |
127 | void TopOpeBRepDS_Point::ChangeKeep(const Standard_Boolean b) |
128 | { |
129 | myKeep = b; |
130 | } |