b311480e |
1 | // Created on: 1993-09-14 |
2 | // Created by: Jean-Louis FRENKEL |
3 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
4ad142d9 |
17 | #include <Prs3d_Text.hxx> |
42cf5bc1 |
18 | |
19 | #include <gp_Pnt.hxx> |
20 | #include <Graphic3d_Group.hxx> |
8ed07085 |
21 | #include <Graphic3d_Text.hxx> |
7fd59977 |
22 | #include <Graphic3d_Vertex.hxx> |
42cf5bc1 |
23 | #include <Prs3d_Presentation.hxx> |
7fd59977 |
24 | #include <Prs3d_TextAspect.hxx> |
25 | #include <TCollection_AsciiString.hxx> |
42cf5bc1 |
26 | #include <TCollection_ExtendedString.hxx> |
7fd59977 |
27 | |
4ad142d9 |
28 | // ======================================================================= |
29 | // function : Draw |
30 | // purpose : |
31 | // ======================================================================= |
32 | void Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup, |
33 | const Handle(Prs3d_TextAspect)& theAspect, |
34 | const TCollection_ExtendedString& theText, |
35 | const gp_Pnt& theAttachmentPoint) |
36 | { |
4ad142d9 |
37 | theGroup->SetPrimitivesAspect (theAspect->Aspect()); |
8ed07085 |
38 | |
39 | Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)theAspect->Height()); |
40 | aText->SetText (theText.ToExtString()); |
41 | aText->SetPosition (theAttachmentPoint); |
42 | aText->SetHorizontalAlignment (theAspect->HorizontalJustification()); |
43 | aText->SetVerticalAlignment (theAspect->VerticalJustification()); |
44 | theGroup->AddText (aText); |
7fd59977 |
45 | } |
46 | |
ce01ec26 |
47 | // ======================================================================= |
48 | // function : Draw |
49 | // purpose : |
50 | // ======================================================================= |
4ad142d9 |
51 | void Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup, |
ce01ec26 |
52 | const Handle(Prs3d_TextAspect)& theAspect, |
53 | const TCollection_ExtendedString& theText, |
3f1eb0ab |
54 | const gp_Ax2& theOrientation, |
55 | const Standard_Boolean theHasOwnAnchor) |
ce01ec26 |
56 | { |
4ad142d9 |
57 | theGroup->SetPrimitivesAspect (theAspect->Aspect()); |
8ed07085 |
58 | |
59 | Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)theAspect->Height()); |
60 | aText->SetText (theText.ToExtString()); |
61 | aText->SetOrientation (theOrientation); |
62 | aText->SetOwnAnchorPoint (theHasOwnAnchor); |
63 | aText->SetHorizontalAlignment (theAspect->HorizontalJustification()); |
64 | aText->SetVerticalAlignment (theAspect->VerticalJustification()); |
65 | theGroup->AddText (aText); |
ce01ec26 |
66 | } |