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