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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Draw_HeaderFile
18 #define _Draw_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
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;
47 class Draw_Chronometer;
50 class Draw_ProgressIndicator;
54 //! MAQUETTE DESSIN MODELISATION
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);
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);
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);
71 //! Sets a numeric variable.
72 Standard_EXPORT static void Set (const Standard_CString Name, const Standard_Real val);
74 //! Returns main DRAW interpretor.
75 Standard_EXPORT static Draw_Interpretor& GetInterpretor();
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); }
81 //! Returns a variable value.
82 static Handle(Draw_Drawable3D) GetExisting (const Standard_CString& theName)
84 Standard_CString aName = theName;
85 return getDrawable (aName, Standard_False);
88 //! Gets a numeric variable. Returns True if the
90 Standard_EXPORT static Standard_Boolean Get (const Standard_CString Name, Standard_Real& val);
92 //! Sets a TCL sting variable
93 Standard_EXPORT static void Set (const Standard_CString Name, const Standard_CString val);
95 //! Converts numeric expression, that can involve DRAW
96 //! variables, to real value.
97 Standard_EXPORT static Standard_Real Atof (const Standard_CString Name);
99 //! Converts the numeric expression, that can involve DRAW variables, to a real value
100 //! @param theExpressionString the strings that containes the expression involving DRAW variables to be parsed
101 //! @param theParsedRealValue a real value that is a result of parsing
102 //! @return true if parsing was successfull, or false otherwise
103 Standard_EXPORT static bool ParseReal (const Standard_CString theExpressionString, Standard_Real& theParsedRealValue);
105 //! Converts numeric expression, that can involve DRAW
106 //! variables, to integer value.
107 //! Implemented as cast of Atof() to integer.
108 Standard_EXPORT static Standard_Integer Atoi (const Standard_CString Name);
110 //! Converts the numeric expression, that can involve DRAW variables, to an integer value
111 //! @param theExpressionString the strings that containes the expression involving DRAW variables to be parsed
112 //! @param theParsedIntegerValue an integer value that is a result of parsing
113 //! @return true if parsing was successfull, or false otherwise
114 Standard_EXPORT static bool ParseInteger (const Standard_CString theExpressionString,
115 Standard_Integer& theParsedIntegerValue);
117 //! Returns last graphic selection description.
118 Standard_EXPORT static void LastPick (Standard_Integer& view, Standard_Integer& X, Standard_Integer& Y, Standard_Integer& button);
120 //! Asks to repaint the screen after the current command.
121 Standard_EXPORT static void Repaint();
123 //! sets progress indicator
124 Standard_EXPORT static void SetProgressBar (const Handle(Draw_ProgressIndicator)& thePI);
126 //! gets progress indicator
127 Standard_EXPORT static Handle(Draw_ProgressIndicator) GetProgressBar();
129 //! Defines all Draw commands
130 Standard_EXPORT static void Commands (Draw_Interpretor& I);
132 //! Defines Draw basic commands
133 Standard_EXPORT static void BasicCommands (Draw_Interpretor& I);
135 //! Defines Draw variables handling commands.
136 Standard_EXPORT static void VariableCommands (Draw_Interpretor& I);
138 //! Defines Draw variables handling commands.
139 Standard_EXPORT static void GraphicCommands (Draw_Interpretor& I);
141 //! Defines Loads Draw plugins commands.
142 Standard_EXPORT static void PloadCommands (Draw_Interpretor& I);
144 //! Defines Draw unit commands
145 Standard_EXPORT static void UnitCommands (Draw_Interpretor& I);
149 //! Returns a variable value.
150 //! @param theName [in] [out] variable name, or "." to activate picking
151 //! @param theToAllowPick [in] when TRUE, "." name will activate picking
152 Standard_EXPORT static Handle(Draw_Drawable3D) getDrawable (Standard_CString& theName,
153 Standard_Boolean theToAllowPick);
157 friend class Draw_Drawable3D;
158 friend class Draw_Drawable2D;
159 friend class Draw_Color;
160 friend class Draw_Display;
161 friend class Draw_Segment3D;
162 friend class Draw_Segment2D;
163 friend class Draw_Marker3D;
164 friend class Draw_Marker2D;
165 friend class Draw_Axis3D;
166 friend class Draw_Axis2D;
167 friend class Draw_Text3D;
168 friend class Draw_Text2D;
169 friend class Draw_Circle3D;
170 friend class Draw_Circle2D;
171 friend class Draw_Number;
172 friend class Draw_Chronometer;
173 friend class Draw_Grid;
174 friend class Draw_Box;
175 friend class Draw_ProgressIndicator;
176 friend class Draw_Printer;
186 #endif // _Draw_HeaderFile