b311480e |
1 | // Created on: 2002-04-10 |
2 | // Created by: QA Admin |
973c2be1 |
3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
1cd84fee |
16 | #include <QABugs_MyText.ixx> |
17 | #include <QABugs_MyText.hxx> |
7fd59977 |
18 | #include <Prs3d_Presentation.hxx> |
19 | #include <Prs3d_TextAspect.hxx> |
20 | #include <AIS_Drawer.hxx> |
21 | #include <SelectMgr_EntityOwner.hxx> |
22 | #include <Prs3d_Text.hxx> |
23 | #include <Select3D_SensitiveBox.hxx> |
24 | #include <SelectMgr_Selection.hxx> |
aff395a3 |
25 | #include <Font_NameOfFont.hxx> |
7fd59977 |
26 | |
27 | /************************************************************************* |
28 | * |
29 | * CONSTRUCTION/DESTRUCTION |
30 | * |
31 | **************************************************************************/ |
32 | |
33 | |
1cd84fee |
34 | QABugs_MyText::QABugs_MyText(const TCollection_ExtendedString& aText, const gp_Pnt& aPosition, |
7fd59977 |
35 | const Standard_CString aFont, const Quantity_NameOfColor aColor, const Standard_Real aHeight) |
36 | { |
37 | myPosition = aPosition; |
38 | myText = TCollection_ExtendedString(aText); |
39 | myNameOfFont = aFont; |
40 | myNameOfColor = aColor; |
41 | myHeight = aHeight; |
42 | } |
43 | |
44 | |
45 | /************************************************************************* |
46 | * |
47 | * QUERY METHODS |
48 | * |
49 | **************************************************************************/ |
50 | |
35e08fe8 |
51 | void QABugs_MyText::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/, |
7fd59977 |
52 | const Handle(Prs3d_Presentation)& aPresentation, |
35e08fe8 |
53 | const Standard_Integer /*aMode*/ ) |
7fd59977 |
54 | { |
55 | aPresentation->Clear(); |
857ffd5e |
56 | Handle(Prs3d_TextAspect) asp = myDrawer->TextAspect(); |
7fd59977 |
57 | |
58 | asp->SetFont(myNameOfFont); |
59 | asp->SetColor(myNameOfColor); |
60 | asp->SetHeight(myHeight); // I am changing the myHeight value |
61 | Prs3d_Text::Draw(aPresentation, asp, myText, myPosition); |
62 | } |
63 | |
1cd84fee |
64 | void QABugs_MyText::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, |
35e08fe8 |
65 | const Standard_Integer /*aMode*/) |
7fd59977 |
66 | { |
67 | // This code is here to compute the selection, erase this code if you don't what selection. |
68 | |
69 | Handle( SelectMgr_EntityOwner ) own = new SelectMgr_EntityOwner(this, 7); |
70 | |
71 | Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox(own, |
72 | myPosition.X(), |
73 | myPosition.Y(), |
74 | myPosition.Z(), |
75 | myPosition.X() + 20, |
76 | myPosition.Y() + 20, |
77 | myPosition.Z() + 20); |
78 | aSelection->Add(box); |
79 | } |
80 | |
81 | |
1cd84fee |
82 | Standard_Integer QABugs_MyText::NbPossibleSelection() const |
7fd59977 |
83 | { |
84 | return 1; |
85 | } |
86 | |