Commit | Line | Data |
---|---|---|
7fd59977 | 1 | #include <Select3D_SensitivePoly.ixx> |
2 | #include <gp_Pnt2d.hxx> | |
3 | #include <gp_Pnt.hxx> | |
4 | #include <Select3D_Pnt.hxx> | |
5 | #include <Select3D_Pnt2d.hxx> | |
6 | #include <Select3D_Box2d.hxx> | |
7 | #include <TopLoc_Location.hxx> | |
8 | ||
9 | ||
10 | //================================================== | |
11 | // Function: faire disparaitre ce constructeur a la prochaine version... | |
12 | // Purpose : simplement garde pour ne pas perturber la version update | |
13 | //================================================== | |
14 | ||
15 | Select3D_SensitivePoly:: | |
16 | Select3D_SensitivePoly(const Handle(SelectBasics_EntityOwner)& OwnerId, | |
ac04d101 | 17 | const TColgp_Array1OfPnt& ThePoints): |
ceae62f0 A |
18 | Select3D_SensitiveEntity(OwnerId), |
19 | mypolyg(ThePoints.Upper()-ThePoints.Lower()+1) | |
7fd59977 | 20 | { |
ceae62f0 A |
21 | for (Standard_Integer theIndex = 0 ; theIndex < mypolyg.Size(); ++theIndex) |
22 | mypolyg.SetPnt(theIndex, ThePoints.Value(ThePoints.Lower()+theIndex)); | |
7fd59977 | 23 | } |
24 | ||
25 | //================================================== | |
ac04d101 | 26 | // Function: Creation |
7fd59977 | 27 | // Purpose : |
28 | //================================================== | |
29 | ||
30 | Select3D_SensitivePoly:: | |
31 | Select3D_SensitivePoly(const Handle(SelectBasics_EntityOwner)& OwnerId, | |
ac04d101 | 32 | const Handle(TColgp_HArray1OfPnt)& ThePoints): |
ceae62f0 A |
33 | Select3D_SensitiveEntity(OwnerId), |
34 | mypolyg(ThePoints->Upper()-ThePoints->Lower()+1) | |
7fd59977 | 35 | { |
ceae62f0 A |
36 | for (Standard_Integer theIndex = 0; theIndex < mypolyg.Size(); theIndex++) |
37 | mypolyg.SetPnt(theIndex, ThePoints->Value(ThePoints->Lower()+theIndex)); | |
7fd59977 | 38 | } |
39 | ||
40 | //================================================== | |
ac04d101 | 41 | // Function: Creation |
7fd59977 | 42 | // Purpose : |
43 | //================================================== | |
44 | ||
45 | Select3D_SensitivePoly:: | |
46 | Select3D_SensitivePoly(const Handle(SelectBasics_EntityOwner)& OwnerId, | |
ac04d101 | 47 | const Standard_Integer NbPoints): |
ceae62f0 A |
48 | Select3D_SensitiveEntity(OwnerId), |
49 | mypolyg(NbPoints) | |
7fd59977 | 50 | { |
7fd59977 | 51 | } |
52 | ||
53 | //================================================== | |
ac04d101 | 54 | // Function: Project |
7fd59977 | 55 | // Purpose : |
56 | //================================================== | |
57 | ||
4952a30a | 58 | void Select3D_SensitivePoly::Project(const Handle(Select3D_Projector)& aProj) |
7fd59977 | 59 | { |
ceae62f0 | 60 | Select3D_SensitiveEntity:: Project (aProj); // to set the field last proj... |
7fd59977 | 61 | mybox2d.SetVoid(); |
62 | ||
63 | Standard_Boolean hasloc = HasLocation(); | |
64 | gp_Pnt2d aPnt2d; | |
ceae62f0 A |
65 | gp_Pnt aPnt; |
66 | for (Standard_Integer theIndex = 0; theIndex < mypolyg.Size(); ++theIndex) | |
67 | { | |
68 | aPnt = mypolyg.Pnt(theIndex); | |
69 | if (hasloc) | |
7fd59977 | 70 | { |
ceae62f0 | 71 | aProj->Project(aPnt.Transformed(Location().Transformation()), aPnt2d); |
7fd59977 | 72 | } |
ceae62f0 A |
73 | else |
74 | { | |
75 | aProj->Project(aPnt, aPnt2d); | |
76 | } | |
77 | mybox2d.Update(aPnt2d); | |
78 | mypolyg.SetPnt2d(theIndex, aPnt2d); | |
79 | } | |
7fd59977 | 80 | } |
81 | ||
82 | //================================================== | |
ac04d101 | 83 | // Function: Areas |
7fd59977 | 84 | // Purpose : |
85 | //================================================== | |
86 | void Select3D_SensitivePoly | |
87 | ::Areas(SelectBasics_ListOfBox2d& aSeq) | |
88 | { | |
89 | aSeq.Append(mybox2d); | |
90 | } | |
91 |