summaryrefslogtreecommitdiff
path: root/inc/Select3D_SensitiveTriangulation.hxx
blob: 199a42ee95dc8427d0c9bafc54802eb8286c034a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _Select3D_SensitiveTriangulation_HeaderFile
#define _Select3D_SensitiveTriangulation_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_DefineHandle_HeaderFile
#include <Standard_DefineHandle.hxx>
#endif
#ifndef _Handle_Select3D_SensitiveTriangulation_HeaderFile
#include <Handle_Select3D_SensitiveTriangulation.hxx>
#endif

#ifndef _Handle_Poly_Triangulation_HeaderFile
#include <Handle_Poly_Triangulation.hxx>
#endif
#ifndef _TopLoc_Location_HeaderFile
#include <TopLoc_Location.hxx>
#endif
#ifndef _gp_Trsf_HeaderFile
#include <gp_Trsf.hxx>
#endif
#ifndef _gp_Pnt_HeaderFile
#include <gp_Pnt.hxx>
#endif
#ifndef _Handle_TColStd_HArray1OfInteger_HeaderFile
#include <Handle_TColStd_HArray1OfInteger.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _TColgp_Array1OfPnt2d_HeaderFile
#include <TColgp_Array1OfPnt2d.hxx>
#endif
#ifndef _gp_Pnt2d_HeaderFile
#include <gp_Pnt2d.hxx>
#endif
#ifndef _Bnd_Box2d_HeaderFile
#include <Bnd_Box2d.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Select3D_SensitiveEntity_HeaderFile
#include <Select3D_SensitiveEntity.hxx>
#endif
#ifndef _Handle_SelectBasics_EntityOwner_HeaderFile
#include <Handle_SelectBasics_EntityOwner.hxx>
#endif
#ifndef _Handle_Select3D_Projector_HeaderFile
#include <Handle_Select3D_Projector.hxx>
#endif
#ifndef _Handle_Select3D_SensitiveEntity_HeaderFile
#include <Handle_Select3D_SensitiveEntity.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Standard_OStream_HeaderFile
#include <Standard_OStream.hxx>
#endif
class Poly_Triangulation;
class TColStd_HArray1OfInteger;
class SelectBasics_EntityOwner;
class TopLoc_Location;
class gp_Pnt;
class Select3D_Projector;
class SelectBasics_ListOfBox2d;
class Select3D_SensitiveEntity;
class TColgp_Array1OfPnt2d;
class Bnd_Box2d;
class gp_Lin;
class gp_Pnt2d;
class gp_XY;


//! A framework to define selection of a sensitive entity made of a set of triangles. <br>
class Select3D_SensitiveTriangulation : public Select3D_SensitiveEntity {

public:

  //! Constructs a sensitive triangulation object defined by <br>
//! the owner OwnerId, the triangulation aTriangulation, <br>
//! the location aLoc, and the flag InteriorFlag. <br>
  Standard_EXPORT   Select3D_SensitiveTriangulation(const Handle(SelectBasics_EntityOwner)& OwnerId,const Handle(Poly_Triangulation)& aTriangulation,const TopLoc_Location& aLoc,const Standard_Boolean InteriorFlag = Standard_True);
  //! Constructs a sensitive triangulation object defined by <br>
//! the owner OwnerId, the triangulation aTriangulation, <br>
//! the location aLoc, the array of free edges <br>
//! thefreeedges, the center of gravity theCDG, and the flag InteriorFlag. <br>
//! As free edges and the center of gravity do not have <br>
//! to be computed later, this syntax reduces computation time. <br>
  Standard_EXPORT   Select3D_SensitiveTriangulation(const Handle(SelectBasics_EntityOwner)& OwnerId,const Handle(Poly_Triangulation)& aTriangulation,const TopLoc_Location& aLoc,const Handle(TColStd_HArray1OfInteger)& thefreeedges,const gp_Pnt& theCDG,const Standard_Boolean InteriorFlag);
  //! projection of the sensitive primitive in order to <br>
//!          get 2D boxes for the Sort Algorithm <br>
  Standard_EXPORT     void Project(const Handle(Select3D_Projector)& aProjector) ;
  //! stores in <boxes> the 2D Boxes which represent the sensitive face <br>
//!          in the selection algorithm. <br>
  Standard_EXPORT     void Areas(SelectBasics_ListOfBox2d& boxes) ;
  
  Standard_EXPORT     Handle_Select3D_SensitiveEntity GetConnected(const TopLoc_Location& aLocation) ;
  
  Standard_EXPORT   virtual  Standard_Boolean Matches(const Standard_Real X,const Standard_Real Y,const Standard_Real aTol,Standard_Real& DMin) ;
  
  Standard_EXPORT   virtual  Standard_Boolean Matches(const Standard_Real XMin,const Standard_Real YMin,const Standard_Real XMax,const Standard_Real YMax,const Standard_Real aTol) ;
  
  Standard_EXPORT   virtual  Standard_Boolean Matches(const TColgp_Array1OfPnt2d& Polyline,const Bnd_Box2d& aBox,const Standard_Real aTol) ;
  //! give the depht of the last detected triangle <br>
//!          (center of gravity) <br>
  Standard_EXPORT     Standard_Real ComputeDepth(const gp_Lin& EyeLine) const;
  //! Returns the detected three nodes P1, P2, P3 constituting a triangle. <br>
//! This triangle is a component of the overall sensitive <br>
//! triangulation created at construction time. <br>
        Standard_Integer DetectedTriangle() const;
  //! Returns the triangulation used at the time of construction. <br>
       const Handle_Poly_Triangulation& Triangulation() const;
  //! Returns the 3D center of gravity used at the time of construction. <br>
       const gp_Pnt& CDG3D() const;
  //! Returns the 2D center of gravity used at the time of construction. <br>
       const gp_Pnt2d& CDG2D() const;
  //! Dmin gives the distance between the cdg and aPoint <br>
  Standard_EXPORT     Standard_Integer Status(const gp_XY& p0,const gp_XY& p1,const gp_XY& p2,const gp_XY& aPoint,const Standard_Real aTol,Standard_Real& Dmin) const;
  
        Standard_Boolean HasInitLocation() const;
  
       const TopLoc_Location& GetInitLocation() const;
  
  Standard_EXPORT   virtual  void ResetLocation() ;
  
  Standard_EXPORT   virtual  void SetLocation(const TopLoc_Location& aLoc) ;
  
  Standard_EXPORT   virtual  void Dump(Standard_OStream& S,const Standard_Boolean FullDump = Standard_True) const;
  //! gives the vertices of detected triangle... <br>
  Standard_EXPORT     Standard_Boolean DetectedTriangle(gp_Pnt& P1,gp_Pnt& P2,gp_Pnt& P3) const;
  //! Gets 2D nodes computed by entity using 3D nodes and viewer <br>
//!          parameters (see Project() method) <br>
  Standard_EXPORT     Standard_Boolean DetectedTriangle2d(gp_Pnt2d& P1,gp_Pnt2d& P2,gp_Pnt2d& P3) const;




  DEFINE_STANDARD_RTTI(Select3D_SensitiveTriangulation)

protected:




private: 

  
  Standard_EXPORT     Standard_Boolean IsFree(const Standard_Integer IndexOfTriangle,Standard_Integer& IndexinFree) const;
  
  Standard_EXPORT     void ComputeTotalTrsf() ;

Handle_Poly_Triangulation myTriangul;
TopLoc_Location myiniloc;
gp_Trsf myTrsf;
gp_Pnt myCDG3D;
Handle_TColStd_HArray1OfInteger myFreeEdges;
Standard_Boolean myIntFlag;
TColgp_Array1OfPnt2d myNodes2d;
gp_Pnt2d myCDG2D;
Bnd_Box2d mybox2d;
Standard_Integer myDetectedTr;


};


#include <Select3D_SensitiveTriangulation.lxx>



// other Inline functions and methods (like "C++: function call" methods)


#endif