Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-07-30
0002 // Created by: Jean-Louis FRENKEL
0003 // Copyright (c) 1993-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 _Prs3d_DatumAspect_HeaderFile
0018 #define _Prs3d_DatumAspect_HeaderFile
0019 
0020 #include <Prs3d_ArrowAspect.hxx>
0021 #include <Prs3d_DatumAttribute.hxx>
0022 #include <Prs3d_DatumAxes.hxx>
0023 #include <Prs3d_DatumParts.hxx>
0024 #include <Prs3d_LineAspect.hxx>
0025 #include <Prs3d_PointAspect.hxx>
0026 #include <Prs3d_ShadingAspect.hxx>
0027 #include <Prs3d_TextAspect.hxx>
0028 
0029 //! A framework to define the display of datums.
0030 class Prs3d_DatumAspect : public Prs3d_BasicAspect
0031 {
0032   DEFINE_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect)
0033 public:
0034 
0035   //! An empty constructor.
0036   Standard_EXPORT Prs3d_DatumAspect();
0037 
0038   //! Returns line aspect for specified part.
0039   const Handle(Prs3d_LineAspect)& LineAspect (Prs3d_DatumParts thePart) const { return myLineAspects[thePart]; }
0040 
0041   //! Returns shading aspect for specified part.
0042   const Handle(Prs3d_ShadingAspect)& ShadingAspect (Prs3d_DatumParts thePart) const { return myShadedAspects[thePart]; }
0043 
0044   //! Returns the text attributes for rendering label of specified part (Prs3d_DatumParts_XAxis/Prs3d_DatumParts_YAxis/Prs3d_DatumParts_ZAxis).
0045   const Handle(Prs3d_TextAspect)& TextAspect (Prs3d_DatumParts thePart) const { return myTextAspects[thePart]; }
0046 
0047   //! Sets text attributes for rendering labels.
0048   void SetTextAspect (const Handle(Prs3d_TextAspect)& theTextAspect)
0049   {
0050     myTextAspects[Prs3d_DatumParts_XAxis] = theTextAspect;
0051     myTextAspects[Prs3d_DatumParts_YAxis] = theTextAspect;
0052     myTextAspects[Prs3d_DatumParts_ZAxis] = theTextAspect;
0053   }
0054 
0055   //! Returns the point aspect of origin wireframe presentation
0056   const Handle(Prs3d_PointAspect)& PointAspect() const { return myPointAspect; }
0057 
0058   //! Returns the point aspect of origin wireframe presentation
0059   void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect) { myPointAspect = theAspect; }
0060 
0061   //! Returns the arrow aspect of presentation.
0062   const Handle(Prs3d_ArrowAspect)& ArrowAspect() const { return myArrowAspect; }
0063 
0064   //! Sets the arrow aspect of presentation
0065   void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect) { myArrowAspect = theAspect; }
0066 
0067   //! Returns true if the given part is used in axes of aspect
0068   Standard_EXPORT Standard_Boolean DrawDatumPart (Prs3d_DatumParts thePart) const;
0069 
0070   //! Sets the axes used in the datum aspect
0071   void SetDrawDatumAxes (Prs3d_DatumAxes theType) { myAxes = theType; }
0072 
0073   //! Returns axes used in the datum aspect
0074   Prs3d_DatumAxes DatumAxes() const { return myAxes; }
0075 
0076   //! Returns the attribute of the datum type
0077   Standard_Real Attribute (Prs3d_DatumAttribute theType) const { return myAttributes[theType]; }
0078 
0079   //! Sets the attribute of the datum type
0080   void SetAttribute (Prs3d_DatumAttribute theType, const Standard_Real theValue) { myAttributes[theType] = theValue; }
0081 
0082   //! Returns the length of the displayed first axis.
0083   Standard_EXPORT Standard_Real AxisLength (Prs3d_DatumParts thePart) const;
0084 
0085   //! Sets the lengths of the three axes.
0086   void SetAxisLength (Standard_Real theL1, Standard_Real theL2, Standard_Real theL3)
0087   {
0088     myAttributes[Prs3d_DatumAttribute_XAxisLength] = theL1;
0089     myAttributes[Prs3d_DatumAttribute_YAxisLength] = theL2;
0090     myAttributes[Prs3d_DatumAttribute_ZAxisLength] = theL3;
0091   }
0092 
0093   //! @return true if axes labels are drawn; TRUE by default.
0094   Standard_Boolean ToDrawLabels() const { return myToDrawLabels; }
0095 
0096   //! Sets option to draw or not to draw text labels for axes
0097   void SetDrawLabels (Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; }
0098   void SetToDrawLabels (Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; }
0099 
0100   //! @return true if axes arrows are drawn; TRUE by default.
0101   Standard_Boolean ToDrawArrows() const { return myToDrawArrows; }
0102 
0103   //! Sets option to draw or not arrows for axes
0104   void SetDrawArrows (Standard_Boolean theToDraw) { myToDrawArrows = theToDraw; }
0105 
0106   //! Performs deep copy of attributes from another aspect instance.
0107   Standard_EXPORT void CopyAspectsFrom (const Handle(Prs3d_DatumAspect)& theOther);
0108 
0109   //! Dumps the content of me into the stream
0110   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0111 
0112 public:
0113 
0114   //! Returns type of arrow for a type of axis
0115   Standard_EXPORT static Prs3d_DatumParts ArrowPartForAxis (Prs3d_DatumParts thePart);
0116 
0117 public:
0118 
0119   //! Returns the text attributes for rendering labels.
0120   Standard_DEPRECATED("This method is deprecated - TextAspect() with axis parameter should be called instead")
0121   const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspects[Prs3d_DatumParts_XAxis]; }
0122 
0123 protected:
0124 
0125   Handle(Prs3d_ShadingAspect) myShadedAspects[Prs3d_DatumParts_NB];
0126   Handle(Prs3d_LineAspect)    myLineAspects[Prs3d_DatumParts_NB];
0127   Handle(Prs3d_TextAspect)    myTextAspects[Prs3d_DatumParts_NB];
0128   Handle(Prs3d_PointAspect)   myPointAspect;
0129   Handle(Prs3d_ArrowAspect)   myArrowAspect;
0130   Standard_Real               myAttributes[Prs3d_DatumAttribute_NB];
0131   Prs3d_DatumAxes             myAxes;
0132   Standard_Boolean            myToDrawLabels;
0133   Standard_Boolean            myToDrawArrows;
0134 
0135 };
0136 
0137 DEFINE_STANDARD_HANDLE(Prs3d_DatumAspect, Prs3d_BasicAspect)
0138 
0139 #endif // _Prs3d_DatumAspect_HeaderFile