1 // Created on: 2011-07-13
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2013 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
20 #include <OpenGl_AspectText.hxx>
21 #include <OpenGl_Workspace.hxx>
25 static const TEL_COLOUR TheDefaultColor = {{ 1.0F, 1.0F, 1.0F, 1.0F }};
28 // =======================================================================
29 // function : OpenGl_AspectText
31 // =======================================================================
32 OpenGl_AspectText::OpenGl_AspectText()
33 : myFont ("Courier") ,
34 myColor (TheDefaultColor),
35 mySubtitleColor (TheDefaultColor),
37 myStyleType (Aspect_TOST_NORMAL),
38 myDisplayType (Aspect_TODT_NORMAL),
39 myFontAspect (Font_FA_Regular),
45 // =======================================================================
46 // function : ~OpenGl_AspectText
48 // =======================================================================
49 OpenGl_AspectText::~OpenGl_AspectText()
54 // =======================================================================
55 // function : SetContext
57 // =======================================================================
58 void OpenGl_AspectText::SetContext (const CALL_DEF_CONTEXTTEXT& theContext)
60 myFont = theContext.Font;
61 myColor.rgb[0] = (float )theContext.Color.r;
62 myColor.rgb[1] = (float )theContext.Color.g;
63 myColor.rgb[2] = (float )theContext.Color.b;
64 myColor.rgb[3] = 1.0f;
65 mySubtitleColor.rgb[0] = (float )theContext.ColorSubTitle.r;
66 mySubtitleColor.rgb[1] = (float )theContext.ColorSubTitle.g;
67 mySubtitleColor.rgb[2] = (float )theContext.ColorSubTitle.b;
68 mySubtitleColor.rgb[3] = 1.0f;
69 myAngle = (float )theContext.TextAngle;
70 myStyleType = (Aspect_TypeOfStyleText )theContext.Style;
71 myDisplayType = (Aspect_TypeOfDisplayText )theContext.DisplayType;
72 myFontAspect = (Font_FontAspect )theContext.TextFontAspect;
73 myZoomable = (theContext.TextZoomable != 0);
76 // =======================================================================
79 // =======================================================================
80 void OpenGl_AspectText::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
82 theWorkspace->SetAspectText (this);
85 // =======================================================================
88 // =======================================================================
89 void OpenGl_AspectText::Release (const Handle(OpenGl_Context)&)