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