0030349: Coding - add usage of Standard_EXPORT for some not inline methods in Select3D
[occt.git] / src / Select3D / Select3D_SensitivePoly.hxx
CommitLineData
f751596e 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
2//
3// This file is part of Open CASCADE Technology software library.
4//
5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
10//
11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
13
14#ifndef _Select3D_SensitivePoly_HeaderFile
15#define _Select3D_SensitivePoly_HeaderFile
16
f751596e 17#include <Select3D_PointData.hxx>
f751596e 18#include <Select3D_SensitiveSet.hxx>
19#include <Select3D_TypeOfSensitivity.hxx>
0609d8ee 20#include <TColStd_HArray1OfInteger.hxx>
21#include <TColgp_HArray1OfPnt.hxx>
f751596e 22
23class Standard_ConstructionError;
24class Standard_OutOfRange;
f751596e 25
26//! Sensitive Entity to make a face selectable.
27//! In some cases this class can raise Standard_ConstructionError and
28//! Standard_OutOfRange exceptions from its member Select3D_PointData
29//! myPolyg.
30class Select3D_SensitivePoly : public Select3D_SensitiveSet
31{
0609d8ee 32 DEFINE_STANDARD_RTTIEXT(Select3D_SensitivePoly, Select3D_SensitiveSet)
f751596e 33public:
34
35 //! Constructs a sensitive face object defined by the
36 //! owner OwnerId, the array of points ThePoints, and
37 //! the sensitivity type Sensitivity.
38 //! The array of points is the outer polygon of the geometric face.
39 Standard_EXPORT Select3D_SensitivePoly (const Handle(SelectBasics_EntityOwner)& theOwnerId,
40 const TColgp_Array1OfPnt& thePoints,
41 const Standard_Boolean theIsBVHEnabled);
42
43 //! Constructs a sensitive face object defined by the
44 //! owner OwnerId, the array of points ThePoints, and
45 //! the sensitivity type Sensitivity.
46 //! The array of points is the outer polygon of the geometric face.
47 Standard_EXPORT Select3D_SensitivePoly (const Handle(SelectBasics_EntityOwner)& theOwnerId,
48 const Handle(TColgp_HArray1OfPnt)& thePoints,
49 const Standard_Boolean theIsBVHEnabled);
50
51 //! Constructs the sensitive circle object defined by the
52 //! owner OwnerId, the circle Circle, the Boolean
53 //! FilledCircle and the number of points NbOfPoints.
54 Standard_EXPORT Select3D_SensitivePoly (const Handle(SelectBasics_EntityOwner)& theOwnerId,
55 const Standard_Boolean theIsBVHEnabled,
56 const Standard_Integer theNbPnts = 6);
57
58 //! Returns the amount of segments in poly
59 Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
60
61 //! Returns the 3D points of the array used at construction time.
0609d8ee 62 void Points3D (Handle(TColgp_HArray1OfPnt)& theHArrayOfPnt)
63 {
64 Standard_Integer aSize = myPolyg.Size();
65 theHArrayOfPnt = new TColgp_HArray1OfPnt (1,aSize);
66 for(Standard_Integer anIndex = 1; anIndex <= aSize; anIndex++)
67 {
68 theHArrayOfPnt->SetValue (anIndex, myPolyg.Pnt (anIndex-1));
69 }
70 }
f751596e 71
72 //! Returns bounding box of a polygon. If location
73 //! transformation is set, it will be applied
74 Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
75
76 //! Returns center of the point set. If location transformation
77 //! is set, it will be applied
78 Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
79
80 //! Returns the amount of segments of the poly
81 Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
82
83 //! Returns bounding box of segment with index theIdx
84 Standard_EXPORT virtual Select3D_BndBox3d Box (const Standard_Integer theIdx) const Standard_OVERRIDE;
85
86 //! Returns geometry center of sensitive entity index theIdx in the vector along
87 //! the given axis theAxis
88 Standard_EXPORT virtual Standard_Real Center (const Standard_Integer theIdx,
89 const Standard_Integer theAxis) const Standard_OVERRIDE;
90
91 //! Swaps items with indexes theIdx1 and theIdx2 in the vector
92 Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1,
93 const Standard_Integer theIdx2) Standard_OVERRIDE;
94
25333d45 95protected:
f751596e 96
97 //! Checks whether the segment with index theIdx overlaps the current selecting volume
25333d45 98 Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
99 SelectBasics_SelectingVolumeManager& theMgr,
100 Standard_Integer theElemIdx,
101 Standard_Boolean theIsFullInside) Standard_OVERRIDE;
f751596e 102
2157d6ac 103 //! Checks whether the entity with index theIdx is inside the current selecting volume
25333d45 104 Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
105 Standard_Integer theElemIdx,
106 Standard_Boolean theIsFullInside) Standard_OVERRIDE;
2157d6ac 107
f751596e 108 //! Calculates distance from the 3d projection of used-picked screen point
109 //! to center of the geometry
25333d45 110 Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
f751596e 111
112protected:
113
114 Select3D_PointData myPolyg; //!< Points of the poly
115 mutable gp_Pnt myCOG; //!< Center of the poly
35c0599a 116 Handle(TColStd_HArray1OfInteger) mySegmentIndexes; //!< Segment indexes for BVH tree build
f751596e 117 Select3D_BndBox3d myBndBox; //!< Bounding box of the poly
2157d6ac 118 mutable Standard_Boolean myIsComputed; //!< Is true if all the points and data structures of polygon are initialized
f751596e 119};
120
121DEFINE_STANDARD_HANDLE(Select3D_SensitivePoly, Select3D_SensitiveSet)
122
f751596e 123#endif // _Select3D_SensitivePoly_HeaderFile