File indexing completed on 2026-09-30 09:04:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _SelectMgr_EntityOwner_HeaderFile
0018 #define _SelectMgr_EntityOwner_HeaderFile
0019
0020 #include <AIS_SelectionScheme.hxx>
0021 #include <Aspect_VKey.hxx>
0022 #include <PrsMgr_PresentationManager.hxx>
0023 #include <SelectMgr_SelectableObject.hxx>
0024 #include <TopLoc_Location.hxx>
0025
0026 class V3d_Viewer;
0027
0028
0029
0030
0031
0032 class SelectMgr_EntityOwner : public Standard_Transient
0033 {
0034 DEFINE_STANDARD_RTTIEXT(SelectMgr_EntityOwner, Standard_Transient)
0035 public:
0036
0037 Standard_EXPORT SelectMgr_EntityOwner(const int aPriority = 0);
0038
0039
0040
0041 Standard_EXPORT SelectMgr_EntityOwner(const occ::handle<SelectMgr_SelectableObject>& aSO,
0042 const int aPriority = 0);
0043
0044
0045
0046 Standard_EXPORT SelectMgr_EntityOwner(const occ::handle<SelectMgr_EntityOwner>& theOwner,
0047 const int aPriority = 0);
0048
0049
0050
0051
0052
0053
0054 int Priority() const { return mypriority; }
0055
0056
0057 void SetPriority(int thePriority) { mypriority = thePriority; }
0058
0059
0060 bool HasSelectable() const { return mySelectable != nullptr; }
0061
0062
0063 virtual occ::handle<SelectMgr_SelectableObject> Selectable() const { return mySelectable; }
0064
0065
0066 virtual void SetSelectable(const occ::handle<SelectMgr_SelectableObject>& theSelObj)
0067 {
0068 mySelectable = theSelObj.get();
0069 }
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080 virtual bool HandleMouseClick(const NCollection_Vec2<int>& thePoint,
0081 Aspect_VKeyMouse theButton,
0082 Aspect_VKeyFlags theModifiers,
0083 bool theIsDoubleClick)
0084 {
0085 (void)thePoint;
0086 (void)theButton;
0087 (void)theModifiers;
0088 (void)theIsDoubleClick;
0089 return false;
0090 }
0091
0092
0093
0094 virtual bool IsHilighted(const occ::handle<PrsMgr_PresentationManager>& thePrsMgr,
0095 const int theMode = 0) const
0096 {
0097 return mySelectable != nullptr && thePrsMgr->IsHighlighted(mySelectable, theMode);
0098 }
0099
0100
0101
0102
0103
0104 Standard_EXPORT virtual void HilightWithColor(
0105 const occ::handle<PrsMgr_PresentationManager>& thePrsMgr,
0106 const occ::handle<Prs3d_Drawer>& theStyle,
0107 const int theMode = 0);
0108
0109
0110
0111
0112
0113 virtual void Unhilight(const occ::handle<PrsMgr_PresentationManager>& thePrsMgr,
0114 const int theMode = 0)
0115 {
0116 (void)theMode;
0117 if (mySelectable != nullptr)
0118 {
0119 thePrsMgr->Unhighlight(mySelectable);
0120 }
0121 }
0122
0123
0124
0125 virtual void Clear(const occ::handle<PrsMgr_PresentationManager>& thePrsMgr,
0126 const int theMode = 0)
0127 {
0128 (void)thePrsMgr;
0129 (void)theMode;
0130 }
0131
0132
0133 virtual bool HasLocation() const
0134 {
0135 return mySelectable != nullptr && mySelectable->HasTransformation();
0136 }
0137
0138
0139 virtual TopLoc_Location Location() const
0140 {
0141 return mySelectable != nullptr && mySelectable->HasTransformation()
0142 ? TopLoc_Location(mySelectable->Transformation())
0143 : TopLoc_Location();
0144 }
0145
0146
0147 virtual void SetLocation(const TopLoc_Location& theLocation) { (void)theLocation; }
0148
0149
0150 bool IsSelected() const { return myIsSelected; }
0151
0152
0153
0154 void SetSelected(const bool theIsSelected) { myIsSelected = theIsSelected; }
0155
0156
0157
0158
0159 Standard_EXPORT bool Select(const AIS_SelectionScheme theSelScheme,
0160 const bool theIsDetected) const;
0161
0162
0163 Standard_DEPRECATED("Deprecated method - IsSelected() should be used instead")
0164 int State() const { return myIsSelected ? 1 : 0; }
0165
0166
0167
0168 void State(const int theStatus) { myIsSelected = (theStatus == 1); }
0169
0170
0171
0172 virtual bool IsAutoHilight() const
0173 {
0174 return mySelectable == nullptr || mySelectable->IsAutoHilight();
0175 }
0176
0177
0178
0179 virtual bool IsForcedHilight() const { return false; }
0180
0181
0182 virtual void SetZLayer(const Graphic3d_ZLayerId theLayerId) { (void)theLayerId; }
0183
0184
0185
0186 virtual void UpdateHighlightTrsf(const occ::handle<V3d_Viewer>& theViewer,
0187 const occ::handle<PrsMgr_PresentationManager>& theManager,
0188 const int theDispMode)
0189 {
0190 if (mySelectable != nullptr)
0191 {
0192 theManager->UpdateHighlightTrsf(theViewer, mySelectable, theDispMode);
0193 }
0194 }
0195
0196
0197 bool IsSameSelectable(const occ::handle<SelectMgr_SelectableObject>& theOther) const
0198 {
0199 return mySelectable == theOther.get();
0200 }
0201
0202
0203 bool ComesFromDecomposition() const { return myFromDecomposition; }
0204
0205
0206 void SetComesFromDecomposition(const bool theIsFromDecomposition)
0207 {
0208 myFromDecomposition = theIsFromDecomposition;
0209 }
0210
0211
0212 Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const;
0213
0214 public:
0215
0216 Standard_DEPRECATED("Deprecated method - SetSelectable() should be used instead")
0217 void Set(const occ::handle<SelectMgr_SelectableObject>& theSelObj) { SetSelectable(theSelObj); }
0218
0219
0220 Standard_DEPRECATED("Deprecated method - SetPriority() should be used instead")
0221 void Set(const int thePriority) { SetPriority(thePriority); }
0222
0223 protected:
0224 SelectMgr_SelectableObject* mySelectable;
0225
0226 int mypriority;
0227 bool myIsSelected;
0228 bool myFromDecomposition;
0229
0230 };
0231
0232 #endif