Open CASCADE Technology Reference Manual 8.0.2
Loading...
Searching...
No Matches
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 bool theIsVerbose=false)
 (Re)Load a Draw Harness plugin.
Tcl variables management tools

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

static void Set (const char *const Name, const occ::handle< Draw_Drawable3D > &D, const bool Disp)
 Sets a variable, a null handle clear the vartiable. Automatic display is context driven.
static void Set (const char *const Name, const occ::handle< Draw_Drawable3D > &D)
 Sets a variable, a null handle clear the vartiable. Automatic display is context driven.
static void Set (const char *const Name, const double val)
 Sets a numeric variable.
static Draw_Interpretor & GetInterpretor ()
 Returns main DRAW interpreter.
static occ::handle< Draw_Drawable3D > Get (const char *&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 occ::handle< Draw_Drawable3D > GetExisting (const char *const theName)
 Returns a variable value.
static bool Get (const char *const Name, double &val)
 Gets a numeric variable. Returns True if the variable exist.
static void Set (const char *const Name, const char *const val)
 Sets a TCL string variable.
static const NCollection_Map< occ::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 double Atof (const char *const Name)
 Converts the numeric expression, that can involve DRAW variables, to a real value.
static bool ParseReal (const char *const theExpressionString, double &theParsedRealValue)
 Converts the numeric expression, that can involve DRAW variables, to a real value.
static int Atoi (const char *const Name)
 Converts numeric expression, that can involve DRAW variables, to integer value. Implemented as cast of Atof() to integer.
static bool ParseInteger (const char *const theExpressionString, int &theParsedIntegerValue)
 Converts the numeric expression, that can involve DRAW variables, to an integer value.
static int ParseColor (const int 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 int ParseColor (const int theArgNb, const char *const *const theArgVec, Quantity_Color &theColor)
 Parses RGB color argument(s).
static bool ParseOnOff (const char *theArg, bool &theIsOn)
 Parses boolean argument. Handles either flag specified by 0|1 or on|off.
static bool ParseOnOffIterator (int theArgsNb, const char **theArgVec, int &theArgIter)
 Parses boolean argument at specified iterator position with optional on/off coming next.
static bool ParseOnOffNoIterator (int theArgsNb, const char **theArgVec, int &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 (int &view, int &X, int &Y, int &button)
 Returns last graphic selection description.
static void Repaint ()
 Asks to repaint the screen after the current command.
static void SetProgressBar (const occ::handle< Draw_ProgressIndicator > &theProgress)
 sets progress indicator
static occ::handle< Draw_ProgressIndicator > GetProgressBar ()
 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 occ::handle< Draw_Drawable3D > getDrawable (const char *&theName, bool theToAllowPick)
 Returns a variable value.
static int parseColor (int 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()

double Draw::Atof ( const char *const 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()

int Draw::Atoi ( const char *const Name)
static

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

◆ BasicCommands()

void Draw::BasicCommands ( Draw_Interpretor & I)
static

Defines Draw basic commands.

◆ Commands()

void Draw::Commands ( Draw_Interpretor & I)
static

Defines Draw basic commands.

◆ Drawables()

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

Returns a map of Draw_Drawable3D variables.

◆ Get() [1/2]

occ::handle< Draw_Drawable3D > Draw::Get ( const char *& 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.

◆ Get() [2/2]

bool Draw::Get ( const char *const Name,
double & val )
static

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

◆ getDrawable()

occ::handle< Draw_Drawable3D > Draw::getDrawable ( const char *& theName,
bool 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()

occ::handle< Draw_Drawable3D > Draw::GetExisting ( const char *const theName)
inlinestatic

Returns a variable value.

◆ GetInterpretor()

Draw_Interpretor & Draw::GetInterpretor ( )
static

Returns main DRAW interpreter.

◆ GetProgressBar()

occ::handle< Draw_ProgressIndicator > Draw::GetProgressBar ( )
static

gets progress indicator

◆ GraphicCommands()

void Draw::GraphicCommands ( Draw_Interpretor & I)
static

Defines Draw variables handling commands.

◆ LastPick()

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

Returns last graphic selection description.

◆ Load()

void Draw::Load ( Draw_Interpretor & theDI,
const TCollection_AsciiString & theKey,
const TCollection_AsciiString & theResourceFileName,
const TCollection_AsciiString & theDefaultsDirectory,
const TCollection_AsciiString & theUserDefaultsDirectory,
const bool theIsVerbose = false )
static

(Re)Load a Draw Harness plugin.

Parameters
[in]

out] theDI Tcl interpreter 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()

void Draw::MessageCommands ( Draw_Interpretor & I)
static

Defines Draw message commands.

◆ ParseColor() [1/2]

int Draw::ParseColor ( const int 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]

int Draw::ParseColor ( const int 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")
{
int 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
}
}
static int ParseColor(const int 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:53
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()

int Draw::parseColor ( int 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()

bool Draw::ParseInteger ( const char *const theExpressionString,
int & 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()

bool Draw::ParseOnOff ( const char * theArg,
bool & 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 bool ParseOnOff(const char *theArg, bool &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()

bool Draw::ParseOnOffIterator ( int theArgsNb,
const char ** theArgVec,
int & 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 bool ParseOnOffIterator(int theArgsNb, const char **theArgVec, int &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()

bool Draw::ParseOnOffNoIterator ( int theArgsNb,
const char ** theArgVec,
int & 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()

bool Draw::ParseReal ( const char *const theExpressionString,
double & 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()

void Draw::PloadCommands ( Draw_Interpretor & I)
static

Defines Loads Draw plugins commands.

◆ Repaint()

void Draw::Repaint ( )
static

Asks to repaint the screen after the current command.

◆ Set() [1/4]

void Draw::Set ( const char *const Name,
const char *const val )
static

Sets a TCL string variable.

◆ Set() [2/4]

void Draw::Set ( const char *const Name,
const double val )
static

Sets a numeric variable.

◆ Set() [3/4]

void Draw::Set ( const char *const Name,
const occ::handle< Draw_Drawable3D > & D )
static

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

◆ Set() [4/4]

void Draw::Set ( const char *const Name,
const occ::handle< Draw_Drawable3D > & D,
const bool Disp )
static

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

◆ SetProgressBar()

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

sets progress indicator

◆ UnitCommands()

void Draw::UnitCommands ( Draw_Interpretor & I)
static

Defines Draw unit commands.

◆ VariableCommands()

void Draw::VariableCommands ( Draw_Interpretor & I)
static

Defines Draw variables handling commands.


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