1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
18 #include <Select3D_SensitivePoly.ixx>
19 #include <gp_Pnt2d.hxx>
21 #include <Select3D_Pnt.hxx>
22 #include <Select3D_Pnt2d.hxx>
23 #include <Select3D_Box2d.hxx>
24 #include <TopLoc_Location.hxx>
27 //==================================================
28 // Function: faire disparaitre ce constructeur a la prochaine version...
29 // Purpose : simplement garde pour ne pas perturber la version update
30 //==================================================
32 Select3D_SensitivePoly::
33 Select3D_SensitivePoly(const Handle(SelectBasics_EntityOwner)& OwnerId,
34 const TColgp_Array1OfPnt& ThePoints):
35 Select3D_SensitiveEntity(OwnerId),
36 mypolyg(ThePoints.Upper()-ThePoints.Lower()+1)
38 for (Standard_Integer theIndex = 0 ; theIndex < mypolyg.Size(); ++theIndex)
39 mypolyg.SetPnt(theIndex, ThePoints.Value(ThePoints.Lower()+theIndex));
42 //==================================================
45 //==================================================
47 Select3D_SensitivePoly::
48 Select3D_SensitivePoly(const Handle(SelectBasics_EntityOwner)& OwnerId,
49 const Handle(TColgp_HArray1OfPnt)& ThePoints):
50 Select3D_SensitiveEntity(OwnerId),
51 mypolyg(ThePoints->Upper()-ThePoints->Lower()+1)
53 for (Standard_Integer theIndex = 0; theIndex < mypolyg.Size(); theIndex++)
54 mypolyg.SetPnt(theIndex, ThePoints->Value(ThePoints->Lower()+theIndex));
57 //==================================================
60 //==================================================
62 Select3D_SensitivePoly::
63 Select3D_SensitivePoly(const Handle(SelectBasics_EntityOwner)& OwnerId,
64 const Standard_Integer NbPoints):
65 Select3D_SensitiveEntity(OwnerId),
70 //==================================================
73 //==================================================
75 void Select3D_SensitivePoly::Project(const Handle(Select3D_Projector)& aProj)
79 Standard_Boolean hasloc = HasLocation();
82 for (Standard_Integer theIndex = 0; theIndex < mypolyg.Size(); ++theIndex)
84 aPnt = mypolyg.Pnt(theIndex);
87 aProj->Project(aPnt.Transformed(Location().Transformation()), aPnt2d);
91 aProj->Project(aPnt, aPnt2d);
93 mybox2d.Update(aPnt2d);
94 mypolyg.SetPnt2d(theIndex, aPnt2d);
98 //==================================================
101 //==================================================
102 void Select3D_SensitivePoly
103 ::Areas(SelectBasics_ListOfBox2d& aSeq)
105 aSeq.Append(mybox2d);