0027285: Visualization - selection of AIS_MultipleConnectedInteractive is broken
[occt.git] / src / SelectMgr / SelectMgr_BaseFrustum.cxx
CommitLineData
f751596e 1// Created on: 2014-05-22
2// Created by: Varvara POSKONINA
3// Copyright (c) 2005-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#include <SelectMgr_BaseFrustum.hxx>
17
92efcf78 18IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_BaseFrustum,Standard_Transient)
19
f751596e 20//=======================================================================
21// function : SelectMgr_SelectingVolume
22// purpose : Creates new selecting volume with pixel toletance set to 2,
23// orthographic camera and empty frustum builder
24//=======================================================================
25SelectMgr_BaseFrustum::SelectMgr_BaseFrustum()
26: myPixelTolerance (2),
27 myIsOrthographic (Standard_True)
28{
29 myBuilder = new SelectMgr_FrustumBuilder();
30}
31
32//=======================================================================
33// function : SetCamera
34// purpose : Passes camera projection and orientation matrices to builder
35//=======================================================================
36void SelectMgr_BaseFrustum::SetCamera (const Handle(Graphic3d_Camera)& theCamera)
37{
825aa485 38 myBuilder->SetWorldViewMatrix (theCamera->OrientationMatrix());
39 myBuilder->SetProjectionMatrix (theCamera->ProjectionMatrix());
40 myBuilder->SetWorldViewProjState (theCamera->WorldViewProjState());
f751596e 41 myIsOrthographic = theCamera->IsOrthographic();
42 myBuilder->InvalidateViewport();
43}
44
45//=======================================================================
46// function : SetCamera
47// purpose : Passes camera projection and orientation matrices to builder
48//=======================================================================
49void SelectMgr_BaseFrustum::SetCamera (const Graphic3d_Mat4d& theProjection,
825aa485 50 const Graphic3d_Mat4d& theWorldView,
51 const Standard_Integer theIsOrthographic,
52 const Graphic3d_WorldViewProjState& theWVPState)
f751596e 53{
825aa485 54 myBuilder->SetWorldViewMatrix (theWorldView);
55 myBuilder->SetProjectionMatrix (theProjection);
56 myBuilder->SetWorldViewProjState (theWVPState);
f751596e 57 myIsOrthographic = theIsOrthographic;
58}
59
60//=======================================================================
825aa485 61// function : ProjectionMatrix
62// purpose : Returns current camera projection transformation common for
63// all selecting volumes
64//=======================================================================
65const Graphic3d_Mat4d& SelectMgr_BaseFrustum::ProjectionMatrix() const
66{
67 return myBuilder->ProjectionMatrix();
68}
69
70//=======================================================================
71// function : WorldViewMatrix
72// purpose : Returns current camera world view transformation common for
73// all selecting volumes
74//=======================================================================
75const Graphic3d_Mat4d& SelectMgr_BaseFrustum::WorldViewMatrix() const
76{
77 return myBuilder->WorldViewMatrix();
78}
79
80//=======================================================================
81// function : WorldViewProjState
82// purpose : Returns current camera world view projection transformation
83// state
84//=======================================================================
85const Graphic3d_WorldViewProjState& SelectMgr_BaseFrustum::WorldViewProjState() const
86{
87 return myBuilder->WorldViewProjState();
88}
89
90//=======================================================================
f751596e 91// function : SetViewport
92// purpose : Passes viewport parameters to builder
93//=======================================================================
94void SelectMgr_BaseFrustum::SetViewport (const Standard_Real theX,
95 const Standard_Real theY,
96 const Standard_Real theWidth,
97 const Standard_Real theHeight)
98{
99 myBuilder->SetViewport (theX, theY, theWidth, theHeight);
100}
101
102//=======================================================================
103// function : SetPixelTolerance
104// purpose :
105//=======================================================================
3bf9a45f 106void SelectMgr_BaseFrustum::SetPixelTolerance (const Standard_Integer theTol)
f751596e 107{
108 myPixelTolerance = theTol;
109}
110
111//=======================================================================
112// function : SetWindowSize
113// purpose :
114//=======================================================================
115void SelectMgr_BaseFrustum::SetWindowSize (const Standard_Integer theWidth, const Standard_Integer theHeight)
116{
117 myBuilder->SetWindowSize (theWidth, theHeight);
118}
119
120//=======================================================================
121// function : SetBuilder
122// purpose :
123//=======================================================================
bf3977c9 124void SelectMgr_BaseFrustum::SetBuilder (const Handle(SelectMgr_FrustumBuilder)& theBuilder)
f751596e 125{
126 myBuilder.Nullify();
127 myBuilder = theBuilder;
128}
129
130//=======================================================================
131// function : Overlaps
132// purpose : SAT intersection test between defined volume and
133// given axis-aligned box
134//=======================================================================
3bf9a45f 135Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBoxMin*/,
136 const SelectMgr_Vec3& /*theBoxMax*/,
7ab15952 137 Standard_Real& /*theDepth*/)
f751596e 138{
139 return Standard_False;
140}
141
142//=======================================================================
143// function : Overlaps
144// purpose : Intersection test between defined volume and given point
145//=======================================================================
2157d6ac 146Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBoxMin*/,
147 const SelectMgr_Vec3& /*theBoxMax*/,
148 Standard_Boolean* /*theInside*/)
f751596e 149{
150 return Standard_False;
151}
152
153//=======================================================================
154// function : Overlaps
155// purpose : Intersection test between defined volume and given point
156//=======================================================================
3bf9a45f 157Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/,
7ab15952 158 Standard_Real& /*theDepth*/)
f751596e 159{
160 return Standard_False;
161}
162
3bf9a45f 163//=======================================================================
164// function : Overlaps
165// purpose : Intersection test between defined volume and given point
166//=======================================================================
167Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/)
168{
169 return Standard_False;
170}
171
f751596e 172//=======================================================================
173// function : Overlaps
174// purpose : SAT intersection test between defined volume and given
175// ordered set of points, representing line segments. The test
176// may be considered of interior part or boundary line defined
177// by segments depending on given sensitivity type
178//=======================================================================
114b7bf1 179Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const TColgp_Array1OfPnt& /*theArrayOfPnts*/,
7ab15952 180 Select3D_TypeOfSensitivity /*theSensType*/,
181 Standard_Real& /*theDepth*/)
f751596e 182{
183 return Standard_False;
184}
185
186//=======================================================================
187// function : Overlaps
188// purpose : SAT intersection test between defined volume and given
189// triangle. The test may be considered of interior part or
190// boundary line defined by triangle vertices depending on
191// given sensitivity type
192//=======================================================================
7ab15952 193Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePt1*/,
194 const gp_Pnt& /*thePt2*/,
195 const gp_Pnt& /*thePt3*/,
196 Select3D_TypeOfSensitivity /*theSensType*/,
197 Standard_Real& /*theDepth*/)
f751596e 198{
199 return Standard_False;
200}
201
202//=======================================================================
203// function : Overlaps
204// purpose : Checks if line segment overlaps selecting volume
205//=======================================================================
3bf9a45f 206Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt1*/,
207 const gp_Pnt& /*thePnt2*/,
7ab15952 208 Standard_Real& /*theDepth*/)
f751596e 209{
210 return Standard_False;
211}
212
213//=======================================================================
214// function : DistToGeometryCenter
215// purpose : Measures distance between 3d projection of user-picked
216// screen point and given point theCOG
217//=======================================================================
7ab15952 218Standard_Real SelectMgr_BaseFrustum::DistToGeometryCenter (const gp_Pnt& /*theCOG*/)
f751596e 219{
220 return DBL_MAX;
221}
222
e9312c0f 223//=======================================================================
224// function : DetectedPoint
225// purpose :
226//=======================================================================
3bf9a45f 227gp_Pnt SelectMgr_BaseFrustum::DetectedPoint (const Standard_Real /*theDepth*/) const
f751596e 228{
3bf9a45f 229 return gp_Pnt (RealLast(), RealLast(), RealLast());
f751596e 230}
231
232//=======================================================================
233// function : IsClipped
234// purpose : Checks if the point of sensitive in which selection was
235// detected belongs to the region defined by clipping planes
236//=======================================================================
7ab15952 237Standard_Boolean SelectMgr_BaseFrustum::IsClipped (const Graphic3d_SequenceOfHClipPlane& /*thePlanes*/,
238 const Standard_Real /*theDepth*/)
f751596e 239{
240 return Standard_True;
241}