0030493: Draw, ViewerTest - minor improvement of vdisplay command
[occt.git] / src / Draw / Draw.hxx
1 // Created on: 1991-04-24
2 // Created by: Arnaud BOUZY
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Draw_HeaderFile
18 #define _Draw_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Draw_Interpretor.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_CString.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_Integer.hxx>
29 class TCollection_AsciiString;
30 class Draw_Drawable3D;
31 class Draw_ProgressIndicator;
32 class Draw_Drawable3D;
33 class Draw_Drawable2D;
34 class Draw_Color;
35 class Draw_Display;
36 class Draw_Segment3D;
37 class Draw_Segment2D;
38 class Draw_Marker3D;
39 class Draw_Marker2D;
40 class Draw_Axis3D;
41 class Draw_Axis2D;
42 class Draw_Text3D;
43 class Draw_Text2D;
44 class Draw_Circle3D;
45 class Draw_Circle2D;
46 class Draw_Number;
47 class Draw_Chronometer;
48 class Draw_Grid;
49 class Draw_Box;
50 class Draw_ProgressIndicator;
51 class Draw_Printer;
52
53
54 //! MAQUETTE DESSIN MODELISATION
55 class Draw 
56 {
57 public:
58
59   DEFINE_STANDARD_ALLOC
60
61   
62   Standard_EXPORT static void Load (Draw_Interpretor& theDI, const TCollection_AsciiString& theKey, const TCollection_AsciiString& theResourceFileName, TCollection_AsciiString& theDefaultsDirectory, TCollection_AsciiString& theUserDefaultsDirectory, const Standard_Boolean Verbose = Standard_False);
63   
64   //! Sets a variable. Display it if <Disp> is true.
65   Standard_EXPORT static void Set (const Standard_CString Name, const Handle(Draw_Drawable3D)& D, const Standard_Boolean Disp);
66   
67   //! Sets a    variable,  a  null   handle    clear the
68   //! vartiable. Automatic display is context driven.
69   Standard_EXPORT static void Set (const Standard_CString Name, const Handle(Draw_Drawable3D)& D);
70   
71   //! Sets a numeric variable.
72   Standard_EXPORT static void Set (const Standard_CString Name, const Standard_Real val);
73
74   //! Returns main DRAW interpretor.
75   Standard_EXPORT static Draw_Interpretor& GetInterpretor();
76
77   //! Returns a variable value.
78   //! The name "." does a graphic selection; in this case theName will be is overwritten with the name of the variable.
79   static Handle(Draw_Drawable3D) Get (Standard_CString& theName) { return getDrawable (theName, Standard_True); }
80
81   //! Returns a variable value.
82   static Handle(Draw_Drawable3D) GetExisting (const Standard_CString& theName)
83   {
84     Standard_CString aName = theName;
85     return getDrawable (aName, Standard_False);
86   }
87
88   //! Gets a   numeric  variable. Returns  True   if the
89   //! variable exist.
90   Standard_EXPORT static Standard_Boolean Get (const Standard_CString Name, Standard_Real& val);
91   
92   //! Sets a TCL sting variable
93   Standard_EXPORT static void Set (const Standard_CString Name, const Standard_CString val);
94   
95   //! Converts numeric expression, that can involve DRAW
96   //! variables, to real value.
97   Standard_EXPORT static Standard_Real Atof (const Standard_CString Name);
98   
99   //! Converts numeric expression, that can involve DRAW
100   //! variables, to integer value.
101   //! Implemented as cast of Atof() to integer.
102   Standard_EXPORT static Standard_Integer Atoi (const Standard_CString Name);
103   
104   //! Returns last graphic selection description.
105   Standard_EXPORT static void LastPick (Standard_Integer& view, Standard_Integer& X, Standard_Integer& Y, Standard_Integer& button);
106   
107   //! Asks to repaint the screen after the current command.
108   Standard_EXPORT static void Repaint();
109   
110   //! sets progress indicator
111   Standard_EXPORT static void SetProgressBar (const Handle(Draw_ProgressIndicator)& thePI);
112   
113   //! gets progress indicator
114   Standard_EXPORT static Handle(Draw_ProgressIndicator) GetProgressBar();
115   
116   //! Defines all Draw commands
117   Standard_EXPORT static void Commands (Draw_Interpretor& I);
118   
119   //! Defines Draw basic commands
120   Standard_EXPORT static void BasicCommands (Draw_Interpretor& I);
121   
122   //! Defines Draw variables handling commands.
123   Standard_EXPORT static void VariableCommands (Draw_Interpretor& I);
124   
125   //! Defines Draw variables handling commands.
126   Standard_EXPORT static void GraphicCommands (Draw_Interpretor& I);
127   
128   //! Defines Loads Draw plugins commands.
129   Standard_EXPORT static void PloadCommands (Draw_Interpretor& I);
130   
131   //! Defines Draw unit commands
132   Standard_EXPORT static void UnitCommands (Draw_Interpretor& I);
133
134 protected:
135
136   //! Returns a variable value.
137   //! @param theName [in] [out] variable name, or "." to activate picking
138   //! @param theToAllowPick [in] when TRUE, "." name will activate picking
139   Standard_EXPORT static Handle(Draw_Drawable3D) getDrawable (Standard_CString& theName,
140                                                               Standard_Boolean theToAllowPick);
141
142 private:
143
144 friend class Draw_Drawable3D;
145 friend class Draw_Drawable2D;
146 friend class Draw_Color;
147 friend class Draw_Display;
148 friend class Draw_Segment3D;
149 friend class Draw_Segment2D;
150 friend class Draw_Marker3D;
151 friend class Draw_Marker2D;
152 friend class Draw_Axis3D;
153 friend class Draw_Axis2D;
154 friend class Draw_Text3D;
155 friend class Draw_Text2D;
156 friend class Draw_Circle3D;
157 friend class Draw_Circle2D;
158 friend class Draw_Number;
159 friend class Draw_Chronometer;
160 friend class Draw_Grid;
161 friend class Draw_Box;
162 friend class Draw_ProgressIndicator;
163 friend class Draw_Printer;
164
165 };
166
167
168
169
170
171
172
173 #endif // _Draw_HeaderFile