b311480e |
1 | // Created on: 2002-04-10 |
2 | // Created by: QA Admin |
3 | // Copyright (c) 2002-2012 OPEN CASCADE SAS |
4 | // |
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. |
9 | // |
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. |
12 | // |
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. |
19 | |
7fd59977 |
20 | |
21 | |
22 | #include <QATelco_MyText.ixx> |
23 | #include <QATelco_MyText.hxx> |
24 | #include <Prs3d_Presentation.hxx> |
25 | #include <Prs3d_TextAspect.hxx> |
26 | #include <AIS_Drawer.hxx> |
27 | #include <SelectMgr_EntityOwner.hxx> |
28 | #include <Prs3d_Text.hxx> |
29 | #include <Select3D_SensitiveBox.hxx> |
30 | #include <SelectMgr_Selection.hxx> |
31 | #include <Graphic3d_NameOfFont.hxx> |
32 | |
33 | /************************************************************************* |
34 | * |
35 | * CONSTRUCTION/DESTRUCTION |
36 | * |
37 | **************************************************************************/ |
38 | |
39 | |
40 | QATelco_MyText::QATelco_MyText(const TCollection_ExtendedString& aText, const gp_Pnt& aPosition, |
41 | const Standard_CString aFont, const Quantity_NameOfColor aColor, const Standard_Real aHeight) |
42 | { |
43 | myPosition = aPosition; |
44 | myText = TCollection_ExtendedString(aText); |
45 | myNameOfFont = aFont; |
46 | myNameOfColor = aColor; |
47 | myHeight = aHeight; |
48 | } |
49 | |
50 | |
51 | /************************************************************************* |
52 | * |
53 | * QUERY METHODS |
54 | * |
55 | **************************************************************************/ |
56 | |
57 | void QATelco_MyText::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, |
58 | const Handle(Prs3d_Presentation)& aPresentation, |
59 | const Standard_Integer aMode ) |
60 | { |
61 | aPresentation->Clear(); |
62 | Handle_Prs3d_TextAspect asp = myDrawer->TextAspect(); |
63 | |
64 | asp->SetFont(myNameOfFont); |
65 | asp->SetColor(myNameOfColor); |
66 | asp->SetHeight(myHeight); // I am changing the myHeight value |
67 | Prs3d_Text::Draw(aPresentation, asp, myText, myPosition); |
68 | } |
69 | |
70 | void QATelco_MyText::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, |
71 | const Standard_Integer aMode) |
72 | { |
73 | // This code is here to compute the selection, erase this code if you don't what selection. |
74 | |
75 | Handle( SelectMgr_EntityOwner ) own = new SelectMgr_EntityOwner(this, 7); |
76 | |
77 | Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox(own, |
78 | myPosition.X(), |
79 | myPosition.Y(), |
80 | myPosition.Z(), |
81 | myPosition.X() + 20, |
82 | myPosition.Y() + 20, |
83 | myPosition.Z() + 20); |
84 | aSelection->Add(box); |
85 | } |
86 | |
87 | |
88 | Standard_Integer QATelco_MyText::NbPossibleSelection() const |
89 | { |
90 | return 1; |
91 | } |
92 | |