0024510: Remove unused local variables
[occt.git] / src / MeshVS / MeshVS_SensitiveSegment.cxx
1 // Created on: 2003-09-29
2 // Created by: Alexander SOLOVYOV and Sergey LITONIN
3 // Copyright (c) 2003-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
8 // under the terms of the GNU Lesser General Public 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 <MeshVS_SensitiveSegment.ixx>
17 #include <Select3D_Projector.hxx>
18 #include <Bnd_Box2d.hxx>
19 #include <CSLib_Class2d.hxx>
20 #include <TopLoc_Location.hxx>
21
22 //=======================================================================
23 // name    : MeshVS_SensitiveSegment::MeshVS_SensitiveSegment
24 // Purpose :
25 //=======================================================================
26 MeshVS_SensitiveSegment::MeshVS_SensitiveSegment (
27              const Handle(SelectBasics_EntityOwner)& theOwnerId,
28              const gp_Pnt&                           theFirstP,
29              const gp_Pnt&                           theLastP,
30              const Standard_Integer                  theMaxRect )
31 : Select3D_SensitiveSegment( theOwnerId, theFirstP, theLastP, theMaxRect )
32 {
33   myCentre.SetXYZ( ( theFirstP.XYZ() + theLastP.XYZ() ) / 2 );
34 }
35
36 //=======================================================================
37 // name    : MeshVS_SensitiveSegment::Project
38 // Purpose :
39 //=======================================================================
40 void MeshVS_SensitiveSegment::Project( const Handle(Select3D_Projector)& aProj )
41 {
42   Select3D_SensitiveSegment::Project( aProj );
43   if ( HasLocation() )
44     aProj->Project( myCentre.Transformed( Location().Transformation() ), myProjCentre );
45   else
46     aProj->Project( myCentre, myProjCentre );
47 }
48
49 //=======================================================================
50 // name    : MeshVS_SensitiveSegment::Matches
51 // Purpose :
52 //=======================================================================
53 Standard_Boolean MeshVS_SensitiveSegment::Matches( const Standard_Real XMin,
54                                                    const Standard_Real YMin,
55                                                    const Standard_Real XMax,
56                                                    const Standard_Real YMax,
57                                                    const Standard_Real aTol )
58 {
59   Bnd_Box2d aBox;
60   aBox.Update( XMin-aTol, YMin-aTol, XMax+aTol, YMax+aTol );
61   return !aBox.IsOut( myProjCentre );
62 }
63
64 //=======================================================================
65 // name    : MeshVS_SensitiveSegment::Matches
66 // Purpose :
67 //=======================================================================
68 Standard_Boolean MeshVS_SensitiveSegment::Matches( const TColgp_Array1OfPnt2d& Polyline,
69                                                    const Bnd_Box2d&            aBox,
70                                                    const Standard_Real         aTol )
71 {
72   Standard_Real Umin, Vmin, Umax, Vmax;
73   aBox.Get ( Umin,Vmin,Umax,Vmax );
74   CSLib_Class2d aClassifier2d( Polyline, aTol, aTol, Umin, Vmin, Umax, Vmax );
75   Standard_Integer aRes = aClassifier2d.SiDans( myProjCentre );
76
77   return ( aRes == 1) ;
78 }