Open CASCADE Technology  7.6.0.dev
Static Public Member Functions

Draw Class Reference

MAQUETTE DESSIN MODELISATION. More...

#include <Draw.hxx>

Static Public Member Functions

static void Load (Draw_Interpretor &theDI, const TCollection_AsciiString &theKey, const TCollection_AsciiString &theResourceFileName, const TCollection_AsciiString &theDefaultsDirectory, const TCollection_AsciiString &theUserDefaultsDirectory, const Standard_Boolean theIsVerbose=Standard_False)
 (Re)Load a Draw Harness plugin. More...
 
Tcl variables management tools
static void Set (const Standard_CString Name, const Handle< Draw_Drawable3D > &D, const Standard_Boolean Disp)
 Sets a variable. Display it if <Disp> is true. More...
 
static void Set (const Standard_CString Name, const Handle< Draw_Drawable3D > &D)
 Sets a variable, a null handle clear the vartiable. Automatic display is context driven. More...
 
static void Set (const Standard_CString Name, const Standard_Real val)
 Sets a numeric variable. More...
 
static Draw_InterpretorGetInterpretor ()
 Returns main DRAW interpretor. More...
 
static Handle< Draw_Drawable3DGet (Standard_CString &theName)
 Returns a variable value. The name "." does a graphic selection; in this case theName will be is overwritten with the name of the variable. More...
 
static Handle< Draw_Drawable3DGetExisting (const Standard_CString &theName)
 Returns a variable value. More...
 
static Standard_Boolean Get (const Standard_CString Name, Standard_Real &val)
 Gets a numeric variable. Returns True if the variable exist. More...
 
static void Set (const Standard_CString Name, const Standard_CString val)
 Sets a TCL string variable. More...
 
static const NCollection_Map< Handle< Draw_Drawable3D > > & Drawables ()
 Returns a map of Draw_Drawable3D variables. More...
 
argument parsing tools
static Standard_Real Atof (const Standard_CString Name)
 Converts numeric expression, that can involve DRAW variables, to real value. More...
 
static bool ParseReal (const Standard_CString theExpressionString, Standard_Real &theParsedRealValue)
 Converts the numeric expression, that can involve DRAW variables, to a real value. More...
 
static Standard_Integer Atoi (const Standard_CString Name)
 Converts numeric expression, that can involve DRAW variables, to integer value. Implemented as cast of Atof() to integer. More...
 
static bool ParseInteger (const Standard_CString theExpressionString, Standard_Integer &theParsedIntegerValue)
 Converts the numeric expression, that can involve DRAW variables, to an integer value. More...
 
static Standard_Integer ParseColor (const Standard_Integer theArgNb, const char *const *const theArgVec, Quantity_ColorRGBA &theColor)
 Parses RGB(A) color argument(s) specified within theArgVec[0], theArgVec[1], theArgVec[2] and theArgVec[3]. Handles either color specified by name (single argument) or by RGB(A) components (3-4 arguments) in range 0..1. The result is stored in theColor on success. More...
 
static Standard_Integer ParseColor (const Standard_Integer theArgNb, const char *const *const theArgVec, Quantity_Color &theColor)
 Parses RGB color argument(s). More...
 
static Standard_Boolean ParseOnOff (Standard_CString theArg, Standard_Boolean &theIsOn)
 Parses boolean argument. Handles either flag specified by 0|1 or on|off. More...
 
static Standard_Boolean ParseOnOffIterator (Standard_Integer theArgsNb, const char **theArgVec, Standard_Integer &theArgIter)
 Parses boolean argument at specified iterator position with optional on/off coming next. More...
 
static Standard_Boolean ParseOnOffNoIterator (Standard_Integer theArgsNb, const char **theArgVec, Standard_Integer &theArgIter)
 Parses boolean argument at specified iterator position with optional on/off coming next. Similar to ParseOnOffIterator() but also reverses returned value if argument name starts with "no" prefix. E.g. if nominal argument is "cmd -usefeature [on|off|1|0]=on", then "-nousefeature" argument will return FALSE. More...
 
static void LastPick (Standard_Integer &view, Standard_Integer &X, Standard_Integer &Y, Standard_Integer &button)
 Returns last graphic selection description. More...
 
static void Repaint ()
 Asks to repaint the screen after the current command. More...
 
static void SetProgressBar (const Handle< Draw_ProgressIndicator > &theProgress)
 sets progress indicator More...
 
static Handle< Draw_ProgressIndicatorGetProgressBar ()
 gets progress indicator More...
 

methods loading standard command sets

static void Commands (Draw_Interpretor &I)
 Defines all Draw commands. More...
 
static void BasicCommands (Draw_Interpretor &I)
 Defines Draw basic commands. More...
 
static void MessageCommands (Draw_Interpretor &I)
 Defines Draw message commands. More...
 
static void VariableCommands (Draw_Interpretor &I)
 Defines Draw variables handling commands. More...
 
static void GraphicCommands (Draw_Interpretor &I)
 Defines Draw variables handling commands. More...
 
static void PloadCommands (Draw_Interpretor &I)
 Defines Loads Draw plugins commands. More...
 
static void UnitCommands (Draw_Interpretor &I)
 Defines Draw unit commands. More...
 
static Handle< Draw_Drawable3DgetDrawable (Standard_CString &theName, Standard_Boolean theToAllowPick)
 Returns a variable value. More...
 
static Standard_Integer parseColor (Standard_Integer theArgNb, const char *const *theArgVec, Quantity_ColorRGBA &theColor, bool theToParseAlpha)
 Parses RGB(A) color argument(s) specified within theArgVec[0], theArgVec[1], theArgVec[2] and theArgVec[3]. Handles either color specified by name (single argument) or by RGB(A) components (3-4 arguments) in range 0..1. The result is stored in theColor on success. Returns number of handled arguments (1, 2, 3 or 4) or 0 on syntax error. More...
 

Detailed Description

MAQUETTE DESSIN MODELISATION.

Member Function Documentation

◆ Atof()

static Standard_Real Draw::Atof ( const Standard_CString  Name)
static

Converts numeric expression, that can involve DRAW variables, to real value.

◆ Atoi()

static Standard_Integer Draw::Atoi ( const Standard_CString  Name)
static

Converts numeric expression, that can involve DRAW variables, to integer value. Implemented as cast of Atof() to integer.

◆ BasicCommands()

static void Draw::BasicCommands ( Draw_Interpretor I)
static

Defines Draw basic commands.

◆ Commands()

static void Draw::Commands ( Draw_Interpretor I)
static

Defines all Draw commands.

◆ Drawables()

static const NCollection_Map<Handle< Draw_Drawable3D > >& Draw::Drawables ( )
static

Returns a map of Draw_Drawable3D variables.

◆ Get() [1/2]

static Standard_Boolean Draw::Get ( const Standard_CString  Name,
Standard_Real val 
)
static

Gets a numeric variable. Returns True if the variable exist.

◆ Get() [2/2]

static Handle< Draw_Drawable3D > Draw::Get ( Standard_CString theName)
inlinestatic

Returns a variable value. The name "." does a graphic selection; in this case theName will be is overwritten with the name of the variable.

◆ getDrawable()

static Handle< Draw_Drawable3D > Draw::getDrawable ( Standard_CString theName,
Standard_Boolean  theToAllowPick 
)
staticprotected

Returns a variable value.

Parameters
theName[in] [out] variable name, or "." to activate picking
theToAllowPick[in] when TRUE, "." name will activate picking

◆ GetExisting()

static Handle< Draw_Drawable3D > Draw::GetExisting ( const Standard_CString theName)
inlinestatic

Returns a variable value.

◆ GetInterpretor()

static Draw_Interpretor& Draw::GetInterpretor ( )
static

Returns main DRAW interpretor.

◆ GetProgressBar()

static Handle< Draw_ProgressIndicator > Draw::GetProgressBar ( )
static

gets progress indicator

◆ GraphicCommands()

static void Draw::GraphicCommands ( Draw_Interpretor I)
static

Defines Draw variables handling commands.

◆ LastPick()

static void Draw::LastPick ( Standard_Integer view,
Standard_Integer X,
Standard_Integer Y,
Standard_Integer button 
)
static

Returns last graphic selection description.

◆ Load()

static void Draw::Load ( Draw_Interpretor theDI,
const TCollection_AsciiString theKey,
const TCollection_AsciiString theResourceFileName,
const TCollection_AsciiString theDefaultsDirectory,
const TCollection_AsciiString theUserDefaultsDirectory,
const Standard_Boolean  theIsVerbose = Standard_False 
)
static

(Re)Load a Draw Harness plugin.

Parameters
theDI[in] [out] Tcl interpretor to append loaded commands
theKey[in] plugin code name to be resolved in resource file
theResourceFileName[in] description file name
theDefaultsDirectory[in] default folder for looking description file
theUserDefaultsDirectory[in] user folder for looking description file
theIsVerbose[in] print verbose messages

◆ MessageCommands()

static void Draw::MessageCommands ( Draw_Interpretor I)
static

Defines Draw message commands.

◆ ParseColor() [1/2]

static Standard_Integer Draw::ParseColor ( const Standard_Integer  theArgNb,
const char *const *const  theArgVec,
Quantity_Color theColor 
)
inlinestatic

Parses RGB color argument(s).

Parameters
theArgNb[in] number of available arguments in theArgVec (array limits)
theArgVec[in] argument list
theColor[out] retrieved color
Returns
number of handled arguments (1 or 3) or 0 on syntax error.

◆ ParseColor() [2/2]

static Standard_Integer Draw::ParseColor ( const Standard_Integer  theArgNb,
const char *const *const  theArgVec,
Quantity_ColorRGBA theColor 
)
inlinestatic

Parses RGB(A) color argument(s) specified within theArgVec[0], theArgVec[1], theArgVec[2] and theArgVec[3]. Handles either color specified by name (single argument) or by RGB(A) components (3-4 arguments) in range 0..1. The result is stored in theColor on success.

Usage code sample for command argument in form "cmd -color {ColorName|R G B [A]|ColorHex}":

for (int anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
{
TCollection_AsciiString aParam (theArgVec[anArgIter]);
aParam.LowerCase();
if (aParam == "-color")
{
Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1, aColor);
anArgIter += aNbParsed;
if (aNbParsed == 0) { std::cerr << "Syntax error at '" << aParam << "'"; return 1; }
// process color
}
}
int Standard_Integer
Definition: Standard_TypeDef.hxx:75
static Standard_Integer ParseColor(const Standard_Integer theArgNb, const char *const *const theArgVec, Quantity_ColorRGBA &theColor)
Parses RGB(A) color argument(s) specified within theArgVec[0], theArgVec[1], theArgVec[2] and theArgV...
Definition: Draw.hxx:135
The pair of Quantity_Color and Alpha component (1.0 opaque, 0.0 transparent).
Definition: Quantity_ColorRGBA.hxx:22
Class defines a variable-length sequence of 8-bit characters. Despite class name (kept for historical...
Definition: TCollection_AsciiString.hxx:53
Parameters
theArgNb[in] number of available arguments in theArgVec (array limits)
theArgVec[in] argument list
theColor[out] retrieved color
Returns
number of handled arguments (1, 2, 3 or 4) or 0 on syntax error

◆ parseColor()

static Standard_Integer Draw::parseColor ( Standard_Integer  theArgNb,
const char *const *  theArgVec,
Quantity_ColorRGBA theColor,
bool  theToParseAlpha 
)
staticprotected

Parses RGB(A) color argument(s) specified within theArgVec[0], theArgVec[1], theArgVec[2] and theArgVec[3]. Handles either color specified by name (single argument) or by RGB(A) components (3-4 arguments) in range 0..1. The result is stored in theColor on success. Returns number of handled arguments (1, 2, 3 or 4) or 0 on syntax error.

◆ ParseInteger()

static bool Draw::ParseInteger ( const Standard_CString  theExpressionString,
Standard_Integer theParsedIntegerValue 
)
static

Converts the numeric expression, that can involve DRAW variables, to an integer value.

Parameters
theExpressionStringthe strings that contains the expression involving DRAW variables to be parsed
theParsedIntegerValuean integer value that is a result of parsing
Returns
true if parsing was successful, or false otherwise

◆ ParseOnOff()

static Standard_Boolean Draw::ParseOnOff ( Standard_CString  theArg,
Standard_Boolean theIsOn 
)
static

Parses boolean argument. Handles either flag specified by 0|1 or on|off.

Usage code sample for command argument in form "cmd -usefeature [on|off|1|0]=on":

for (int anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
{
TCollection_AsciiString aParam (theArgVec[anArgIter]);
aParam.LowerCase();
if (aParam == "-usefeature")
{
bool toUseFeature = true;
if (anArgIter + 1 < theNbArgs && Draw::ParseOnOff (theArgVec[anArgIter + 1]))
{
++anArgIter;
}
// process feature
}
}
static Standard_Boolean ParseOnOff(Standard_CString theArg, Standard_Boolean &theIsOn)
Parses boolean argument. Handles either flag specified by 0|1 or on|off.
Parameters
theArg[in] argument value
theIsOn[out] decoded Boolean flag
Returns
FALSE on syntax error

◆ ParseOnOffIterator()

static Standard_Boolean Draw::ParseOnOffIterator ( Standard_Integer  theArgsNb,
const char **  theArgVec,
Standard_Integer theArgIter 
)
static

Parses boolean argument at specified iterator position with optional on/off coming next.

Usage code sample for command argument in form "cmd -usefeature [on|off|1|0]=on":

for (int anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
{
if (strcasecmp (theArgVec[anArgIter], "-usefeature") == 0)
{
bool toUseFeature = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
// process feature
}
}
static Standard_Boolean ParseOnOffIterator(Standard_Integer theArgsNb, const char **theArgVec, Standard_Integer &theArgIter)
Parses boolean argument at specified iterator position with optional on/off coming next.
Parameters
theArgsNb[in] overall number of arguments
theArgVec[in] vector of arguments
theArgIter[in] [out] argument position to parse
Returns
flag value

◆ ParseOnOffNoIterator()

static Standard_Boolean Draw::ParseOnOffNoIterator ( Standard_Integer  theArgsNb,
const char **  theArgVec,
Standard_Integer theArgIter 
)
static

Parses boolean argument at specified iterator position with optional on/off coming next. Similar to ParseOnOffIterator() but also reverses returned value if argument name starts with "no" prefix. E.g. if nominal argument is "cmd -usefeature [on|off|1|0]=on", then "-nousefeature" argument will return FALSE.

Parameters
theArgsNb[in] overall number of arguments
theArgVec[in] vector of arguments
theArgIter[in] [out] argument position to parse
Returns
flag value

◆ ParseReal()

static bool Draw::ParseReal ( const Standard_CString  theExpressionString,
Standard_Real theParsedRealValue 
)
static

Converts the numeric expression, that can involve DRAW variables, to a real value.

Parameters
theExpressionStringthe strings that contains the expression involving DRAW variables to be parsed
theParsedRealValuea real value that is a result of parsing
Returns
true if parsing was successful, or false otherwise

◆ PloadCommands()

static void Draw::PloadCommands ( Draw_Interpretor I)
static

Defines Loads Draw plugins commands.

◆ Repaint()

static void Draw::Repaint ( )
static

Asks to repaint the screen after the current command.

◆ Set() [1/4]

static void Draw::Set ( const Standard_CString  Name,
const Handle< Draw_Drawable3D > &  D 
)
static

Sets a variable, a null handle clear the vartiable. Automatic display is context driven.

◆ Set() [2/4]

static void Draw::Set ( const Standard_CString  Name,
const Handle< Draw_Drawable3D > &  D,
const Standard_Boolean  Disp 
)
static

Sets a variable. Display it if <Disp> is true.

◆ Set() [3/4]

static void Draw::Set ( const Standard_CString  Name,
const Standard_CString  val 
)
static

Sets a TCL string variable.

◆ Set() [4/4]

static void Draw::Set ( const Standard_CString  Name,
const Standard_Real  val 
)
static

Sets a numeric variable.

◆ SetProgressBar()

static void Draw::SetProgressBar ( const Handle< Draw_ProgressIndicator > &  theProgress)
static

sets progress indicator

◆ UnitCommands()

static void Draw::UnitCommands ( Draw_Interpretor I)
static

Defines Draw unit commands.

◆ VariableCommands()

static void Draw::VariableCommands ( Draw_Interpretor I)
static

Defines Draw variables handling commands.


The documentation for this class was generated from the following file: