Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:47

0001 // Created by: NW,JPB,CAL
0002 // Copyright (c) 1991-1999 Matra Datavision
0003 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Graphic3d_AspectText3d_HeaderFile
0017 #define _Graphic3d_AspectText3d_HeaderFile
0018 
0019 #include <Graphic3d_Aspects.hxx>
0020 
0021 //! Creates and updates a group of attributes for text primitives.
0022 class Graphic3d_AspectText3d : public Graphic3d_Aspects
0023 {
0024   DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectText3d, Graphic3d_Aspects)
0025 public:
0026 
0027   //! Creates a context table for text primitives defined with the following default values:
0028   //! Color            : Quantity_NOC_YELLOW
0029   //! Font             : Font_NOF_ASCII_MONO
0030   //! The style        : Aspect_TOST_NORMAL
0031   //! The display type : Aspect_TODT_NORMAL
0032   Standard_EXPORT Graphic3d_AspectText3d();
0033 
0034   //! Creates a context table for text primitives defined with the specified values.
0035   //! @param theColor [in] text color
0036   //! @param theFont  [in] font family name or alias like Font_NOF_ASCII_MONO
0037   //! @param theExpansionFactor [in] deprecated parameter, has no effect
0038   //! @param theSpace [in] deprecated parameter, has no effect
0039   //! @param theStyle [in] font style
0040   //! @param theDisplayType [in] display mode
0041   Standard_EXPORT Graphic3d_AspectText3d (const Quantity_Color& theColor,
0042                                           Standard_CString theFont,
0043                                           Standard_Real theExpansionFactor,
0044                                           Standard_Real theSpace,
0045                                           Aspect_TypeOfStyleText theStyle = Aspect_TOST_NORMAL,
0046                                           Aspect_TypeOfDisplayText theDisplayType = Aspect_TODT_NORMAL);
0047 
0048   //! Return the text color.
0049   const Quantity_Color& Color() const { return myInteriorColor.GetRGB(); }
0050 
0051   //! Return the text color.
0052   const Quantity_ColorRGBA& ColorRGBA() const { return myInteriorColor; }
0053 
0054   //! Modifies the color.
0055   void SetColor (const Quantity_Color& theColor) { myInteriorColor.SetRGB (theColor); }
0056 
0057   //! Modifies the color.
0058   void SetColor (const Quantity_ColorRGBA& theColor) { myInteriorColor = theColor; }
0059 
0060   //! Return the font.
0061   const TCollection_AsciiString& Font() const
0062   {
0063     if (myTextFont.IsNull())
0064     {
0065       static const TCollection_AsciiString anEmpty;
0066       return anEmpty;
0067     }
0068     return myTextFont->String();
0069   }
0070 
0071   //! Modifies the font.
0072   void SetFont (const TCollection_AsciiString& theFont)
0073   {
0074     if (!theFont.IsEmpty())
0075     {
0076       myTextFont = new TCollection_HAsciiString (theFont);
0077     }
0078     else
0079     {
0080       myTextFont.Nullify();
0081     }
0082   }
0083 
0084   //! Modifies the font.
0085   void SetFont (const Standard_CString theFont)
0086   {
0087     SetFont (TCollection_AsciiString (theFont));
0088   }
0089 
0090   //! Return the text style.
0091   Aspect_TypeOfStyleText Style() const { return myTextStyle; }
0092 
0093   //! Modifies the style of the text.
0094   void SetStyle (Aspect_TypeOfStyleText theStyle) { myTextStyle = theStyle; }
0095 
0096   //! Return display type.
0097   Aspect_TypeOfDisplayText DisplayType() const { return myTextDisplayType; }
0098 
0099   //! Define the display type of the text.
0100   void SetDisplayType (Aspect_TypeOfDisplayText theDisplayType) { myTextDisplayType = theDisplayType; }
0101 
0102   //! Returns TRUE when the Text Zoomable is on.
0103   bool GetTextZoomable() const { return myIsTextZoomable; }
0104 
0105   //! Returns Angle of degree
0106   Standard_ShortReal GetTextAngle() const { return myTextAngle; }
0107 
0108   //! Turns usage of text rotated
0109   void SetTextAngle (const Standard_Real theAngle) { myTextAngle = (Standard_ShortReal )theAngle; }
0110 
0111   //! Returns text FontAspect
0112   Font_FontAspect GetTextFontAspect() const { return myTextFontAspect; }
0113   
0114   //! Dumps the content of me into the stream
0115   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0116 
0117 };
0118 
0119 DEFINE_STANDARD_HANDLE(Graphic3d_AspectText3d, Graphic3d_Aspects)
0120 
0121 #endif // _Graphic3d_AspectText3d_HeaderFile