blob: 69b58d490667ea4428f73c10a266c1260e52145d (
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
|
#include <Select3D_SensitivePoly.ixx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
#include <Select3D_Pnt.hxx>
#include <Select3D_Pnt2d.hxx>
#include <Select3D_Box2d.hxx>
#include <TopLoc_Location.hxx>
//==================================================
// Function: faire disparaitre ce constructeur a la prochaine version...
// Purpose : simplement garde pour ne pas perturber la version update
//==================================================
Select3D_SensitivePoly::
Select3D_SensitivePoly(const Handle(SelectBasics_EntityOwner)& OwnerId,
const TColgp_Array1OfPnt& ThePoints):
Select3D_SensitiveEntity(OwnerId)
{
mynbpoints = ThePoints.Upper()-ThePoints.Lower()+1;
mypolyg3d = new Select3D_Pnt[mynbpoints];
mypolyg2d = new Select3D_Pnt2d[mynbpoints];
for(Standard_Integer i=0;i<mynbpoints;i++)
((Select3D_Pnt*)mypolyg3d)[i] = ThePoints.Value(ThePoints.Lower()+i);
}
//==================================================
// Function:
// Purpose :
//==================================================
Select3D_SensitivePoly::
Select3D_SensitivePoly(const Handle(SelectBasics_EntityOwner)& OwnerId,
const Handle(TColgp_HArray1OfPnt)& ThePoints):
Select3D_SensitiveEntity(OwnerId)
{
mynbpoints = ThePoints->Upper()-ThePoints->Lower()+1;
mypolyg3d = new Select3D_Pnt[mynbpoints];
mypolyg2d = new Select3D_Pnt2d[mynbpoints];
for(Standard_Integer i=0;i<mynbpoints;i++)
((Select3D_Pnt*)mypolyg3d)[i] = ThePoints->Value(ThePoints->Lower()+i);
}
//==================================================
// Function:
// Purpose :
//==================================================
Select3D_SensitivePoly::
Select3D_SensitivePoly(const Handle(SelectBasics_EntityOwner)& OwnerId,
const Standard_Integer NbPoints):
Select3D_SensitiveEntity(OwnerId)
{
mynbpoints = NbPoints;
mypolyg3d = new Select3D_Pnt[mynbpoints];
mypolyg2d = new Select3D_Pnt2d[mynbpoints];
}
//==================================================
// Function:
// Purpose :
//==================================================
void Select3D_SensitivePoly::Project(const Handle(Select3D_Projector)& aProj)
{
Select3D_SensitiveEntity::Project(aProj); // to set the field last proj...
mybox2d.SetVoid();
Standard_Boolean hasloc = HasLocation();
gp_Pnt2d aPnt2d;
for(Standard_Integer i=0;i<mynbpoints;i++)
{
gp_Pnt aPnt(((Select3D_Pnt*)mypolyg3d)[i].x, ((Select3D_Pnt*)mypolyg3d)[i].y, ((Select3D_Pnt*)mypolyg3d)[i].z);
if (hasloc)
{
aProj->Project(aPnt.Transformed(Location().Transformation()),aPnt2d);
}
else
{
aProj->Project(aPnt,aPnt2d);
}
mybox2d.Update(aPnt2d);
((Select3D_Pnt2d*)mypolyg2d)[i] = aPnt2d;
}
}
//==================================================
// Function:
// Purpose :
//==================================================
void Select3D_SensitivePoly
::Areas(SelectBasics_ListOfBox2d& aSeq)
{
aSeq.Append(mybox2d);
}
//==================================================
// Function:
// Purpose :
//==================================================
void Select3D_SensitivePoly::Destroy()
{
delete[] (Select3D_Pnt*)mypolyg3d;
delete[] (Select3D_Pnt2d*)mypolyg2d;
}
|