0024057: Eliminate compiler warning C4100 in MSVC++ with warning level 4
[occt.git] / src / Select3D / Select3D_SensitiveEntity.cxx
CommitLineData
b311480e 1// Created on: 1995-03-13
2// Created by: Robert COUBLANC
3// Copyright (c) 1995-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
7fd59977 22
23
24
25#include <Select3D_SensitiveEntity.ixx>
26#include <Precision.hxx>
27#include <SelectBasics_EntityOwner.hxx>
28#include <Select3D_Macro.hxx>
29
30//=======================================================================
31//function : Select3D_SensitiveEntity
32//purpose :
33//=======================================================================
34
35Select3D_SensitiveEntity::Select3D_SensitiveEntity(const Handle(SelectBasics_EntityOwner)& OwnerId):
36SelectBasics_SensitiveEntity(OwnerId),
4952a30a 37mylastprj(),
38mylastdepth(ShortRealLast())
7fd59977 39{}
40
41//=======================================================================
42//function : Project
43//purpose :
44//=======================================================================
45
4952a30a 46void Select3D_SensitiveEntity::Project(const Handle(Select3D_Projector)& aPrj)
7fd59977 47{
4952a30a 48 mylastprj = aPrj;
7fd59977 49}
50
51//=======================================================================
52//function : Matches
53//purpose :
54//=======================================================================
55
56Standard_Boolean Select3D_SensitiveEntity::Matches(const Standard_Real X,
ac04d101 57 const Standard_Real Y,
35e08fe8 58 const Standard_Real /*aTol*/,
59 Standard_Real& /*DMin*/)
7fd59977 60{
4952a30a 61 if (!mylastprj.IsNull())
62 {
63 gp_Lin L = mylastprj->Shoot (X, Y);
64 SetLastDepth (ComputeDepth (L));
65 return (mylastdepth > mylastprj->DepthMin()) && (mylastdepth < mylastprj->DepthMax());
66 }
67 else
68 {
69 SetLastDepth (ComputeDepth (gp_Lin())); // how we determine depth without eyeline here?
70 return (mylastdepth > ShortRealFirst()) && (mylastdepth < ShortRealLast());
71 }
7fd59977 72}
73
74//=======================================================================
75//function : Matches
76//purpose :
77//=======================================================================
78
35e08fe8 79Standard_Boolean Select3D_SensitiveEntity::Matches(const Standard_Real,
80 const Standard_Real,
81 const Standard_Real,
82 const Standard_Real,
83 const Standard_Real)
7fd59977 84{
85 return Standard_False;
86}
87
88//=======================================================================
89//function : Matches
90//purpose :
91//=======================================================================
92
35e08fe8 93Standard_Boolean Select3D_SensitiveEntity::Matches(const TColgp_Array1OfPnt2d&,
94 const Bnd_Box2d&,
95 const Standard_Real)
7fd59977 96{
97 return Standard_False;
98}
99
100//=======================================================================
101//function : Dump
102//purpose :
103//=======================================================================
104
35e08fe8 105void Select3D_SensitiveEntity::Dump(Standard_OStream& S, const Standard_Boolean) const
7fd59977 106{
107 S<<"\tSensitive Entity 3D"<<endl;
108}
109
110//=======================================================================
111//function : DumpBox
112//purpose :
113//=======================================================================
114
115void Select3D_SensitiveEntity::DumpBox(Standard_OStream& S,const Bnd_Box2d& b2d)
116{
ac04d101
SA
117 if(!b2d.IsVoid())
118 {
7fd59977 119 Standard_Real xmin,ymin,xmax,ymax;
120 b2d.Get(xmin,ymin,xmax,ymax);
121 S<<"\t\t\tBox2d: PMIN ["<<xmin<<" , "<<ymin<<"]"<<endl;
122 S<<"\t\t\t PMAX ["<<xmax<<" , "<<ymax<<"]"<<endl;
123 }
7fd59977 124}
125
126//=======================================================================
127//function : ResetLocation
128//purpose :
129//=======================================================================
130
131void Select3D_SensitiveEntity::ResetLocation()
132{
133}
134
135//=======================================================================
136//function : SetLocation
137//purpose :
138//=======================================================================
139
140void Select3D_SensitiveEntity::SetLocation(const TopLoc_Location&)
141{
142}
143
144//=======================================================================
145//function : UpdateLocation
146//purpose :
147//=======================================================================
148
149void Select3D_SensitiveEntity::UpdateLocation(const TopLoc_Location& aLoc)
150{
151 if(aLoc.IsIdentity() || aLoc == Location()) return;
152 if(!HasLocation())
153 SetLocation(aLoc);
ac04d101
SA
154 else
155 {
7fd59977 156 TopLoc_Location compLoc = aLoc * Location();
ac04d101
SA
157 SetLocation(compLoc);
158 }
7fd59977 159}
160
161//=======================================================================
162//function : Location
163//purpose :
164//=======================================================================
165
166const TopLoc_Location& Select3D_SensitiveEntity::Location() const
167{
168 static TopLoc_Location anIdentity;
169 Handle(SelectBasics_EntityOwner) anOwner = OwnerId();
170 return anOwner.IsNull() ? anIdentity : anOwner->Location();
171}
172
173//=======================================================================
174//function : HasLocation
175//purpose :
176//=======================================================================
177
178Standard_Boolean Select3D_SensitiveEntity::HasLocation() const
179{
180 Handle(SelectBasics_EntityOwner) anOwner = OwnerId();
181 return (!anOwner.IsNull() && anOwner->HasLocation());
182}
183
184//=======================================================================
185//function : Is3D
186//purpose :
187//=======================================================================
188
189Standard_Boolean Select3D_SensitiveEntity::Is3D() const
190{return Standard_True;}
191
192//=======================================================================
193//function : Depth
194//purpose :
195//=======================================================================
196
197Standard_Real Select3D_SensitiveEntity::Depth() const
198{return mylastdepth;}
199
200//=======================================================================
201//function : GetEyeLine
202//purpose :
203//=======================================================================
204
205gp_Lin Select3D_SensitiveEntity::GetEyeLine(const Standard_Real X,
ac04d101 206 const Standard_Real Y) const
7fd59977 207{
208 gp_Lin L;
4952a30a 209 if (!mylastprj.IsNull())
210 {
211 L = mylastprj->Shoot (X, Y);
212 }
7fd59977 213 return L;
214}
215
216//=======================================================================
217//function : MaxBoxes
218//purpose :
219//=======================================================================
220
221Standard_Integer Select3D_SensitiveEntity::MaxBoxes() const
222{return 1;}
223
224//=======================================================================
225//function : SetLastPrj
226//purpose :
227//=======================================================================
228
4952a30a 229void Select3D_SensitiveEntity::SetLastPrj(const Handle(Select3D_Projector)& aprj)
230{ mylastprj = aprj; }
7fd59977 231
232
233//=======================================================================
234//function : GetConnected
235//purpose :
236//=======================================================================
237
238Handle(Select3D_SensitiveEntity) Select3D_SensitiveEntity::GetConnected(const TopLoc_Location&)
239{
240 Handle(Select3D_SensitiveEntity) NiouEnt;
241 return NiouEnt;
242}
243
244//=======================================================================
ac04d101 245//function : SetLastDepth
7fd59977 246//purpose :
247//=======================================================================
248void Select3D_SensitiveEntity::SetLastDepth(const Standard_Real aDepth)
249{
250 mylastdepth = DToF(aDepth);
251}