Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:18:43

0001 // Created on: 1993-09-14
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_TextAspect_HeaderFile
0018 #define _Prs3d_TextAspect_HeaderFile
0019 
0020 #include <Graphic3d_AspectText3d.hxx>
0021 #include <Graphic3d_TextPath.hxx>
0022 #include <Graphic3d_HorizontalTextAlignment.hxx>
0023 #include <Graphic3d_VerticalTextAlignment.hxx>
0024 #include <Prs3d_BasicAspect.hxx>
0025 
0026 //! Defines the attributes when displaying a text.
0027 class Prs3d_TextAspect : public Prs3d_BasicAspect
0028 {
0029   DEFINE_STANDARD_RTTIEXT(Prs3d_TextAspect, Prs3d_BasicAspect)
0030 public:
0031   //! Constructs an empty framework for defining display attributes of text.
0032   Standard_EXPORT Prs3d_TextAspect();
0033 
0034   Standard_EXPORT Prs3d_TextAspect(const occ::handle<Graphic3d_AspectText3d>& theAspect);
0035 
0036   //! Sets the color of the type used in text display.
0037   void SetColor(const Quantity_Color& theColor) { myTextAspect->SetColor(theColor); }
0038 
0039   //! Sets the font used in text display.
0040   void SetFont(const char* const theFont) { myTextAspect->SetFont(theFont); }
0041 
0042   //! Sets the height of the text.
0043   void SetHeight(const double theHeight) { myHeight = theHeight; }
0044 
0045   //! Sets the angle
0046   void SetAngle(const double theAngle) { myTextAspect->SetTextAngle(theAngle); }
0047 
0048   //! Returns the height of the text box.
0049   double Height() const { return myHeight; }
0050 
0051   //! Returns the angle
0052   double Angle() const { return myTextAspect->GetTextAngle(); }
0053 
0054   //! Sets horizontal alignment of text.
0055   void SetHorizontalJustification(const Graphic3d_HorizontalTextAlignment theJustification)
0056   {
0057     myHorizontalJustification = theJustification;
0058   }
0059 
0060   //! Sets the vertical alignment of text.
0061   void SetVerticalJustification(const Graphic3d_VerticalTextAlignment theJustification)
0062   {
0063     myVerticalJustification = theJustification;
0064   }
0065 
0066   //! Sets the orientation of text.
0067   void SetOrientation(const Graphic3d_TextPath theOrientation) { myOrientation = theOrientation; }
0068 
0069   //! Returns the horizontal alignment of the text.
0070   //! The range of values includes:
0071   //! -   left
0072   //! -   center
0073   //! -   right, and
0074   //! -   normal (justified).
0075   Graphic3d_HorizontalTextAlignment HorizontalJustification() const
0076   {
0077     return myHorizontalJustification;
0078   }
0079 
0080   //! Returns the vertical alignment of the text.
0081   //! The range of values includes:
0082   //! -   normal
0083   //! -   top
0084   //! -   cap
0085   //! -   half
0086   //! -   base
0087   //! -   bottom
0088   Graphic3d_VerticalTextAlignment VerticalJustification() const { return myVerticalJustification; }
0089 
0090   //! Returns the orientation of the text.
0091   //! Text can be displayed in the following directions:
0092   //! -   up
0093   //! -   down
0094   //! -   left, or
0095   //! -   right
0096   Graphic3d_TextPath Orientation() const { return myOrientation; }
0097 
0098   //! Returns the purely textual attributes used in the display of text.
0099   //! These include:
0100   //! -   color
0101   //! -   font
0102   //! -   height/width ratio, that is, the expansion factor, and
0103   //! -   space between characters.
0104   const occ::handle<Graphic3d_AspectText3d>& Aspect() const { return myTextAspect; }
0105 
0106   void SetAspect(const occ::handle<Graphic3d_AspectText3d>& theAspect) { myTextAspect = theAspect; }
0107 
0108   //! Dumps the content of me into the stream
0109   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0110 
0111 protected:
0112   occ::handle<Graphic3d_AspectText3d> myTextAspect;
0113   double                              myHeight;
0114   Graphic3d_HorizontalTextAlignment   myHorizontalJustification;
0115   Graphic3d_VerticalTextAlignment     myVerticalJustification;
0116   Graphic3d_TextPath                  myOrientation;
0117 };
0118 
0119 #endif // _Prs3d_TextAspect_HeaderFile