Warning, file /include/opencascade/AIS_LightSource.hxx was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _AIS_LightSource_HeaderFile
0017 #define _AIS_LightSource_HeaderFile
0018
0019 #include <AIS_InteractiveObject.hxx>
0020 #include <Graphic3d_AspectLine3d.hxx>
0021 #include <Graphic3d_AspectMarker3d.hxx>
0022 #include <SelectMgr_EntityOwner.hxx>
0023
0024 class Select3D_SensitiveSphere;
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 class AIS_LightSource : public AIS_InteractiveObject
0035 {
0036 friend class AIS_LightSourceOwner;
0037 DEFINE_STANDARD_RTTIEXT(AIS_LightSource, AIS_InteractiveObject)
0038 public:
0039
0040 Standard_EXPORT AIS_LightSource(const occ::handle<Graphic3d_CLight>& theLightSource);
0041
0042
0043 const occ::handle<Graphic3d_CLight>& Light() const { return myLightSource; }
0044
0045
0046 void SetLight(const occ::handle<Graphic3d_CLight>& theLight)
0047 {
0048 myLightSource = theLight;
0049 SetToUpdate();
0050 }
0051
0052 public:
0053
0054 bool ToDisplayName() const { return myToDisplayName; }
0055
0056
0057 void SetDisplayName(bool theToDisplay)
0058 {
0059 if (myToDisplayName != theToDisplay)
0060 {
0061 myToDisplayName = theToDisplay;
0062 SetToUpdate();
0063 }
0064 }
0065
0066
0067
0068 bool ToDisplayRange() const { return myToDisplayRange; }
0069
0070
0071 void SetDisplayRange(bool theToDisplay)
0072 {
0073 if (myToDisplayRange != theToDisplay)
0074 {
0075 myToDisplayRange = theToDisplay;
0076 SetToUpdate();
0077 }
0078 }
0079
0080
0081 double Size() const { return mySize; }
0082
0083
0084 void SetSize(double theSize)
0085 {
0086 if (mySize != theSize)
0087 {
0088 mySize = theSize;
0089 SetToUpdate();
0090 }
0091 }
0092
0093
0094 int ArcSize() const { return mySensSphereArcSize; }
0095
0096
0097 void SetArcSize(int theSize)
0098 {
0099 if (mySensSphereArcSize != theSize)
0100 {
0101 mySensSphereArcSize = theSize;
0102 SetToUpdate();
0103 }
0104 }
0105
0106
0107
0108
0109 bool IsZoomable() const { return myIsZoomable; }
0110
0111
0112 void SetZoomable(bool theIsZoomable)
0113 {
0114 if (myIsZoomable != theIsZoomable)
0115 {
0116 myIsZoomable = theIsZoomable;
0117 SetToUpdate();
0118 }
0119 }
0120
0121
0122 void SetDraggable(bool theIsDraggable)
0123 {
0124 if (myIsDraggable != theIsDraggable)
0125 {
0126 myIsDraggable = theIsDraggable;
0127 }
0128 }
0129
0130
0131 bool ToSwitchOnClick() const { return myToSwitchOnClick; }
0132
0133
0134 void SetSwitchOnClick(bool theToHandle) { myToSwitchOnClick = theToHandle; }
0135
0136
0137 int NbArrows() const { return myNbArrows; }
0138
0139
0140 void SetNbArrows(int theNbArrows)
0141 {
0142 if (myNbArrows != theNbArrows)
0143 {
0144 myNbArrows = theNbArrows;
0145 SetToUpdate();
0146 }
0147 }
0148
0149
0150
0151 const occ::handle<Graphic3d_MarkerImage>& MarkerImage(bool theIsEnabled) const
0152 {
0153 return myMarkerImages[theIsEnabled ? 1 : 0];
0154 }
0155
0156
0157
0158 Aspect_TypeOfMarker MarkerType(bool theIsEnabled) const
0159 {
0160 return myMarkerTypes[theIsEnabled ? 1 : 0];
0161 }
0162
0163
0164 void SetMarkerImage(const occ::handle<Graphic3d_MarkerImage>& theImage, bool theIsEnabled)
0165 {
0166 myMarkerImages[theIsEnabled ? 1 : 0] = theImage;
0167 myMarkerTypes[theIsEnabled ? 1 : 0] = !theImage.IsNull()
0168 ? Aspect_TOM_USERDEFINED
0169 : (theIsEnabled ? Aspect_TOM_O_POINT : Aspect_TOM_O_X);
0170 }
0171
0172
0173 void SetMarkerType(Aspect_TypeOfMarker theType, bool theIsEnabled)
0174 {
0175 myMarkerTypes[theIsEnabled ? 1 : 0] = theType;
0176 }
0177
0178
0179 int NbSplitsQuadric() const { return myNbSplitsQuadric; }
0180
0181
0182 void SetNbSplitsQuadric(int theNbSplits) { myNbSplitsQuadric = theNbSplits; }
0183
0184
0185 int NbSplitsArrow() const { return myNbSplitsArrow; }
0186
0187
0188 void SetNbSplitsArrow(int theNbSplits) { myNbSplitsArrow = theNbSplits; }
0189
0190
0191 AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_LightSource; }
0192
0193 protected:
0194
0195
0196 bool AcceptDisplayMode(const int theMode) const override { return theMode == 0 || theMode == 1; }
0197
0198
0199 Standard_EXPORT void Compute(const occ::handle<PrsMgr_PresentationManager>& thePrsMgr,
0200 const occ::handle<Prs3d_Presentation>& thePrs,
0201 const int theMode) override;
0202
0203
0204 Standard_EXPORT void ComputeSelection(const occ::handle<SelectMgr_Selection>& theSel,
0205 const int theMode) override;
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215 Standard_EXPORT bool ProcessDragging(const occ::handle<AIS_InteractiveContext>& theCtx,
0216 const occ::handle<V3d_View>& theView,
0217 const occ::handle<SelectMgr_EntityOwner>& theOwner,
0218 const NCollection_Vec2<int>& theDragFrom,
0219 const NCollection_Vec2<int>& theDragTo,
0220 const AIS_DragAction theAction) override;
0221
0222
0223 Standard_EXPORT void setLocalTransformation(const occ::handle<TopLoc_Datum3D>& theTrsf) override;
0224
0225
0226 Standard_EXPORT virtual void updateLightLocalTransformation();
0227
0228
0229 Standard_EXPORT virtual void updateLightTransformPersistence();
0230
0231
0232 Standard_EXPORT virtual void updateLightAspects();
0233
0234
0235 Standard_EXPORT virtual void computeAmbient(const occ::handle<Prs3d_Presentation>& thePrs,
0236 const int theMode);
0237
0238
0239 Standard_EXPORT virtual void computeDirectional(const occ::handle<Prs3d_Presentation>& thePrs,
0240 const int theMode);
0241
0242
0243
0244 Standard_EXPORT virtual void computePositional(const occ::handle<Prs3d_Presentation>& thePrs,
0245 const int theMode);
0246
0247
0248 Standard_EXPORT virtual void computeSpot(const occ::handle<Prs3d_Presentation>& thePrs,
0249 const int theMode);
0250
0251 protected:
0252 occ::handle<Graphic3d_CLight> myLightSource;
0253
0254
0255 occ::handle<Graphic3d_AspectMarker3d> myDisabledMarkerAspect;
0256 occ::handle<Graphic3d_AspectLine3d> myArrowLineAspectShadow;
0257 occ::handle<Graphic3d_MarkerImage> myMarkerImages[2];
0258 occ::handle<Select3D_SensitiveSphere> mySensSphere;
0259 Aspect_TypeOfMarker myMarkerTypes[2];
0260 Aspect_TypeOfMarker myCodirMarkerType;
0261 Aspect_TypeOfMarker myOpposMarkerType;
0262
0263 gp_Trsf myLocTrsfStart;
0264 double mySize;
0265 int myNbArrows;
0266 int myNbSplitsQuadric;
0267 int myNbSplitsArrow;
0268 int mySensSphereArcSize;
0269 bool myIsZoomable;
0270 bool myIsDraggable;
0271
0272 bool myToDisplayName;
0273 bool myToDisplayRange;
0274 bool myToSwitchOnClick;
0275 };
0276
0277
0278 class AIS_LightSourceOwner : public SelectMgr_EntityOwner
0279 {
0280 DEFINE_STANDARD_RTTIEXT(AIS_LightSourceOwner, SelectMgr_EntityOwner)
0281 public:
0282
0283 Standard_EXPORT AIS_LightSourceOwner(const occ::handle<AIS_LightSource>& theObject,
0284 int thePriority = 5);
0285
0286
0287 Standard_EXPORT bool HandleMouseClick(const NCollection_Vec2<int>& thePoint,
0288 Aspect_VKeyMouse theButton,
0289 Aspect_VKeyFlags theModifiers,
0290 bool theIsDoubleClick) override;
0291
0292
0293
0294
0295
0296 Standard_EXPORT void HilightWithColor(const occ::handle<PrsMgr_PresentationManager>& thePrsMgr,
0297 const occ::handle<Prs3d_Drawer>& theStyle,
0298 const int theMode) override;
0299
0300
0301 Standard_EXPORT bool IsForcedHilight() const override;
0302 };
0303
0304 #endif