Back to home page

EIC code displayed by LXR

 
 

    


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

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