File indexing completed on 2026-09-16 09:18:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _Select3D_SensitivePoly_HeaderFile
0015 #define _Select3D_SensitivePoly_HeaderFile
0016
0017 #include <gp_Circ.hxx>
0018 #include <Select3D_PointData.hxx>
0019 #include <Select3D_SensitiveSet.hxx>
0020 #include <Select3D_TypeOfSensitivity.hxx>
0021 #include <Standard_Integer.hxx>
0022 #include <NCollection_Array1.hxx>
0023 #include <NCollection_HArray1.hxx>
0024 #include <gp_Pnt.hxx>
0025
0026
0027
0028
0029
0030 class Select3D_SensitivePoly : public Select3D_SensitiveSet
0031 {
0032 DEFINE_STANDARD_RTTIEXT(Select3D_SensitivePoly, Select3D_SensitiveSet)
0033 public:
0034
0035
0036
0037
0038 Standard_EXPORT Select3D_SensitivePoly(const occ::handle<SelectMgr_EntityOwner>& theOwnerId,
0039 const NCollection_Array1<gp_Pnt>& thePoints,
0040 const bool theIsBVHEnabled);
0041
0042
0043
0044
0045
0046 Standard_EXPORT Select3D_SensitivePoly(const occ::handle<SelectMgr_EntityOwner>& theOwnerId,
0047 const occ::handle<NCollection_HArray1<gp_Pnt>>& thePoints,
0048 const bool theIsBVHEnabled);
0049
0050
0051
0052
0053
0054 Standard_EXPORT Select3D_SensitivePoly(const occ::handle<SelectMgr_EntityOwner>& theOwnerId,
0055 const gp_Circ& theCircle,
0056 const double theU1,
0057 const double theU2,
0058 const bool theIsFilled = false,
0059 const int theNbPnts = 12);
0060
0061
0062
0063
0064 Standard_EXPORT Select3D_SensitivePoly(const occ::handle<SelectMgr_EntityOwner>& theOwnerId,
0065 const bool theIsBVHEnabled,
0066 const int theNbPnts = 6);
0067
0068
0069 Standard_EXPORT bool Matches(SelectBasics_SelectingVolumeManager& theMgr,
0070 SelectBasics_PickResult& thePickResult) override;
0071
0072
0073 Standard_EXPORT int NbSubElements() const override;
0074
0075
0076
0077 [[nodiscard]] occ::handle<NCollection_HArray1<gp_Pnt>> Points3D() const
0078 {
0079 int aSize = myPolyg.Size();
0080 occ::handle<NCollection_HArray1<gp_Pnt>> aHArrayOfPnt =
0081 new NCollection_HArray1<gp_Pnt>(1, aSize);
0082 for (int anIndex = 1; anIndex <= aSize; anIndex++)
0083 {
0084 aHArrayOfPnt->SetValue(anIndex, myPolyg.Pnt(anIndex - 1));
0085 }
0086 return aHArrayOfPnt;
0087 }
0088
0089
0090
0091 Standard_DEPRECATED("Use Points3D() returning handle by value instead")
0092 void Points3D(occ::handle<NCollection_HArray1<gp_Pnt>>& aHArrayOfPnt)
0093 {
0094 aHArrayOfPnt = Points3D();
0095 }
0096
0097
0098 void ArrayBounds(int& theLow, int& theUp) const
0099 {
0100 theLow = 0;
0101 theUp = myPolyg.Size() - 1;
0102 }
0103
0104
0105 gp_Pnt GetPoint3d(const int thePntIdx) const
0106 {
0107 return (thePntIdx >= 0 && thePntIdx < myPolyg.Size()) ? myPolyg.Pnt(thePntIdx) : gp_Pnt();
0108 }
0109
0110
0111
0112 Standard_EXPORT Select3D_BndBox3d BoundingBox() override;
0113
0114
0115
0116 Standard_EXPORT gp_Pnt CenterOfGeometry() const override;
0117
0118
0119 Standard_EXPORT int Size() const override;
0120
0121
0122 Standard_EXPORT Select3D_BndBox3d Box(const int theIdx) const override;
0123
0124
0125
0126 Standard_EXPORT double Center(const int theIdx, const int theAxis) const override;
0127
0128
0129 Standard_EXPORT void Swap(const int theIdx1, const int theIdx2) override;
0130
0131
0132 Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0133
0134 protected:
0135
0136 Standard_EXPORT bool overlapsElement(SelectBasics_PickResult& thePickResult,
0137 SelectBasics_SelectingVolumeManager& theMgr,
0138 int theElemIdx,
0139 bool theIsFullInside) override;
0140
0141
0142 Standard_EXPORT bool elementIsInside(SelectBasics_SelectingVolumeManager& theMgr,
0143 int theElemIdx,
0144 bool theIsFullInside) override;
0145
0146
0147
0148 Standard_EXPORT double distanceToCOG(SelectBasics_SelectingVolumeManager& theMgr) override;
0149
0150 protected:
0151 Select3D_PointData myPolyg;
0152 mutable gp_Pnt myCOG;
0153 occ::handle<NCollection_HArray1<int>> mySegmentIndexes;
0154 Select3D_BndBox3d myBndBox;
0155
0156 Select3D_TypeOfSensitivity mySensType;
0157 mutable bool myIsComputed;
0158
0159 };
0160
0161 #endif