Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:41

0001 // Created on: 1995-01-25
0002 // Created by: Jean-Louis Frenkel
0003 // Copyright (c) 1995-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _PrsMgr_PresentableObject_HeaderFile
0018 #define _PrsMgr_PresentableObject_HeaderFile
0019 
0020 #include <Aspect_TypeOfFacingModel.hxx>
0021 #include <gp_GTrsf.hxx>
0022 #include <Graphic3d_ClipPlane.hxx>
0023 #include <Prs3d_Drawer.hxx>
0024 #include <PrsMgr_ListOfPresentableObjects.hxx>
0025 #include <PrsMgr_Presentation.hxx>
0026 #include <PrsMgr_Presentations.hxx>
0027 #include <PrsMgr_DisplayStatus.hxx>
0028 #include <PrsMgr_TypeOfPresentation3d.hxx>
0029 #include <TColStd_ListOfInteger.hxx>
0030 
0031 class PrsMgr_PresentationManager;
0032 Standard_DEPRECATED("Deprecated alias to PrsMgr_PresentationManager")
0033 typedef PrsMgr_PresentationManager PrsMgr_PresentationManager3d;
0034 
0035 //! A framework to supply the Graphic3d structure of the object to be presented.
0036 //! On the first display request, this structure is created by calling the appropriate algorithm and retaining this framework for further display.
0037 //! This abstract framework is inherited in Application Interactive Services (AIS), notably by AIS_InteractiveObject.
0038 //! Consequently, 3D presentation should be handled by the relevant daughter classes and their member functions in AIS.
0039 //! This is particularly true in the creation of new interactive objects.
0040 //!
0041 //! Key interface methods to be implemented by every Selectable Object:
0042 //! - AcceptDisplayMode() accepting display modes implemented by this object;
0043 //! - Compute() computing presentation for the given display mode index.
0044 //!
0045 //! Warning! Methods managing standard attributes (SetColor(), SetWidth(), SetMaterial()) have different meaning for objects of different type (or no meaning at all).
0046 //! Sub-classes might override these methods to modify Prs3d_Drawer or class properties providing a convenient short-cut depending on application needs.
0047 //! For more sophisticated configuring, Prs3d_Drawer should be modified directly, while short-cuts might be left unimplemented.
0048 class PrsMgr_PresentableObject : public Standard_Transient
0049 {
0050   DEFINE_STANDARD_RTTIEXT(PrsMgr_PresentableObject, Standard_Transient)
0051   friend class PrsMgr_Presentation;
0052   friend class PrsMgr_PresentationManager;
0053 public:
0054 
0055   //! Return presentations.
0056   PrsMgr_Presentations& Presentations() { return myPresentations; }
0057 
0058   //! Get ID of Z layer for main presentation.
0059   Graphic3d_ZLayerId ZLayer() const { return myDrawer->ZLayer(); }
0060 
0061   //! Set Z layer ID and update all presentations of the presentable object.
0062   //! The layers mechanism allows drawing objects in higher layers in overlay of objects in lower layers.
0063   Standard_EXPORT virtual void SetZLayer (const Graphic3d_ZLayerId theLayerId);
0064 
0065   //! Returns true if object has mutable nature (content or location are be changed regularly).
0066   //! Mutable object will be managed in different way than static onces (another optimizations).
0067   Standard_Boolean IsMutable() const { return myIsMutable; }
0068 
0069   //! Sets if the object has mutable nature (content or location will be changed regularly).
0070   //! This method should be called before object displaying to take effect.
0071   Standard_EXPORT virtual void SetMutable (const Standard_Boolean theIsMutable);
0072 
0073   //! Return view affinity mask.
0074   const Handle(Graphic3d_ViewAffinity)& ViewAffinity() const { return myViewAffinity; }
0075 
0076   //! Returns true if the Interactive Object has display mode setting overriding global setting (within Interactive Context).
0077   Standard_Boolean HasDisplayMode() const { return myDrawer->DisplayMode() != -1; }
0078 
0079   //! Returns the display mode setting of the Interactive Object.
0080   //! The range of supported display mode indexes should be specified within object definition and filtered by AccepDisplayMode().
0081   //! @sa AcceptDisplayMode()
0082   Standard_Integer DisplayMode() const { return myDrawer->DisplayMode(); }
0083 
0084   //! Sets the display mode for the interactive object.
0085   //! An object can have its own temporary display mode, which is different from that proposed by the interactive context.
0086   //! @sa AcceptDisplayMode()
0087   void SetDisplayMode (const Standard_Integer theMode)
0088   {
0089     if (AcceptDisplayMode (theMode))
0090     {
0091       myDrawer->SetDisplayMode (theMode);
0092     }
0093   }
0094 
0095   //! Removes display mode settings from the interactive object.
0096   void UnsetDisplayMode() { myDrawer->SetDisplayMode (-1); }
0097 
0098   //! Returns true if the Interactive Object is in highlight mode.
0099   //! @sa HilightAttributes()
0100   Standard_Boolean HasHilightMode() const { return !myHilightDrawer.IsNull() && myHilightDrawer->DisplayMode() != -1; }
0101 
0102   //! Returns highlight display mode.
0103   //! This is obsolete method for backward compatibility - use ::HilightAttributes() and ::DynamicHilightAttributes() instead.
0104   //! @sa HilightAttributes()
0105   Standard_Integer HilightMode() const { return !myHilightDrawer.IsNull() ? myHilightDrawer->DisplayMode() : -1; }
0106 
0107   //! Sets highlight display mode.
0108   //! This is obsolete method for backward compatibility - use ::HilightAttributes() and ::DynamicHilightAttributes() instead.
0109   //! @sa HilightAttributes()
0110   Standard_EXPORT void SetHilightMode (const Standard_Integer theMode);
0111 
0112   //! Unsets highlight display mode.
0113   //! @sa HilightAttributes()
0114   void UnsetHilightMode()
0115   {
0116     if (!myHilightDrawer.IsNull())
0117     {
0118       myHilightDrawer->SetDisplayMode (-1);
0119     }
0120     if (!myDynHilightDrawer.IsNull())
0121     {
0122       myDynHilightDrawer->SetDisplayMode (-1);
0123     }
0124   }
0125 
0126   //! Returns true if the class of objects accepts specified display mode index.
0127   //! The interactive context can have a default mode of representation for the set of Interactive Objects.
0128   //! This mode may not be accepted by a given class of objects.
0129   //! Consequently, this virtual method allowing us to get information about the class in question must be implemented.
0130   //! At least one display mode index should be accepted by this method.
0131   //! Although subclass can leave default implementation, it is highly desired defining exact list of supported modes instead,
0132   //! which is usually an enumeration for one object or objects class sharing similar list of display modes.
0133   virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const
0134   {
0135     (void )theMode;
0136     return Standard_True;
0137   }
0138 
0139   //! Returns the default display mode.
0140   virtual Standard_Integer DefaultDisplayMode() const { return 0; }
0141 
0142   //! Returns TRUE if any active presentation has invalidation flag.
0143   //! @param theToIncludeHidden when TRUE, also checks hidden presentations
0144   Standard_EXPORT Standard_Boolean ToBeUpdated (Standard_Boolean theToIncludeHidden = Standard_False) const;
0145 
0146   //! Flags presentation to be updated; UpdatePresentations() will recompute these presentations.
0147   //! @param theMode presentation (display mode) to invalidate, or -1 to invalidate them all
0148   Standard_EXPORT void SetToUpdate (Standard_Integer theMode);
0149 
0150   //! flags all the Presentations to be Updated.
0151   void SetToUpdate() { SetToUpdate (-1); }
0152 
0153   //! Returns true if the interactive object is infinite; FALSE by default.
0154   //! This flag affects various operations operating on bounding box of graphic presentations of this object.
0155   //! For instance, infinite objects are not taken in account for View FitAll.
0156   //! This does not necessarily means that object is actually infinite,
0157   //! auxiliary objects might be also marked with this flag to achieve desired behavior.
0158   Standard_Boolean IsInfinite() const { return myInfiniteState; }
0159 
0160   //! Sets if object should be considered as infinite.
0161   Standard_EXPORT void SetInfiniteState (const Standard_Boolean theFlag = Standard_True);
0162 
0163   //! Returns information on whether the object accepts display in HLR mode or not.
0164   PrsMgr_TypeOfPresentation3d TypeOfPresentation3d() const { return myTypeOfPresentation3d; }
0165 
0166   //! Set type of presentation.
0167   Standard_EXPORT void SetTypeOfPresentation (const PrsMgr_TypeOfPresentation3d theType);
0168 
0169   //! Return presentation display status; PrsMgr_DisplayStatus_None by default.
0170   PrsMgr_DisplayStatus DisplayStatus() const { return myDisplayStatus; }
0171 
0172 public: //! @name presentation attributes
0173 
0174   //! Returns the attributes settings.
0175   const Handle(Prs3d_Drawer)& Attributes() const { return myDrawer; }
0176 
0177   //! Initializes the drawing tool theDrawer.
0178   virtual void SetAttributes(const Handle(Prs3d_Drawer)& theDrawer) { myDrawer = theDrawer; }
0179 
0180   //! Returns the hilight attributes settings.
0181   //! When not NULL, overrides both Prs3d_TypeOfHighlight_LocalSelected and Prs3d_TypeOfHighlight_Selected defined within AIS_InteractiveContext::HighlightStyle().
0182   //! @sa AIS_InteractiveContext::HighlightStyle()
0183   const Handle(Prs3d_Drawer)& HilightAttributes() const { return myHilightDrawer; }
0184 
0185   //! Initializes the hilight drawing tool theDrawer.
0186   virtual void SetHilightAttributes(const Handle(Prs3d_Drawer)& theDrawer) { myHilightDrawer = theDrawer; }
0187 
0188   //! Returns the hilight attributes settings.
0189   //! When not NULL, overrides both Prs3d_TypeOfHighlight_LocalDynamic and Prs3d_TypeOfHighlight_Dynamic defined within AIS_InteractiveContext::HighlightStyle().
0190   //! @sa AIS_InteractiveContext::HighlightStyle()
0191   const Handle(Prs3d_Drawer)& DynamicHilightAttributes() const { return myDynHilightDrawer; }
0192 
0193   //! Initializes the dynamic hilight drawing tool.
0194   virtual void SetDynamicHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer) { myDynHilightDrawer = theDrawer; }
0195 
0196   //! Clears settings provided by the hilight drawing tool theDrawer.
0197   virtual void UnsetHilightAttributes() { myHilightDrawer.Nullify(); }
0198 
0199   //! Synchronize presentation aspects after their modification.
0200   //!
0201   //! This method should be called after modifying primitive aspect properties (material, texture, shader)
0202   //! so that modifications will take effect on already computed presentation groups (thus avoiding re-displaying the object).
0203   Standard_EXPORT void SynchronizeAspects();
0204 
0205 public: //! @name object transformation
0206 
0207   //! Returns Transformation Persistence defining a special Local Coordinate system where this presentable object is located or NULL handle if not defined.
0208   //! Position of the object having Transformation Persistence is mutable and depends on camera position.
0209   //! The same applies to a bounding box of the object.
0210   //! @sa Graphic3d_TransformPers class description
0211   const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myTransformPersistence; }
0212 
0213   //! Sets up Transform Persistence defining a special Local Coordinate system where this object should be located.
0214   //! Note that management of Transform Persistence object is more expensive than of the normal one,
0215   //! because it requires its position being recomputed basing on camera position within each draw call / traverse.
0216   //! @sa Graphic3d_TransformPers class description
0217   Standard_EXPORT virtual void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
0218   
0219   //! Return the local transformation.
0220   //! Note that the local transformation of the object having Transformation Persistence
0221   //! is applied within Local Coordinate system defined by this Persistence.
0222   const Handle(TopLoc_Datum3D)& LocalTransformationGeom() const { return myLocalTransformation; }
0223 
0224   //! Sets local transformation to theTransformation.
0225   //! Note that the local transformation of the object having Transformation Persistence
0226   //! is applied within Local Coordinate system defined by this Persistence.
0227   void SetLocalTransformation (const gp_Trsf& theTrsf) { setLocalTransformation (new TopLoc_Datum3D (theTrsf)); }
0228 
0229   //! Sets local transformation to theTransformation.
0230   //! Note that the local transformation of the object having Transformation Persistence
0231   //! is applied within Local Coordinate system defined by this Persistence.
0232   void SetLocalTransformation (const Handle(TopLoc_Datum3D)& theTrsf) { setLocalTransformation (theTrsf); }
0233 
0234   //! Returns true if object has a transformation that is different from the identity.
0235   Standard_Boolean HasTransformation() const { return !myTransformation.IsNull() && myTransformation->Form() != gp_Identity; }
0236 
0237   //! Return the transformation taking into account transformation of parent object(s).
0238   //! Note that the local transformation of the object having Transformation Persistence
0239   //! is applied within Local Coordinate system defined by this Persistence.
0240   const Handle(TopLoc_Datum3D)& TransformationGeom() const { return myTransformation; }
0241 
0242   //! Return the local transformation.
0243   //! Note that the local transformation of the object having Transformation Persistence
0244   //! is applied within Local Coordinate system defined by this Persistence.
0245   const gp_Trsf& LocalTransformation() const { return !myLocalTransformation.IsNull()
0246                                                      ? myLocalTransformation->Trsf()
0247                                                      : getIdentityTrsf(); }
0248 
0249   //! Return the transformation taking into account transformation of parent object(s).
0250   //! Note that the local transformation of the object having Transformation Persistence
0251   //! is applied within Local Coordinate system defined by this Persistence.
0252   const gp_Trsf& Transformation() const { return !myTransformation.IsNull()
0253                                                 ? myTransformation->Trsf()
0254                                                 : getIdentityTrsf(); }
0255 
0256   //! Return inversed transformation.
0257   const gp_GTrsf& InversedTransformation() const { return myInvTransformation; }
0258 
0259   //! Return combined parent transformation.
0260   const Handle(TopLoc_Datum3D)& CombinedParentTransformation() const { return myCombinedParentTransform; }
0261 
0262   //! resets local transformation to identity.
0263   Standard_EXPORT virtual void ResetTransformation();
0264 
0265   //! Updates final transformation (parent + local) of presentable object and its presentations.
0266   Standard_EXPORT virtual void UpdateTransformation();
0267 
0268 public: //! @name clipping planes
0269   
0270   //! Get clip planes.
0271   //! @return set of previously added clip planes for all display mode presentations.
0272   const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const { return myClipPlanes; }
0273 
0274   //! Set clip planes for graphical clipping for all display mode presentations.
0275   //! The composition of clip planes truncates the rendering space to convex volume.
0276   //! Please be aware that number of supported clip plane is limited.
0277   //! The planes which exceed the limit are ignored.
0278   //! Besides of this, some planes can be already set in view where the object is shown:
0279   //! the number of these planes should be subtracted from limit to predict the maximum
0280   //! possible number of object clipping planes.
0281   Standard_EXPORT virtual void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes);
0282 
0283   //! Adds clip plane for graphical clipping for all display mode
0284   //! presentations. The composition of clip planes truncates the rendering
0285   //! space to convex volume. Please be aware that number of supported
0286   //! clip plane is limited. The planes which exceed the limit are ignored.
0287   //! Besides of this, some planes can be already set in view where the object
0288   //! is shown: the number of these planes should be subtracted from limit
0289   //! to predict the maximum possible number of object clipping planes.
0290   //! @param thePlane [in] the clip plane to be appended to map of clip planes.
0291   Standard_EXPORT virtual void AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
0292 
0293   //! Removes previously added clip plane.
0294   //! @param thePlane [in] the clip plane to be removed from map of clip planes.
0295   Standard_EXPORT virtual void RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
0296 
0297 public: //! @name parent/children properties
0298 
0299   //! Returns parent of current object in scene hierarchy.
0300   PrsMgr_PresentableObject* Parent() const { return myParent; }
0301 
0302   //! Returns children of the current object.
0303   const PrsMgr_ListOfPresentableObjects& Children() const { return myChildren; }
0304 
0305   //! Makes theObject child of current object in scene hierarchy.
0306   Standard_EXPORT virtual void AddChild (const Handle(PrsMgr_PresentableObject)& theObject);
0307 
0308   //! Makes theObject child of current object in scene hierarchy with keeping the current global transformation
0309   //! So the object keeps the same position/orientation in the global CS.
0310   Standard_EXPORT void AddChildWithCurrentTransformation(const Handle(PrsMgr_PresentableObject)& theObject);
0311 
0312   //! Removes theObject from children of current object in scene hierarchy.
0313   Standard_EXPORT virtual void RemoveChild (const Handle(PrsMgr_PresentableObject)& theObject);
0314 
0315   //! Removes theObject from children of current object in scene hierarchy with keeping the current global transformation.
0316   //! So the object keeps the same position/orientation in the global CS.
0317   Standard_EXPORT void RemoveChildWithRestoreTransformation(const Handle(PrsMgr_PresentableObject)& theObject);
0318 
0319   //! Returns true if object should have own presentations.
0320   Standard_Boolean HasOwnPresentations() const { return myHasOwnPresentations; }
0321 
0322   //! Returns bounding box of object correspondingly to its current display mode.
0323   //! This method requires presentation to be already computed, since it relies on bounding box of presentation structures,
0324   //! which are supposed to be same/close amongst different display modes of this object.
0325   Standard_EXPORT virtual void BoundingBox (Bnd_Box& theBndBox);
0326 
0327 protected: //! @name interface methods
0328 
0329   //! Protected empty constructor.
0330   Standard_EXPORT PrsMgr_PresentableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
0331 
0332   //! Destructor.
0333   Standard_EXPORT virtual ~PrsMgr_PresentableObject();
0334 
0335   //! Fills the given 3D view presentation for specified display mode using Compute() method.
0336   //! In addition, configures other properties of presentation (transformation, clipping planes).
0337   //! @param thePrsMgr presentation manager where presentation has been created
0338   //! @param thePrs    presentation to fill
0339   //! @param theMode   display mode to compute; can be any number accepted by AcceptDisplayMode() method
0340   Standard_EXPORT virtual void Fill (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0341                                      const Handle(PrsMgr_Presentation)& thePrs,
0342                                      const Standard_Integer theMode);
0343 
0344   //! Calculates the 3D view presentation for specified display mode.
0345   //! This is a key interface for implementing Presentable Object interface.
0346   //! @param thePrsMgr presentation manager where presentation has been created
0347   //! @param thePrs    presentation to fill
0348   //! @param theMode   display mode to compute; can be any number accepted by AcceptDisplayMode() method
0349   //! @sa AcceptDisplayMode()
0350   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0351                                         const Handle(Prs3d_Presentation)& thePrs,
0352                                         const Standard_Integer theMode) = 0;
0353 
0354   //! Calculates hidden line removal presentation for specific camera position.
0355   //! Each of the views in the viewer and every modification such as rotation, for example, entails recalculation.
0356   //! Default implementation throws Standard_NotImplemented exception
0357   //! Warning! The transformation must be applied to the object before computation.
0358   //! @param theProjector [in] view orientation
0359   //! @param theTrsf [in] additional transformation, or NULL if undefined
0360   //! @param thePrs  [in] presentation to fill
0361   Standard_EXPORT virtual void computeHLR (const Handle(Graphic3d_Camera)& theProjector,
0362                                            const Handle(TopLoc_Datum3D)& theTrsf,
0363                                            const Handle(Prs3d_Presentation)& thePrs);
0364 
0365   //! Recomputes invalidated presentations of the object.
0366   //! @param theToIncludeHidden if TRUE, then even hidden invalidated presentations will be updated
0367   //! @return TRUE if some presentations were recomputed
0368   Standard_EXPORT Standard_Boolean UpdatePresentations (Standard_Boolean theToIncludeHidden = Standard_False);
0369 
0370   //! General virtual method for internal update of presentation state
0371   //! when some modifications on list of clip planes occurs. Base
0372   //! implementation propagate clip planes to every presentation.
0373   Standard_EXPORT virtual void UpdateClipping();
0374 
0375   //! Sets myCombinedParentTransform to theTransformation. Thus object receives transformation
0376   //! from parent node and able to derive its own.
0377   Standard_EXPORT virtual void SetCombinedParentTransform (const Handle(TopLoc_Datum3D)& theTrsf);
0378 
0379   //! Sets local transformation to theTransformation.
0380   Standard_EXPORT virtual void setLocalTransformation (const Handle(TopLoc_Datum3D)& theTransformation);
0381 
0382   //! Return the identity transformation.
0383   Standard_EXPORT static const gp_Trsf& getIdentityTrsf();
0384 
0385   //! Recompute computed (HLR) presentations (when view is in computed mode).
0386   Standard_EXPORT void recomputeComputed() const;
0387 
0388   //! Replace aspects of existing (computed) presentation groups,
0389   //! so that the new aspects can be applied without recomputing presentation.
0390   //! It is NOT recommended approach, because user has to fill such map and then search for each occurrence in computed groups.
0391   //! The recommended approach is computing presentation with necessary customized aspects,
0392   //! and then modify them directly followed by SynchronizeAspects() call.
0393   Standard_EXPORT void replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap);
0394 
0395 public: //! @name simplified presentation properties API
0396 
0397   //! Enables or disables on-triangulation build of isolines according to the flag given.
0398   void SetIsoOnTriangulation (const Standard_Boolean theIsEnabled) { myDrawer->SetIsoOnTriangulation (theIsEnabled); }
0399 
0400   //! Returns the current facing model which is in effect.
0401   Aspect_TypeOfFacingModel CurrentFacingModel() const { return myCurrentFacingModel; }
0402 
0403   //! change the current facing model apply on polygons for SetColor(), SetTransparency(), SetMaterial() methods default facing model is Aspect_TOFM_TWO_SIDE.
0404   //! This mean that attributes is applying both on the front and back face.
0405   void SetCurrentFacingModel (const Aspect_TypeOfFacingModel theModel = Aspect_TOFM_BOTH_SIDE) { myCurrentFacingModel = theModel; }
0406 
0407   //! Returns true if the Interactive Object has color.
0408   Standard_Boolean HasColor() const { return hasOwnColor; }
0409 
0410   //! Returns the color setting of the Interactive Object.
0411   virtual void Color (Quantity_Color& theColor) const { theColor = myDrawer->Color(); }
0412 
0413   //! Only the interactive object knowns which Drawer attribute is affected by the color, if any
0414   //! (ex: for a wire,it's the wireaspect field of the drawer, but for a vertex, only the point aspect field is affected by the color).
0415   //! WARNING : Do not forget to set the corresponding fields here (hasOwnColor and myDrawer->SetColor())
0416   virtual void SetColor (const Quantity_Color& theColor)
0417   {
0418     myDrawer->SetColor (theColor);
0419     hasOwnColor = Standard_True;
0420   }
0421 
0422   //! Removes color settings. Only the Interactive Object
0423   //! knows which Drawer attribute is   affected by the color
0424   //! setting. For a wire, for example, wire aspect is the
0425   //! attribute affected. For a vertex, however, only point
0426   //! aspect is affected by the color setting.
0427   virtual void UnsetColor() { hasOwnColor = Standard_False; }
0428 
0429   //! Returns true if the Interactive Object has width.
0430   Standard_Boolean HasWidth() const { return myOwnWidth != 0.0f; }
0431 
0432   //! Returns the width setting of the Interactive Object.
0433   Standard_Real Width() const { return myOwnWidth; }
0434 
0435   //! Allows you to provide the setting aValue for width.
0436   //! Only the Interactive Object knows which Drawer attribute is affected by the width setting.
0437   virtual void SetWidth (const Standard_Real theWidth) { myOwnWidth = (Standard_ShortReal )theWidth; }
0438 
0439   //! Reset width to default value.
0440   virtual void UnsetWidth() { myOwnWidth = 0.0f; }
0441 
0442   //! Returns true if the Interactive Object has a setting for material.
0443   Standard_Boolean HasMaterial() const { return hasOwnMaterial; }
0444 
0445   //! Returns the current material setting as enumeration value.
0446   Standard_EXPORT virtual Graphic3d_NameOfMaterial Material() const;
0447 
0448   //! Sets the material aMat defining this display attribute
0449   //! for the interactive object.
0450   //! Material aspect determines shading aspect, color and
0451   //! transparency of visible entities.
0452   Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& aName);
0453 
0454   //! Removes the setting for material.
0455   Standard_EXPORT virtual void UnsetMaterial();
0456 
0457   //! Returns true if there is a transparency setting.
0458   Standard_Boolean IsTransparent() const { return myDrawer->Transparency() > 0.005f; }
0459 
0460   //! Returns the transparency setting.
0461   //! This will be between 0.0 and 1.0.
0462   //! At 0.0 an object will be totally opaque, and at 1.0, fully transparent.
0463   virtual Standard_Real Transparency() const { return (myDrawer->Transparency() <= 0.005f ? 0.0 : myDrawer->Transparency()); }
0464 
0465   //! Attributes a setting aValue for transparency.
0466   //! The transparency value should be between 0.0 and 1.0.
0467   //! At 0.0 an object will be totally opaque, and at 1.0, fully transparent.
0468   //! Warning At a value of 1.0, there may be nothing visible.
0469   Standard_EXPORT virtual void SetTransparency (const Standard_Real aValue = 0.6);
0470 
0471   //! Removes the transparency setting. The object is opaque by default.
0472   Standard_EXPORT virtual void UnsetTransparency();
0473 
0474   //! Returns Standard_True if <myDrawer> has non-null shading aspect
0475   Standard_EXPORT virtual Standard_Boolean HasPolygonOffsets() const;
0476 
0477   //! Retrieves current polygon offsets settings from <myDrawer>.
0478   Standard_EXPORT virtual void PolygonOffsets (Standard_Integer& aMode, Standard_ShortReal& aFactor, Standard_ShortReal& aUnits) const;
0479 
0480   //! Sets up polygon offsets for this object.
0481   //! @sa Graphic3d_Aspects::SetPolygonOffsets()
0482   Standard_EXPORT virtual void SetPolygonOffsets (const Standard_Integer aMode, const Standard_ShortReal aFactor = 1.0, const Standard_ShortReal aUnits = 0.0);
0483 
0484   //! Clears settings provided by the drawing tool aDrawer.
0485   Standard_EXPORT virtual void UnsetAttributes();
0486 
0487   //! Dumps the content of me into the stream
0488   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0489 
0490 public: //! @name deprecated methods
0491 
0492   //! gives the list of modes which are flagged "to be updated".
0493   Standard_DEPRECATED("This method is deprecated - UpdatePresentations() should be called instead")
0494   Standard_EXPORT void ToBeUpdated (TColStd_ListOfInteger& ListOfMode) const;
0495 
0496   //! Get value of the flag "propagate visual state"
0497   //! It means that the display/erase/color visual state is propagated automatically to all children;
0498   //! by default, the flag is true 
0499   Standard_Boolean ToPropagateVisualState() const { return myToPropagateVisualState; }
0500 
0501   //! Change the value of the flag "propagate visual state"
0502   void SetPropagateVisualState(const Standard_Boolean theFlag) { myToPropagateVisualState = theFlag; }
0503 
0504 protected:
0505 
0506   //! Recomputes all presentations of the object.
0507   Standard_DEPRECATED("This method is deprecated - SetToUpdate() + UpdatePresentations() should be called instead")
0508   void Update (Standard_Boolean theToIncludeHidden = Standard_False)
0509   {
0510     SetToUpdate();
0511     UpdatePresentations (theToIncludeHidden);
0512   }
0513 
0514   //! Recomputes the presentation in the given mode.
0515   //! @param theMode presentation (display mode) to recompute
0516   //! @param theToClearOther when TRUE, other presentations (display modes) will be removed
0517   Standard_DEPRECATED("This method is deprecated - SetToUpdate() + UpdatePresentations() should be called instead")
0518   Standard_EXPORT void Update (Standard_Integer theMode, Standard_Boolean theToClearOther);
0519 
0520 protected:
0521 
0522   PrsMgr_PresentableObject*              myParent;                  //!< pointer to the parent object
0523   PrsMgr_Presentations                   myPresentations;           //!< list of presentations
0524   Handle(Graphic3d_ViewAffinity)         myViewAffinity;            //!< view affinity mask
0525   Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;              //!< sequence of object-specific clipping planes
0526   Handle(Prs3d_Drawer)                   myDrawer;                  //!< main presentation attributes
0527   Handle(Prs3d_Drawer)                   myHilightDrawer;           //!< (optional) custom presentation attributes for highlighting selected object
0528   Handle(Prs3d_Drawer)                   myDynHilightDrawer;        //!< (optional) custom presentation attributes for highlighting detected object
0529   Handle(Graphic3d_TransformPers)        myTransformPersistence;    //!< transformation persistence
0530   Handle(TopLoc_Datum3D)                 myLocalTransformation;     //!< local transformation relative to parent object
0531   Handle(TopLoc_Datum3D)                 myTransformation;          //!< absolute transformation of this object (combined parents + local transformations)
0532   Handle(TopLoc_Datum3D)                 myCombinedParentTransform; //!< transformation of parent object (combined for all parents)
0533   PrsMgr_ListOfPresentableObjects        myChildren;                //!< list of children
0534   gp_GTrsf                               myInvTransformation;       //!< inversion of absolute transformation (combined parents + local transformations)
0535   PrsMgr_TypeOfPresentation3d            myTypeOfPresentation3d;    //!< presentation type
0536   PrsMgr_DisplayStatus                   myDisplayStatus;           //!< presentation display status
0537 
0538   Aspect_TypeOfFacingModel               myCurrentFacingModel;      //!< current facing model
0539   Standard_ShortReal                     myOwnWidth;                //!< custom width value
0540   Standard_Boolean                       hasOwnColor;               //!< own color flag
0541   Standard_Boolean                       hasOwnMaterial;            //!< own material flag
0542 
0543   Standard_Boolean                       myInfiniteState;           //!< infinite flag
0544   Standard_Boolean                       myIsMutable;               //!< mutable flag
0545   Standard_Boolean                       myHasOwnPresentations;     //!< flag indicating if object should have own presentations
0546 
0547   Standard_Boolean                       myToPropagateVisualState;  //!< flag indicating if visual state (display/erase/color) should be propagated to all children
0548 };
0549 
0550 DEFINE_STANDARD_HANDLE(PrsMgr_PresentableObject, Standard_Transient)
0551 
0552 #endif // _PrsMgr_PresentableObject_HeaderFile