0028060: Samples - Objects in Geometry/Viewer2d have incorrect color
[occt.git] / samples / mfc / standard / 01_Geometry / src / ISession2D / ISession_Text.h
1 // ISession_Text.h: interface for the ISession_Text class.
2 //
3 //////////////////////////////////////////////////////////////////////
4
5 #if !defined(AFX_ISESSION_TEXT_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_)
6 #define AFX_ISESSION_TEXT_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_
7
8 #if _MSC_VER >= 1000
9 #pragma once
10 #endif // _MSC_VER >= 1000
11
12 #include <Standard_Macro.hxx>
13 #include <Standard_DefineHandle.hxx>
14 #include <TCollection_AsciiString.hxx>
15 #include <Standard_Real.hxx>
16 #include <Standard_Integer.hxx>
17 #include <Quantity_Factor.hxx>
18 #include <Quantity_PlaneAngle.hxx>
19 #include <PrsMgr_PresentationManager3d.hxx>
20 #include <SelectMgr_Selection.hxx>
21 #include <Standard_OStream.hxx>
22 #include <Standard_IStream.hxx>
23 #include <Standard_CString.hxx>
24 #include <SelectMgr_SelectableObject.hxx>
25
26 class TCollection_AsciiString;
27 class SelectMgr_Selection;
28 class ISession_Text;
29 DEFINE_STANDARD_HANDLE(ISession_Text,AIS_InteractiveObject)
30 class ISession_Text : public AIS_InteractiveObject  
31 {
32 public:
33         ISession_Text();
34
35     ISession_Text           (const TCollection_AsciiString& aText,
36                              const Standard_Real            anX         = 0   ,
37                              const Standard_Real            anY         = 0   ,
38                              const Standard_Real            aZ          = 0   ,
39                              const Quantity_PlaneAngle      anAngle     = 0.0 ,
40                              const Standard_Real            aSlant      = 0.0 ,
41                              const Standard_Integer         aColorIndex = 1   ,
42                              const Standard_Integer         aFontIndex  = 1   ,
43                              const Quantity_Factor          aScale      = 0.1   );
44     ISession_Text
45                             (const TCollection_AsciiString& aText, 
46                              gp_Pnt&                        aPoint,
47                              const Quantity_PlaneAngle      anAngle     = 0.0 ,
48                              const Standard_Real            aSlant      = 0.0 ,
49                              const Standard_Integer         aColorIndex = 1   ,
50                              const Standard_Integer         aFontIndex  = 1   ,
51                              const Quantity_Factor          aScale      = 0.1   );
52
53         virtual ~ISession_Text();
54
55 inline   Standard_Integer        NbPossibleSelection() const;
56 inline   TCollection_AsciiString GetText() const;
57 inline   void                    SetText(const TCollection_AsciiString& atext) ;
58 inline   void                    GetCoord(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const ;
59 inline   void                    SetCoord(const Standard_Real X, const Standard_Real Y, const Standard_Real Z=0);
60 inline   Standard_Real           GetAngle() const;
61 inline   void                    SetAngle(const Standard_Real aNewAngle) ;
62 inline   Standard_Real           GetSlant() const;
63 inline   void                    SetSlant(const Standard_Real aNewSlant) ;
64 inline   Standard_Integer        GetColorIndex() const;
65 inline   void                    SetColorIndex(const Standard_Integer aNewColorIndex) ;
66 inline   Standard_Integer        GetFontIndex() const;
67 inline   void                    SetFontIndex(const Standard_Integer aNewFontIndex) ;
68 inline   Quantity_Factor         GetScale() const;
69 inline   void                    SetScale  (const Quantity_Factor aNewScale) ;
70
71
72 DEFINE_STANDARD_RTTIEXT(ISession_Text,AIS_InteractiveObject)
73
74 private: 
75
76   void Compute          (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
77                         const Handle(Prs3d_Presentation)& aPresentation,
78                         const Standard_Integer aMode);
79   void Compute          (const Handle(Prs3d_Projector)& aProjector,
80                         const Handle(Prs3d_Presentation)& aPresentation);
81   void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
82                         const Standard_Integer unMode) ;
83
84
85  // Fields PRIVATE
86  //
87 TCollection_AsciiString MyText       ; 
88 Standard_Real           MyX          ;
89 Standard_Real           MyY          ;
90 Standard_Real           MyZ          ;
91 Standard_Real           MyAngle      ;
92 Standard_Real           MySlant      ;
93 Standard_Integer        MyColorIndex ;
94 Standard_Integer        MyFontIndex  ;
95 Quantity_Factor         MyScale      ;
96 Standard_Real           MyWidth      ;
97 Standard_Real           MyHeight     ;
98
99
100 };
101
102  inline Standard_Integer ISession_Text::NbPossibleSelection() const 
103 { return 1; }
104
105 inline TCollection_AsciiString ISession_Text::GetText() const 
106 {  return MyText ; }
107
108 inline void ISession_Text::SetText(const TCollection_AsciiString& atext)
109 {  MyText = atext; }
110
111 inline void ISession_Text::GetCoord(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const 
112 {  X = MyX;  Y = MyY; Z = MyZ;}
113
114 inline void ISession_Text::SetCoord(const Standard_Real X, const Standard_Real Y, const Standard_Real Z)
115 {  MyX = X ;  MyY = Y ;  MyZ = Z ;}
116
117 inline Standard_Real ISession_Text::GetAngle() const 
118 {  return MyAngle; }
119
120 inline void ISession_Text::SetAngle(const Standard_Real aNewAngle)
121 {  MyAngle = aNewAngle; }
122
123 inline Standard_Real ISession_Text::GetSlant() const 
124 {  return MySlant; }
125
126 inline void ISession_Text::SetSlant(const Standard_Real aNewSlant)
127 {  MySlant = aNewSlant; }
128
129 inline Standard_Integer ISession_Text::GetColorIndex() const 
130 {  return MyColorIndex; }
131
132 inline void ISession_Text::SetColorIndex(const Standard_Integer aNewColorIndex)
133 {  MyColorIndex = aNewColorIndex; }
134
135 inline Standard_Integer ISession_Text::GetFontIndex() const 
136 { return MyFontIndex; }
137
138 inline void ISession_Text::SetFontIndex(const Standard_Integer aNewFontIndex)
139 {  MyFontIndex = aNewFontIndex; }
140
141 inline Quantity_Factor ISession_Text::GetScale() const 
142 {  return MyScale; }
143
144 inline void ISession_Text::SetScale(const Quantity_Factor aNewScale)
145 {  MyScale  = aNewScale; }
146
147 #endif // !defined(AFX_ISESSION_TEXT_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_)