#ifndef _Graphic3d_Structure_HeaderFile
#define _Graphic3d_Structure_HeaderFile
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
+#include <Graphic3d_BndBox4f.hxx>
+#include <Graphic3d_BndBox4d.hxx>
#include <Graphic3d_CStructure.hxx>
-#include <Graphic3d_IndexedMapOfAddress.hxx>
-#include <Quantity_Color.hxx>
-#include <Aspect_TypeOfHighlightMethod.hxx>
-#include <Graphic3d_StructureManagerPtr.hxx>
-#include <Standard_Address.hxx>
-#include <Graphic3d_TypeOfStructure.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <Graphic3d_ZLayerId.hxx>
-#include <Graphic3d_SequenceOfHClipPlane.hxx>
-#include <Standard_Real.hxx>
-#include <TColStd_Array2OfReal.hxx>
-#include <Graphic3d_SequenceOfGroup.hxx>
-#include <Graphic3d_TypeOfConnection.hxx>
#include <Graphic3d_MapOfStructure.hxx>
+#include <Graphic3d_SequenceOfGroup.hxx>
+#include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <Graphic3d_TypeOfComposition.hxx>
+#include <Graphic3d_TypeOfConnection.hxx>
+#include <Graphic3d_TypeOfStructure.hxx>
+#include <Graphic3d_TransformPers.hxx>
#include <Graphic3d_TransModeFlags.hxx>
-#include <Graphic3d_BndBox4f.hxx>
-#include <Graphic3d_BndBox4d.hxx>
#include <Graphic3d_Vertex.hxx>
-class Graphic3d_PriorityDefinitionError;
-class Graphic3d_StructureDefinitionError;
-class Graphic3d_TransformError;
-class Graphic3d_Group;
+#include <Graphic3d_ZLayerId.hxx>
+#include <NCollection_IndexedMap.hxx>
+
class Graphic3d_StructureManager;
-class Quantity_Color;
-class Graphic3d_AspectLine3d;
-class Graphic3d_AspectFillArea3d;
-class Graphic3d_AspectText3d;
-class Graphic3d_AspectMarker3d;
class Graphic3d_DataStructureManager;
class Bnd_Box;
class gp_Pnt;
-class Graphic3d_Vector;
-
-class Graphic3d_Structure;
-DEFINE_STANDARD_HANDLE(Graphic3d_Structure, MMgt_TShared)
+DEFINE_STANDARD_HANDLE(Graphic3d_Structure, Standard_Transient)
//! This class allows the definition a graphic object.
-//! This graphic structure can be displayed,
-//! erased, or highlighted.
-//! This graphic structure can be connected with
-//! another graphic structure.
-//! Keywords: Structure, StructureManager, Display, Erase, Highlight,
-//! UnHighlight, Visible, Priority, Selectable, Visible,
-//! Visual, Connection, Ancestors, Descendants, Transformation
-class Graphic3d_Structure : public MMgt_TShared
+//! This graphic structure can be displayed, erased, or highlighted.
+//! This graphic structure can be connected with another graphic structure.
+class Graphic3d_Structure : public Standard_Transient
{
-
+ DEFINE_STANDARD_RTTIEXT(Graphic3d_Structure, Standard_Transient)
+ friend class Graphic3d_Group;
public:
-
//! Creates a graphic object in the manager theManager.
//! It will appear in all the views of the visualiser.
- //! Warning: The default values AspectLine, AspectFillArea, AspectText and AspectMarker are NOT applied to the structure.
//! The structure is not displayed when it is created.
- Standard_EXPORT Graphic3d_Structure(const Handle(Graphic3d_StructureManager)& theManager);
-
- //! Creates a shadow link to existing graphic object.
- Standard_EXPORT Graphic3d_Structure(const Handle(Graphic3d_StructureManager)& theManager, const Handle(Graphic3d_Structure)& thePrs);
+ //! @param theManager structure manager holding this structure
+ //! @param theLinkPrs another structure for creating a shadow (linked) structure
+ Standard_EXPORT Graphic3d_Structure (const Handle(Graphic3d_StructureManager)& theManager,
+ const Handle(Graphic3d_Structure)& theLinkPrs = Handle(Graphic3d_Structure)());
//! if WithDestruction == Standard_True then
//! suppress all the groups of primitives in the structure.
//! The structure itself is conserved.
//! The transformation and the attributes of <me> are conserved.
//! The childs of <me> are conserved.
- Standard_EXPORT virtual void Clear (const Standard_Boolean WithDestruction = Standard_True);
+ virtual void Clear (const Standard_Boolean WithDestruction = Standard_True)
+ {
+ clear (WithDestruction);
+ }
//! Suppresses the structure <me>.
//! It will be erased at the next screen update.
- Standard_EXPORT virtual void Destroy();
-~Graphic3d_Structure()
-{
- Destroy();
-}
+ Standard_EXPORT virtual ~Graphic3d_Structure();
//! Displays the structure <me> in all the views of the visualiser.
Standard_EXPORT virtual void Display();
+
+ //! Returns the current display priority for this structure.
+ Standard_Integer DisplayPriority() const { return myCStructure->Priority; }
- //! Returns the current display priority for the
- //! structure <me>.
- Standard_EXPORT Standard_Integer DisplayPriority() const;
-
- //! Erases the structure <me> in all the views
- //! of the visualiser.
- Standard_EXPORT virtual void Erase();
+ //! Erases this structure in all the views of the visualiser.
+ virtual void Erase() { erase(); }
- //! Highlights the structure <me> in all the views of the visualiser, using the following methods:
- //! TOHM_COLOR = drawn in the highlight color
- //! TOHM_BOUNDBOX = enclosed by the boundary box
- Standard_EXPORT void Highlight (const Aspect_TypeOfHighlightMethod theMethod, const Quantity_Color& theColor, const Standard_Boolean theToUpdateMgr = Standard_True);
+ //! Highlights the structure in all the views with the given style
+ //! @param theStyle [in] the style (type of highlighting: box/color, color and opacity)
+ //! @param theToUpdateMgr [in] defines whether related computed structures will be
+ //! highlighted via structure manager or not
+ Standard_EXPORT void Highlight (const Handle(Graphic3d_PresentationAttributes)& theStyle, const Standard_Boolean theToUpdateMgr = Standard_True);
//! Suppress the structure <me>.
//! It will be erased at the next screen update.
Standard_EXPORT void Remove();
//! Computes axis-aligned bounding box of a structure.
- //! Category: Methods to modify the class definition
- Standard_EXPORT void CalculateBoundBox();
+ Standard_EXPORT virtual void CalculateBoundBox();
- //! If <theToSet> is Standard_True then <me> is infinite and
- //! the MinMaxValues method method return :
+ //! Sets infinite flag.
+ //! When TRUE, the MinMaxValues method returns:
//! theXMin = theYMin = theZMin = RealFirst().
//! theXMax = theYMax = theZMax = RealLast().
- //! By default, <me> is not infinite but empty.
- Standard_EXPORT void SetInfiniteState (const Standard_Boolean theToSet);
-
+ //! By default, structure is created not infinite but empty.
+ void SetInfiniteState (const Standard_Boolean theToSet) { myCStructure->IsInfinite = theToSet ? 1 : 0; }
+
//! Modifies the order of displaying the structure.
//! Values are between 0 and 10.
//! Structures are drawn according to their display priorities
//! test between layers
Standard_EXPORT void SetZLayer (const Graphic3d_ZLayerId theLayerId);
- //! Get Z layer ID of displayed structure. The method
- //! returns -1 if the structure has no ID (deleted from graphic driver).
- Standard_EXPORT Graphic3d_ZLayerId GetZLayer() const;
+ //! Get Z layer ID of displayed structure.
+ //! The method returns -1 if the structure has no ID (deleted from graphic driver).
+ Graphic3d_ZLayerId GetZLayer() const { return myCStructure->ZLayer(); }
//! Changes a sequence of clip planes slicing the structure on rendering.
//! @param thePlanes [in] the set of clip planes.
- Standard_EXPORT void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes);
+ void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) { myCStructure->SetClipPlanes (thePlanes); }
//! Get clip planes slicing the structure on rendering.
//! @return set of clip planes.
- Standard_EXPORT const Graphic3d_SequenceOfHClipPlane& GetClipPlanes() const;
-
- //! Modifies the default attributes for lines
- //! in the structure <me>.
- Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX);
-
- //! Modifies the default attributes for faces
- //! in the structure <me>.
- Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX);
-
- //! Modifies the default attributes for text
- //! in the structure <me>.
- Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX);
-
- //! Modifies the default attributes for markers
- //! in the structure <me>.
- Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX);
-
+ const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const { return myCStructure->ClipPlanes(); }
+
//! Modifies the visibility indicator to Standard_True or
//! Standard_False for the structure <me>.
//! The default value at the definition of <me> is
//! greater than <LimitSup> or if <LimitInf> or
//! <LimitSup> is a negative value.
Standard_EXPORT void SetZoomLimit (const Standard_Real LimitInf, const Standard_Real LimitSup);
-
- //! marks the structure <me> representing wired structure needed for
- //! highlight only so it won't be added to BVH tree.
- //! Category: Methods to modify the class definition
- Standard_EXPORT void SetIsForHighlight (const Standard_Boolean isForHighlight);
+
+ //! Marks the structure <me> representing wired structure needed for highlight only so it won't be added to BVH tree.
+ void SetIsForHighlight (const Standard_Boolean isForHighlight) { myCStructure->IsForHighlight = isForHighlight; }
//! Suppresses the highlight for the structure <me>
//! in all the views of the visualiser.
Standard_EXPORT void UnHighlight();
- Standard_EXPORT virtual void Compute();
-
- //! Returns the new Structure defined for the new visualization
- Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector);
-
- //! Returns the new Structure defined for the new visualization
- Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, const TColStd_Array2OfReal& AMatrix);
-
- //! Returns the new Structure defined for the new visualization
- Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, Handle(Graphic3d_Structure)& aStructure);
-
+ virtual void Compute()
+ {
+ //
+ }
+
//! Returns the new Structure defined for the new visualization
- Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, const TColStd_Array2OfReal& AMatrix, Handle(Graphic3d_Structure)& aStructure);
-
+ virtual void computeHLR (const Handle(Graphic3d_Camera)& theProjector,
+ Handle(Graphic3d_Structure)& theStructure)
+ {
+ (void )theProjector;
+ (void )theStructure;
+ }
+
//! Forces a new construction of the structure <me>
//! if <me> is displayed and TOS_COMPUTED.
Standard_EXPORT void ReCompute();
//! Returns Standard_True if the structure <me> contains
//! Polygons, Triangles or Quadrangles.
Standard_EXPORT Standard_Boolean ContainsFacet() const;
-
- //! Returns the values of the current default attributes.
- Standard_EXPORT Handle(Graphic3d_AspectFillArea3d) FillArea3dAspect() const;
-
- //! Returns the groups sequence included in the structure <me> (internal storage).
- Standard_EXPORT const Graphic3d_SequenceOfGroup& Groups() const;
-
- //! Returns the current number of groups in the
- //! structure <me>.
- Standard_EXPORT Standard_Integer NumberOfGroups() const;
+
+ //! Returns the groups sequence included in this structure.
+ const Graphic3d_SequenceOfGroup& Groups() const { return myCStructure->Groups(); }
+
+ //! Returns the current number of groups in this structure.
+ Standard_Integer NumberOfGroups() const { return myCStructure->Groups().Length(); }
//! Append new group to this structure.
Standard_EXPORT Handle(Graphic3d_Group) NewGroup();
+
+ //! Returns the last created group or creates new one if list is empty.
+ Handle(Graphic3d_Group) CurrentGroup()
+ {
+ if (Groups().IsEmpty())
+ {
+ return NewGroup();
+ }
+ return Groups().Last();
+ }
+
+ //! Returns the highlight attributes.
+ const Handle(Graphic3d_PresentationAttributes)& HighlightStyle() const { return myCStructure->HighlightStyle(); }
+
+ //! Returns TRUE if this structure is deleted (after Remove() call).
+ Standard_Boolean IsDeleted() const { return myCStructure.IsNull(); }
- //! Returns the highlight color for the Highlight method
- //! with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
- Standard_EXPORT const Quantity_Color& HighlightColor() const;
-
- //! Returns Standard_True if the structure <me> is deleted.
- //! <me> is deleted after the call Remove (me).
- Standard_EXPORT Standard_Boolean IsDeleted() const;
-
- //! Returns the display indicator for the structure <me>.
- Standard_EXPORT virtual Standard_Boolean IsDisplayed() const;
+ //! Returns the display indicator for this structure.
+ virtual Standard_Boolean IsDisplayed() const { return myCStructure->stick != 0; }
//! Returns Standard_True if the structure <me> is empty.
//! Warning: A structure is empty if :
Standard_EXPORT Standard_Boolean IsEmpty() const;
//! Returns Standard_True if the structure <me> is infinite.
- Standard_EXPORT Standard_Boolean IsInfinite() const;
-
- //! Returns the highlight indicator for the structure <me>.
- Standard_EXPORT virtual Standard_Boolean IsHighlighted() const;
-
- //! Returns Standard_True if the structure <me> is rotated.
- //! <=> The transformation != Identity, != Scale, != Translation.
- Standard_EXPORT Standard_Boolean IsRotated() const;
-
- //! Returns Standard_True if the structure <me> is transformed.
- //! <=> The transformation != Identity.
- Standard_EXPORT Standard_Boolean IsTransformed() const;
-
- //! Returns the visibility indicator for the structure <me>.
- Standard_EXPORT Standard_Boolean IsVisible() const;
-
- //! Returns the values of the current default attributes.
- Standard_EXPORT Handle(Graphic3d_AspectLine3d) Line3dAspect() const;
-
- //! Returns the current group of graphic attributes used
- //! for 3d marker primitives.
- Standard_EXPORT Handle(Graphic3d_AspectMarker3d) Marker3dAspect() const;
-
+ Standard_Boolean IsInfinite() const
+ {
+ return IsDeleted()
+ || myCStructure->IsInfinite;
+ }
+
+ //! Returns the highlight indicator for this structure.
+ virtual Standard_Boolean IsHighlighted() const { return myCStructure->highlight != 0; }
+
+ //! Returns TRUE if the structure is transformed.
+ Standard_Boolean IsTransformed() const
+ {
+ return !myCStructure->Transformation().IsNull()
+ && myCStructure->Transformation()->Form() != gp_Identity;
+ }
+
+ //! Returns the visibility indicator for this structure.
+ Standard_Boolean IsVisible() const { return myCStructure->visible != 0; }
+
//! Returns the coordinates of the boundary box of the structure <me>.
//! If <theToIgnoreInfiniteFlag> is TRUE, the method returns actual graphical
//! boundaries of the Graphic3d_Group components. Otherwise, the
//! Warning: If the structure <me> is empty then the empty box is returned,
//! If the structure <me> is infinite then the whole box is returned.
Standard_EXPORT Bnd_Box MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
-
- //! Returns the current values of the default attributes.
- Standard_EXPORT void PrimitivesAspect (Handle(Graphic3d_AspectLine3d)& CTXL, Handle(Graphic3d_AspectText3d)& CTXT, Handle(Graphic3d_AspectMarker3d)& CTXM, Handle(Graphic3d_AspectFillArea3d)& CTXF) const;
-
- //! Returns the values of the current default attributes.
- Standard_EXPORT Handle(Graphic3d_AspectText3d) Text3dAspect() const;
-
+
//! Returns the visualisation mode for the structure <me>.
- Standard_EXPORT Graphic3d_TypeOfStructure Visual() const;
+ Graphic3d_TypeOfStructure Visual() const { return myVisual; }
//! Returns Standard_True if the connection is possible between
//! <AStructure1> and <AStructure2> without a creation
//! - the set of all descendants of <AStructure1> contains
//! <AStructure2> and if the
//! TypeOfConnection == TOC_ANCESTOR
- Standard_EXPORT static Standard_Boolean AcceptConnection (const Handle(Graphic3d_Structure)& AStructure1, const Handle(Graphic3d_Structure)& AStructure2, const Graphic3d_TypeOfConnection AType);
+ Standard_EXPORT static Standard_Boolean AcceptConnection (Graphic3d_Structure* theStructure1,
+ Graphic3d_Structure* theStructure2,
+ Graphic3d_TypeOfConnection theType);
//! Returns the group of structures to which <me> is connected.
Standard_EXPORT void Ancestors (Graphic3d_MapOfStructure& SG) const;
//! Remove, and stacks the transformations.
//! No connection if the graph of the structures
//! contains a cycle and <WithCheck> is Standard_True;
- Standard_EXPORT void Connect (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType, const Standard_Boolean WithCheck = Standard_False);
+ Standard_EXPORT void Connect (Graphic3d_Structure* theStructure,
+ Graphic3d_TypeOfConnection theType,
+ Standard_Boolean theWithCheck = Standard_False);
+
+ Standard_DEPRECATED("Deprecated short-cut")
+ void Connect (const Handle(Graphic3d_Structure)& thePrs)
+ {
+ Connect (thePrs.get(), Graphic3d_TOC_DESCENDANT);
+ }
//! Returns the group of structures connected to <me>.
Standard_EXPORT void Descendants (Graphic3d_MapOfStructure& SG) const;
//! Suppress the connection between <AStructure> and <me>.
- Standard_EXPORT void Disconnect (const Handle(Graphic3d_Structure)& AStructure);
+ Standard_EXPORT void Disconnect (Graphic3d_Structure* theStructure);
+
+ Standard_DEPRECATED("Deprecated alias for Disconnect()")
+ void Remove (const Handle(Graphic3d_Structure)& thePrs) { Disconnect (thePrs.get()); }
//! If Atype is TOC_DESCENDANT then suppress all
//! the connections with the child structures of <me>.
//! If Atype is TOC_ANCESTOR then suppress all
//! the connections with the parent structures of <me>.
Standard_EXPORT void DisconnectAll (const Graphic3d_TypeOfConnection AType);
+
+ Standard_DEPRECATED("Deprecated alias for DisconnectAll()")
+ void RemoveAll() { DisconnectAll (Graphic3d_TOC_DESCENDANT); }
//! Returns <ASet> the group of structures :
//! - directly or indirectly connected to <AStructure> if the
//! TypeOfConnection == TOC_DESCENDANT
//! - to which <AStructure> is directly or indirectly connected
//! if the TypeOfConnection == TOC_ANCESTOR
- Standard_EXPORT static void Network (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType, Graphic3d_MapOfStructure& ASet);
-
- Standard_EXPORT void SetOwner (const Standard_Address Owner);
-
- Standard_EXPORT Standard_Address Owner() const;
-
- Standard_EXPORT void SetHLRValidation (const Standard_Boolean AFlag);
+ Standard_EXPORT static void Network (Graphic3d_Structure* theStructure,
+ const Graphic3d_TypeOfConnection theType,
+ NCollection_Map<Graphic3d_Structure*>& theSet);
- Standard_EXPORT Standard_Boolean HLRValidation() const;
+ void SetOwner (const Standard_Address theOwner) { myOwner = theOwner; }
- //! Returns the type of composition applied to matrices
- //! of transformation of <me>.
- Standard_EXPORT Graphic3d_TypeOfComposition Composition() const;
-
- //! Modifies the current local modelling transformation
- //! in the structure <me>.
- //!
- //! It is defined as a 4*4 real matrix.
- //!
- //! -------------------
- //! | a11 a12 a13 t1 |
- //! | a21 a22 a23 t2 |
- //! | a31 a32 a33 t3 |
- //! | 0 0 0 1 |
- //! -------------------
- //!
- //! TypeOfComposition : TOC_REPLACE
- //! TOC_POSTCONCATENATE
- //!
- //! Then the modified Local Modelling Transformation is composed
- //! with the current Global Modelling Transformation to create a
- //! new Composite Modelling Transformation.
- //!
- //! The compose type specifies the role of the current local
- //! modelling transformation (L) in composing the new value for
- //! the current local modelling transformation (L'), which is
- //! then combined with the current global modelling transforma-
- //! tion (G) to calculate the new composite modelling transfor-
- //! mation (C).
- //!
- //! TOC_REPLACE
- //! The transformation matrix (T) replaces the value of
- //! current local modelling transformation (L).
- //!
- //! L' <- T
- //! C <- G x L'
- //!
- //! TOC_POSTCONCATENATE
- //! The current local modelling transformation (L) is multiplied
- //! by the transformation matrix (T):
- //!
- //! L' <- T x L
- //! C <- G x L'
- //!
- //! Category: Methods to manage the structure transformation
- //! Warning: Raises TransformError if the matrix is not a 4x4 matrix.
- Standard_EXPORT void SetTransform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType);
-
- //! Returns the transformation associated with
- //! the structure <me>.
- Standard_EXPORT void Transform (TColStd_Array2OfReal& AMatrix) const;
-
- //! Modifies the current modelling transform persistence (pan, zoom or rotate)
- Standard_EXPORT void SetTransformPersistence (const Graphic3d_TransModeFlags& AFlag, const gp_Pnt& APoint);
-
- Standard_EXPORT void SetTransformPersistence (const Graphic3d_TransModeFlags& AFlag);
-
- //! Get the current modelling transform persistence (pan, zoom or rotate)
- Standard_EXPORT Graphic3d_TransModeFlags TransformPersistenceMode() const;
-
- //! Get the current point of relative modelling transform persistence
- Standard_EXPORT gp_Pnt TransformPersistencePoint() const;
+ Standard_Address Owner() const { return myOwner; }
+ void SetHLRValidation (const Standard_Boolean theFlag) { myCStructure->HLRValidation = theFlag ? 1 : 0; }
+
+ //! Hidden parts stored in this structure are valid if:
+ //! 1) the owner is defined.
+ //! 2) they are not invalid.
+ Standard_Boolean HLRValidation() const
+ {
+ return myOwner != NULL
+ && myCStructure->HLRValidation != 0;
+ }
+
+ //! Return local transformation.
+ const Handle(TopLoc_Datum3D)& Transformation() const { return myCStructure->Transformation(); }
+
+ //! Modifies the current local transformation
+ Standard_EXPORT void SetTransformation (const Handle(TopLoc_Datum3D)& theTrsf);
+
+ Standard_DEPRECATED("This method is deprecated - SetTransformation() should be called instead")
+ void Transform (const Handle(TopLoc_Datum3D)& theTrsf) { SetTransformation (theTrsf); }
+
+ //! Modifies the current transform persistence (pan, zoom or rotate)
+ Standard_EXPORT void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
+
+ //! @return transform persistence of the presentable object.
+ const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myCStructure->TransformPersistence(); }
+
//! Sets if the structure location has mutable nature (content or location will be changed regularly).
- Standard_EXPORT void SetMutable (const Standard_Boolean theIsMutable);
+ void SetMutable (const Standard_Boolean theIsMutable) { myCStructure->IsMutable = theIsMutable; }
//! Returns true if structure has mutable nature (content or location are be changed regularly).
//! Mutable structure will be managed in different way than static onces.
- Standard_EXPORT Standard_Boolean IsMutable() const;
+ Standard_Boolean IsMutable() const { return myCStructure->IsMutable; }
- Standard_EXPORT Graphic3d_TypeOfStructure ComputeVisual() const;
+ Graphic3d_TypeOfStructure ComputeVisual() const { return myComputeVisual; }
//! Clears the structure <me>.
Standard_EXPORT void GraphicClear (const Standard_Boolean WithDestruction);
- Standard_EXPORT void GraphicConnect (const Handle(Graphic3d_Structure)& ADaughter);
-
- Standard_EXPORT void GraphicDisconnect (const Handle(Graphic3d_Structure)& ADaughter);
-
- //! Highlights the structure <me>.
- Standard_EXPORT void GraphicHighlight (const Aspect_TypeOfHighlightMethod Method);
-
- Standard_EXPORT void GraphicTransform (const TColStd_Array2OfReal& AMatrix);
-
- //! Suppress the highlight for the structure <me>.
- Standard_EXPORT void GraphicUnHighlight();
+ void GraphicConnect (const Handle(Graphic3d_Structure)& theDaughter) { myCStructure->Connect (*theDaughter->myCStructure); }
- //! Returns the identification number of the structure <me>.
- Standard_EXPORT Standard_Integer Identification() const;
+ void GraphicDisconnect (const Handle(Graphic3d_Structure)& theDaughter) { myCStructure->Disconnect (*theDaughter->myCStructure); }
+
+ //! Internal method which sets new transformation without calling graphic manager callbacks.
+ void GraphicTransform (const Handle(TopLoc_Datum3D)& theTrsf) { myCStructure->SetTransformation (theTrsf); }
+
+ //! Returns the identification number of this structure.
+ Standard_Integer Identification() const { return myCStructure->Id; }
//! Prints informations about the network associated
//! with the structure <AStructure>.
Standard_EXPORT static void PrintNetwork (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType);
- //! Suppress the adress <APtr> in the list
- //! of descendants or in the list of ancestors.
- Standard_EXPORT void Remove (const Standard_Address APtr, const Graphic3d_TypeOfConnection AType);
-
- Standard_EXPORT void SetComputeVisual (const Graphic3d_TypeOfStructure AVisual);
-
- //! Transforms <X>, <Y>, <Z> with the transformation <ATrsf>.
- Standard_EXPORT static void Transforms (const TColStd_Array2OfReal& ATrsf, const Standard_Real X, const Standard_Real Y, const Standard_Real Z, Standard_Real& NewX, Standard_Real& NewY, Standard_Real& NewZ);
-
- //! Transforms <Coord> with the transformation <ATrsf>.
- Standard_EXPORT static Graphic3d_Vector Transforms (const TColStd_Array2OfReal& ATrsf, const Graphic3d_Vector& Coord);
-
- //! Transforms <Coord> with the transformation <ATrsf>.
- Standard_EXPORT static Graphic3d_Vertex Transforms (const TColStd_Array2OfReal& ATrsf, const Graphic3d_Vertex& Coord);
-
- //! Returns the low-level structure
- const Handle(Graphic3d_CStructure)& CStructure() const;
-
-friend class Graphic3d_Group;
+ //! Suppress the structure in the list of descendants or in the list of ancestors.
+ Standard_EXPORT void Remove (Graphic3d_Structure* thePtr,
+ const Graphic3d_TypeOfConnection theType);
+
+ void SetComputeVisual (const Graphic3d_TypeOfStructure theVisual)
+ {
+ // The ComputeVisual is saved only if the structure is declared TOS_ALL, TOS_WIREFRAME or TOS_SHADING.
+ // This declaration permits to calculate proper representation of the structure calculated by Compute instead of passage to TOS_COMPUTED.
+ if (theVisual != Graphic3d_TOS_COMPUTED)
+ {
+ myComputeVisual = theVisual;
+ }
+ }
+
+ //! Transforms theX, theY, theZ with the transformation theTrsf.
+ Standard_EXPORT static void Transforms (const gp_Trsf& theTrsf,
+ const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ,
+ Standard_Real& theNewX, Standard_Real& theNewY, Standard_Real& theNewZ);
+ //! Returns the low-level structure
+ const Handle(Graphic3d_CStructure)& CStructure() const { return myCStructure; }
- DEFINE_STANDARD_RTTI(Graphic3d_Structure,MMgt_TShared)
+ //! Dumps the content of me into the stream
+ Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected:
-
//! Transforms boundaries with <theTrsf> transformation.
- Standard_EXPORT static void TransformBoundaries (const TColStd_Array2OfReal& theTrsf, Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin, Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax);
-
+ Standard_EXPORT static void TransformBoundaries (const gp_Trsf& theTrsf,
+ Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin,
+ Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax);
+
//! Appends new descendant structure.
- Standard_EXPORT Standard_Boolean AppendDescendant (const Standard_Address theDescendant);
+ Standard_EXPORT Standard_Boolean AppendDescendant (Graphic3d_Structure* theDescendant);
//! Removes the given descendant structure.
- Standard_EXPORT Standard_Boolean RemoveDescendant (const Standard_Address theDescendant);
+ Standard_EXPORT Standard_Boolean RemoveDescendant (Graphic3d_Structure* theDescendant);
//! Appends new ancestor structure.
- Standard_EXPORT Standard_Boolean AppendAncestor (const Standard_Address theAncestor);
+ Standard_EXPORT Standard_Boolean AppendAncestor (Graphic3d_Structure* theAncestor);
//! Removes the given ancestor structure.
- Standard_EXPORT Standard_Boolean RemoveAncestor (const Standard_Address theAncestor);
+ Standard_EXPORT Standard_Boolean RemoveAncestor (Graphic3d_Structure* theAncestor);
- Graphic3d_StructureManagerPtr myStructureManager;
- Graphic3d_StructureManagerPtr myFirstStructureManager;
- Graphic3d_TypeOfStructure myComputeVisual;
+ //! Clears all the groups of primitives in the structure.
+ Standard_EXPORT void clear (const Standard_Boolean WithDestruction);
+ //! Erases this structure in all the views of the visualiser.
+ Standard_EXPORT void erase();
private:
-
//! Suppress in the structure <me>, the group theGroup.
//! It will be erased at the next screen update.
Standard_EXPORT void Remove (const Handle(Graphic3d_Group)& theGroup);
Standard_EXPORT Graphic3d_BndBox4f minMaxCoord() const;
//! Gets untransformed bounding box from structure.
- Standard_EXPORT void getBox (Graphic3d_BndBox4d& theBox, const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
+ Standard_EXPORT void getBox (Graphic3d_BndBox3d& theBox, const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
//! Adds transformed (with myCStructure->Transformation) bounding box of structure to theBox.
- Standard_EXPORT void addTransformed (Graphic3d_BndBox4d& theBox, const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
+ Standard_EXPORT void addTransformed (Graphic3d_BndBox3d& theBox, const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
//! Returns the manager to which <me> is associated.
Standard_EXPORT Handle(Graphic3d_StructureManager) StructureManager() const;
- //! Calls the Update method of the StructureManager which
- //! contains the Structure <me>.
- Standard_EXPORT void Update() const;
-
- //! Updates the c structure associated to <me>.
- Standard_EXPORT void UpdateStructure (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF);
+ //! Calls the Update method of the StructureManager which contains the Structure <me>.
+ //! If theUpdateLayer is true then invalidates bounding box of ZLayer.
+ Standard_EXPORT void Update (const bool theUpdateLayer = false) const;
- Handle(Graphic3d_CStructure) myCStructure;
- Graphic3d_IndexedMapOfAddress myAncestors;
- Graphic3d_IndexedMapOfAddress myDescendants;
- Quantity_Color myHighlightColor;
- Aspect_TypeOfHighlightMethod myHighlightMethod;
- Standard_Address myOwner;
- Graphic3d_TypeOfStructure myVisual;
+protected:
+ Graphic3d_StructureManager* myStructureManager;
+ Handle(Graphic3d_CStructure) myCStructure;
+ NCollection_IndexedMap<Graphic3d_Structure*> myAncestors;
+ NCollection_IndexedMap<Graphic3d_Structure*> myDescendants;
+ Standard_Address myOwner;
+ Graphic3d_TypeOfStructure myVisual;
+ Graphic3d_TypeOfStructure myComputeVisual;
};
-
-#include <Graphic3d_Structure.lxx>
-
-
-
-
-
#endif // _Graphic3d_Structure_HeaderFile