Open CASCADE Technology 7.9.0
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.
 
Tcl variables management tools

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

static void Set (const Standard_CString Name, const Handle< Draw_Drawable3D > &D, const Standard_Boolean Disp)
 Sets a variable, a null handle clear the vartiable. Automatic display is context driven.
 
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.
 
static void Set (const Standard_CString Name, const Standard_Real val)
 Sets a numeric variable.
 
static Draw_InterpretorGetInterpretor ()
 Returns main DRAW interpretor.
 
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.
 
static Handle< Draw_Drawable3DGetExisting (const Standard_CString &theName)
 Returns a variable value.
 
static Standard_Boolean Get (const Standard_CString Name, Standard_Real &val)
 Gets a numeric variable. Returns True if the variable exist.
 
static void Set (const Standard_CString Name, const Standard_CString val)
 Sets a TCL string variable.
 
static const NCollection_Map< Handle< Draw_Drawable3D > > & Drawables ()
 Returns a map of Draw_Drawable3D variables.
 
argument parsing tools

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

static Standard_Real Atof (const Standard_CString Name)
 Converts the numeric expression, that can involve DRAW variables, to a real value.
 
static bool ParseReal (const Standard_CString theExpressionString, Standard_Real &theParsedRealValue)
 Converts the numeric expression, that can involve DRAW variables, to a real value.
 
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.
 
static bool ParseInteger (const Standard_CString theExpressionString, Standard_Integer &theParsedIntegerValue)
 Converts the numeric expression, that can involve DRAW variables, to an integer value.
 
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.
 
static Standard_Integer ParseColor (const Standard_Integer theArgNb, const char *const *const theArgVec, Quantity_Color &theColor)
 Parses RGB color argument(s).
 
static Standard_Boolean ParseOnOff (Standard_CString theArg, Standard_Boolean &theIsOn)
 Parses boolean argument. Handles either flag specified by 0|1 or on|off.
 
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.
 
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.
 
static void LastPick (Standard_Integer &view, Standard_Integer &X, Standard_Integer &Y, Standard_Integer &button)
 Returns last graphic selection description.
 
static void Repaint ()
 Asks to repaint the screen after the current command.
 
static void SetProgressBar (const Handle< Draw_ProgressIndicator > &theProgress)
 sets progress indicator
 
static Handle< Draw_ProgressIndicatorGetProgressBar ()
 gets progress indicator
 

methods loading standard command sets

Defines all Draw commands

static void Commands (Draw_Interpretor &I)
 Defines Draw basic commands.
 
static void BasicCommands (Draw_Interpretor &I)
 Defines Draw basic commands.
 
static void MessageCommands (Draw_Interpretor &I)
 Defines Draw message commands.
 
static void VariableCommands (Draw_Interpretor &I)
 Defines Draw variables handling commands.
 
static void GraphicCommands (Draw_Interpretor &I)
 Defines Draw variables handling commands.
 
static void PloadCommands (Draw_Interpretor &I)
 Defines Loads Draw plugins commands.
 
static void UnitCommands (Draw_Interpretor &I)
 Defines Draw unit commands.
 
static Handle< Draw_Drawable3DgetDrawable (Standard_CString &theName, Standard_Boolean theToAllowPick)
 Returns a variable value.
 
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.
 

Detailed Description

MAQUETTE DESSIN MODELISATION.

Member Function Documentation

◆ Atof()

static Standard_Real Draw::Atof ( const Standard_CString Name)
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

◆ 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 Draw basic 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
[in]

out] theName variable name, or "." to activate picking

Parameters
[in]theToAllowPickwhen 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
[in]

out] theDI Tcl interpretor to append loaded commands

Parameters
[in]theKeyplugin code name to be resolved in resource file
[in]theResourceFileNamedescription file name
[in]theDefaultsDirectorydefault folder for looking description file
[in]theUserDefaultsDirectoryuser folder for looking description file
[in]theIsVerboseprint 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
[in]theArgNbnumber of available arguments in theArgVec (array limits)
[in]theArgVecargument list
[out]theColorretrieved 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:61
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:141
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:48
Parameters
[in]theArgNbnumber of available arguments in theArgVec (array limits)
[in]theArgVecargument list
[out]theColorretrieved 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
[in]theArgargument value
[out]theIsOndecoded 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
[in]theArgsNboverall number of arguments
[in]theArgVecvector of arguments
[in]

out] theArgIter 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
[in]theArgsNboverall number of arguments
[in]theArgVecvector of arguments
[in]

out] theArgIter 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, a null handle clear the vartiable. Automatic display is context driven.

◆ 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: