#ifndef _PrsMgr_PresentableObject_HeaderFile
#define _PrsMgr_PresentableObject_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <PrsMgr_Presentations.hxx>
-#include <PrsMgr_TypeOfPresentation3d.hxx>
+#include <gp_GTrsf.hxx>
+#include <Graphic3d_ClipPlane.hxx>
#include <Graphic3d_SequenceOfHClipPlane.hxx>
-#include <Standard_Boolean.hxx>
+#include <Graphic3d_TransformPers.hxx>
+#include <Graphic3d_TransModeFlags.hxx>
#include <Graphic3d_ZLayerId.hxx>
-#include <PrsMgr_PresentableObjectPointer.hxx>
-#include <gp_GTrsf.hxx>
-#include <gp_Trsf.hxx>
#include <PrsMgr_ListOfPresentableObjects.hxx>
-#include <MMgt_TShared.hxx>
#include <PrsMgr_Presentation.hxx>
+#include <PrsMgr_Presentations.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
-#include <Standard_Integer.hxx>
-#include <Graphic3d_TransformPers.hxx>
-#include <Graphic3d_TransModeFlags.hxx>
+#include <PrsMgr_PresentableObjectPointer.hxx>
+#include <PrsMgr_TypeOfPresentation3d.hxx>
#include <TColStd_ListOfInteger.hxx>
-#include <Graphic3d_ClipPlane.hxx>
-class Standard_NotImplemented;
-class PrsMgr_Presentation;
-class PrsMgr_PresentationManager;
-class Graphic3d_Structure;
-class Graphic3d_DataStructureManager;
-class Geom_Transformation;
-class Prs3d_Presentation;
-class Prs3d_Projector;
-class gp_Pnt;
-class gp_Trsf;
-
-
-class PrsMgr_PresentableObject;
-DEFINE_STANDARD_HANDLE(PrsMgr_PresentableObject, MMgt_TShared)
//! A framework to supply the Graphic3d
//! structure of the object to be presented. On the first
//! creation of new interactive objects.
class PrsMgr_PresentableObject : public MMgt_TShared
{
-
+ DEFINE_STANDARD_RTTIEXT(PrsMgr_PresentableObject, MMgt_TShared)
public:
-
- Standard_EXPORT PrsMgr_Presentations& Presentations();
+ PrsMgr_Presentations& Presentations() { return myPresentations; }
//! Returns information on whether the object accepts display in HLR mode or not.
- PrsMgr_TypeOfPresentation3d TypeOfPresentation3d() const;
+ PrsMgr_TypeOfPresentation3d TypeOfPresentation3d() const { return myTypeOfPresentation3d; }
+
+ //! @return transform persistence of the presentable object.
+ const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myTransformPersistence; }
+
+ //! Sets up Transform Persistence for this object.
+ Standard_EXPORT virtual void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
//! Sets up Transform Persistence Mode for this object.
//! This function used to lock in object position, rotation and / or zooming relative to camera position.
- //! Object will be drawn in the origin setted by APoint parameter (except Graphic3d_TMF_TriedronPers flag
- //! - see description later). aFlag should be:
+ //! Object will be drawn in the origin setted by thePoint parameter (except Graphic3d_TMF_TriedronPers flag
+ //! - see description later). theMode should be:
//! - Graphic3d_TMF_None - no persistence attributes (reset);
- //! - Graphic3d_TMF_PanPers - object doesn't move;
//! - Graphic3d_TMF_ZoomPers - object doesn't resize;
//! - Graphic3d_TMF_RotatePers - object doesn't rotate;
- //! - Graphic3d_TMF_FullPers - pan, zoom and rotate transform persistence;
- //! - Graphic3d_TMF_TriedronPers - object behaves like trihedron;
- //! - combination (Graphic3d_TMF_PanPers | Graphic3d_TMF_ZoomPers);
- //! - combination (Graphic3d_TMF_PanPers | Graphic3d_TMF_RotatePers);
- //! - combination (Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers).
- //! If Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d persistence mode selected APoint coordinates X and Y means:
+ //! - Graphic3d_TMF_ZoomRotatePers - object doesn't resize and rotate;
+ //! - Graphic3d_TMF_RotatePers - object doesn't rotate;
+ //! - Graphic3d_TMF_TriedronPers - object behaves like trihedron.
+ //! If Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d persistence mode selected thePoint coordinates X and Y means:
//! - X = 0.0, Y = 0.0 - center of view window;
//! - X > 0.0, Y > 0.0 - right upper corner of view window;
//! - X > 0.0, Y < 0.0 - right lower corner of view window;
//! - X < 0.0, Y > 0.0 - left upper corner of view window;
//! - X < 0.0, Y < 0.0 - left lower corner of view window.
//! And Z coordinate defines the gap from border of view window (except center position).
- Standard_EXPORT virtual void SetTransformPersistence (const Graphic3d_TransModeFlags& aFlag, const gp_Pnt& APoint);
-
- //! Calls previous method with point (0,0,0)
- Standard_EXPORT void SetTransformPersistence (const Graphic3d_TransModeFlags& aFlag);
-
+ Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
+ void SetTransformPersistence (const Graphic3d_TransModeFlags theMode, const gp_Pnt& thePoint = gp_Pnt (0.0, 0.0, 0.0))
+ {
+ SetTransformPersistence (Graphic3d_TransformPers::FromDeprecatedParams (theMode, thePoint));
+ }
+
//! Gets Transform Persistence Mode for this object
- Standard_EXPORT Graphic3d_TransModeFlags GetTransformPersistenceMode() const;
-
+ Standard_DEPRECATED("This method is deprecated - TransformPersistence() should be called instead")
+ Graphic3d_TransModeFlags GetTransformPersistenceMode() const
+ {
+ return myTransformPersistence.IsNull()
+ ? Graphic3d_TMF_None
+ : myTransformPersistence->Mode();
+ }
+
//! Gets point of transform persistence for this object
+ Standard_DEPRECATED("This method is deprecated - TransformPersistence() should be called instead")
Standard_EXPORT gp_Pnt GetTransformPersistencePoint() const;
- //! @return transform persistence of the presentable object.
- const Graphic3d_TransformPers& TransformPersistence() const;
-
Standard_EXPORT void SetTypeOfPresentation (const PrsMgr_TypeOfPresentation3d aType);
//! flags the Prs of mode <AMode> to be Updated.
//! gives the list of modes which are flagged "to be updated".
Standard_EXPORT void ToBeUpdated (TColStd_ListOfInteger& ListOfMode) const;
+ //! Return the local transformation.
+ const Handle(Geom_Transformation)& LocalTransformationGeom() const { return myLocalTransformation; }
+
//! Sets local transformation to theTransformation.
- Standard_EXPORT virtual void SetLocalTransformation (const gp_Trsf& theTransformation);
-
+ void SetLocalTransformation (const gp_Trsf& theTrsf) { setLocalTransformation (new Geom_Transformation (theTrsf)); }
+
+ //! Sets local transformation to theTransformation.
+ void SetLocalTransformation (const Handle(Geom_Transformation)& theTrsf) { setLocalTransformation (theTrsf); }
+
//! Returns true if object has a transformation that is different from the identity.
- Standard_EXPORT Standard_Boolean HasTransformation() const;
-
- const gp_Trsf& LocalTransformation() const;
-
- const gp_Trsf& Transformation() const;
-
- const gp_GTrsf& InversedTransformation() const;
+ Standard_Boolean HasTransformation() const { return !myTransformation.IsNull() && myTransformation->Form() != gp_Identity; }
+
+ //! Return the transformation taking into account transformation of parent object(s).
+ const Handle(Geom_Transformation)& TransformationGeom() const { return myTransformation; }
+
+ //! Return the local transformation.
+ const gp_Trsf& LocalTransformation() const { return !myLocalTransformation.IsNull()
+ ? myLocalTransformation->Trsf()
+ : getIdentityTrsf(); }
+
+ //! Return the transformation taking into account transformation of parent object(s).
+ const gp_Trsf& Transformation() const { return !myTransformation.IsNull()
+ ? myTransformation->Trsf()
+ : getIdentityTrsf(); }
+
+ const gp_GTrsf& InversedTransformation() const { return myInvTransformation; }
//! resets local transformation to identity.
Standard_EXPORT virtual void ResetTransformation();
Standard_EXPORT virtual void RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane);
//! Set clip planes for graphical clipping for all display mode presentations.
- //! The composition of clip planes truncates the rendering space to convex
- //! volume. Please be aware that number of supported clip plane is limited.
- //! The planes which exceed the limit are ignored. Besides of this, some
- //! planes can be already set in view where the object is shown: the number
- //! of these planes should be substracted from limit to predict the maximum
+ //! The composition of clip planes truncates the rendering space to convex volume.
+ //! Please be aware that number of supported clip plane is limited.
+ //! The planes which exceed the limit are ignored.
+ //! Besides of this, some planes can be already set in view where the object is shown:
+ //! the number of these planes should be subtracted from limit to predict the maximum
//! possible number of object clipping planes.
- Standard_EXPORT virtual void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes);
-
+ Standard_EXPORT virtual void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes);
+
+ Standard_DEPRECATED("This method is deprecated - overload taking Handle should be used instead")
+ void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes)
+ {
+ Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = new Graphic3d_SequenceOfHClipPlane (thePlanes);
+ SetClipPlanes (aPlanes);
+ }
+
//! Get clip planes.
//! @return set of previously added clip planes for all display mode presentations.
- const Graphic3d_SequenceOfHClipPlane& GetClipPlanes() const;
-
+ const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const { return myClipPlanes; }
+
//! Sets if the object has mutable nature (content or location will be changed regularly).
//! This method should be called before object displaying to take effect.
Standard_EXPORT virtual void SetMutable (const Standard_Boolean theIsMutable);
//! Returns true if object has mutable nature (content or location are be changed regularly).
//! Mutable object will be managed in different way than static onces (another optimizations).
- Standard_EXPORT Standard_Boolean IsMutable() const;
+ Standard_Boolean IsMutable() const { return myIsMutable; }
//! Makes theObject child of current object in scene hierarchy.
Standard_EXPORT virtual void AddChild (const Handle(PrsMgr_PresentableObject)& theObject);
Standard_EXPORT virtual void RemoveChild (const Handle(PrsMgr_PresentableObject)& theObject);
//! Returns children of the current object.
- const PrsMgr_ListOfPresentableObjects& Children() const;
+ const PrsMgr_ListOfPresentableObjects& Children() const { return myChildren; }
//! Returns true if object should have own presentations.
- Standard_Boolean HasOwnPresentations() const;
+ Standard_Boolean HasOwnPresentations() const { return myHasOwnPresentations; }
//! Returns parent of current object in scene hierarchy.
- PrsMgr_PresentableObjectPointer Parent() const;
+ PrsMgr_PresentableObjectPointer Parent() const { return myParent; }
friend class PrsMgr_Presentation;
friend
Standard_EXPORT void PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, const Handle(Geom_Transformation)& theTrsf, const Handle(Graphic3d_Structure)& theGivenStruct);
-
- DEFINE_STANDARD_RTTIEXT(PrsMgr_PresentableObject,MMgt_TShared)
-
protected:
//! Sets myCombinedParentTransform to theTransformation. Thus object receives transformation
//! from parent node and able to derive its own.
- Standard_EXPORT virtual void SetCombinedParentTransform (const gp_Trsf& theTransformation);
+ Standard_EXPORT virtual void SetCombinedParentTransform (const Handle(Geom_Transformation)& theTrsf);
//! General virtual method for internal update of presentation state
//! when some modifications on list of clip planes occurs. Base
//! implementation propagate clip planes to every presentation.
Standard_EXPORT virtual void UpdateClipping();
+ //! Sets local transformation to theTransformation.
+ Standard_EXPORT virtual void setLocalTransformation (const Handle(Geom_Transformation)& theTransformation);
+
+private:
+
+ //! Return the identity transformation.
+ Standard_EXPORT static const gp_Trsf& getIdentityTrsf();
+
+protected:
+
PrsMgr_Presentations myPresentations;
PrsMgr_TypeOfPresentation3d myTypeOfPresentation3d;
- Graphic3d_SequenceOfHClipPlane myClipPlanes;
+ Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
Standard_Boolean myIsMutable;
Graphic3d_ZLayerId myZLayer;
Standard_Boolean myHasOwnPresentations;
-
private:
-
- Graphic3d_TransformPers myTransformPersistence;
+ Handle(Graphic3d_TransformPers) myTransformPersistence;
PrsMgr_PresentableObjectPointer myParent;
- gp_Trsf myLocalTransformation;
- gp_Trsf myTransformation;
+ Handle(Geom_Transformation) myLocalTransformation;
+ Handle(Geom_Transformation) myTransformation;
+ Handle(Geom_Transformation) myCombinedParentTransform;
gp_GTrsf myInvTransformation;
- gp_Trsf myCombinedParentTransform;
PrsMgr_ListOfPresentableObjects myChildren;
-
};
-
-#include <PrsMgr_PresentableObject.lxx>
-
-
-
-
+DEFINE_STANDARD_HANDLE(PrsMgr_PresentableObject, MMgt_TShared)
#endif // _PrsMgr_PresentableObject_HeaderFile