1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0031709: Draw Harness - move methods ViewerTest::ParseOnOff()/ParseColor() to package Draw

Methods ParseOnOff()/ParseColor() have been moved from package ViewerTest to Draw.
Command "vlight -color" now accepts RGB values, not only name.
Implementation of pload command has been cleaned up.
This commit is contained in:
kgv
2020-08-12 15:58:22 +03:00
committed by bugmaster
parent 76fada6839
commit dae2a92241
14 changed files with 851 additions and 774 deletions

View File

@@ -84,161 +84,6 @@ extern int ViewerMainLoop(Standard_Integer argc, const char** argv);
#define DEFAULT_FREEBOUNDARY_COLOR Quantity_NOC_GREEN
#define DEFAULT_MATERIAL Graphic3d_NOM_BRASS
namespace
{
const Standard_Integer THE_MAX_INTEGER_COLOR_COMPONENT = 255;
const Standard_ShortReal THE_MAX_REAL_COLOR_COMPONENT = 1.0f;
//! Parses string and get an integer color component (only values within range 0 .. 255 are allowed)
//! @param theColorComponentString the string representing the color component
//! @param theIntegerColorComponent an integer color component that is a result of parsing
//! @return true if parsing was successful, or false otherwise
static bool parseNumericalColorComponent (const Standard_CString theColorComponentString,
Standard_Integer& theIntegerColorComponent)
{
Standard_Integer anIntegerColorComponent;
if (!Draw::ParseInteger (theColorComponentString, anIntegerColorComponent))
{
return false;
}
if ((anIntegerColorComponent < 0) || (anIntegerColorComponent > THE_MAX_INTEGER_COLOR_COMPONENT))
{
return false;
}
theIntegerColorComponent = anIntegerColorComponent;
return true;
}
//! Parses the string and gets a real color component from it (only values within range 0.0 .. 1.0 are allowed)
//! @param theColorComponentString the string representing the color component
//! @param theRealColorComponent a real color component that is a result of parsing
//! @return true if parsing was successful, or false otherwise
static bool parseNumericalColorComponent (const Standard_CString theColorComponentString,
Standard_ShortReal& theRealColorComponent)
{
Standard_Real aRealColorComponent;
if (!Draw::ParseReal (theColorComponentString, aRealColorComponent))
{
return false;
}
const Standard_ShortReal aShortRealColorComponent = static_cast<Standard_ShortReal> (aRealColorComponent);
if ((aShortRealColorComponent < 0.0f) || (aShortRealColorComponent > THE_MAX_REAL_COLOR_COMPONENT))
{
return false;
}
theRealColorComponent = aShortRealColorComponent;
return true;
}
//! Parses the string and gets a real color component from it (integer values 2 .. 255 are scaled to the 0.0 .. 1.0
//! range, values 0 and 1 are leaved as they are)
//! @param theColorComponentString the string representing the color component
//! @param theColorComponent a color component that is a result of parsing
//! @return true if parsing was successful, or false otherwise
static bool parseColorComponent (const Standard_CString theColorComponentString,
Standard_ShortReal& theColorComponent)
{
Standard_Integer anIntegerColorComponent;
if (parseNumericalColorComponent (theColorComponentString, anIntegerColorComponent))
{
if (anIntegerColorComponent == 1)
{
theColorComponent = THE_MAX_REAL_COLOR_COMPONENT;
}
else
{
theColorComponent = anIntegerColorComponent * 1.0f / THE_MAX_INTEGER_COLOR_COMPONENT;
}
return true;
}
return parseNumericalColorComponent (theColorComponentString, theColorComponent);
}
//! Parses the array of strings and gets an integer color (only values within range 0 .. 255 are allowed and at least
//! one of components must be greater than 1)
//! @tparam TheNumber the type of resulting color vector elements
//! @param theNumberOfColorComponents the number of color components
//! @param theColorComponentStrings the array of strings representing color components
//! @param theNumericalColor a 4-component vector that is a result of parsing
//! @return true if parsing was successful, or false otherwise
template <typename TheNumber>
static bool parseNumericalColor (Standard_Integer& theNumberOfColorComponents,
const char* const* const theColorComponentStrings,
NCollection_Vec4<TheNumber>& theNumericalColor)
{
for (Standard_Integer aColorComponentIndex = 0; aColorComponentIndex < theNumberOfColorComponents;
++aColorComponentIndex)
{
const char* const aColorComponentString = theColorComponentStrings[aColorComponentIndex];
TheNumber aNumericalColorComponent;
if (parseNumericalColorComponent (aColorComponentString, aNumericalColorComponent))
{
theNumericalColor[aColorComponentIndex] = aNumericalColorComponent;
}
else
{
if (aColorComponentIndex == 3)
{
theNumberOfColorComponents = 3;
}
else
{
return false;
}
}
}
return true;
}
//! Parses an array of strings and get an integer color (only values within range 0 .. 255 are allowed and at least
//! one of components must be greater than 1)
//! @param theNumberOfColorComponents the number of color components
//! @param theColorComponentStrings the array of strings representing color components
//! @param theColor a color that is a result of parsing
//! @return true if parsing was successful, or false otherwise
static bool parseIntegerColor (Standard_Integer& theNumberOfColorComponents,
const char* const* const theColorComponentStrings,
Quantity_ColorRGBA& theColor)
{
const Standard_Integer THE_COLOR_COMPONENT_NOT_PARSED = -1;
Graphic3d_Vec4i anIntegerColor (THE_COLOR_COMPONENT_NOT_PARSED);
if (!parseNumericalColor (theNumberOfColorComponents, theColorComponentStrings, anIntegerColor)
|| anIntegerColor.maxComp() <= 1)
{
return false;
}
if (anIntegerColor.a() == THE_COLOR_COMPONENT_NOT_PARSED)
{
anIntegerColor.a() = THE_MAX_INTEGER_COLOR_COMPONENT;
}
const Graphic3d_Vec4 aRealColor = Graphic3d_Vec4 (anIntegerColor) / static_cast<Standard_ShortReal> (THE_MAX_INTEGER_COLOR_COMPONENT);
theColor = Quantity_ColorRGBA (Quantity_ColorRGBA::Convert_sRGB_To_LinearRGB (aRealColor));
return true;
}
//! Parses an array of strings and get a real color (only values within range 0.0 .. 1.0 are allowed)
//! @param theNumberOfColorComponents the number of color components
//! @param theColorComponentStrings the array of strings representing color components
//! @param theColor a color that is a result of parsing
//! @return true if parsing was successful, or false otherwise
static bool parseRealColor (Standard_Integer& theNumberOfColorComponents,
const char* const* const theColorComponentStrings,
Quantity_ColorRGBA& theColor)
{
Graphic3d_Vec4 aRealColor (THE_MAX_REAL_COLOR_COMPONENT);
if (!parseNumericalColor (theNumberOfColorComponents, theColorComponentStrings, aRealColor))
{
return false;
}
theColor = Quantity_ColorRGBA (aRealColor);
return true;
}
} // namespace
//=======================================================================
// function : GetColorFromName
// purpose : get the Quantity_NameOfColor from a string
@@ -252,48 +97,25 @@ Quantity_NameOfColor ViewerTest::GetColorFromName (const Standard_CString theNam
}
//=======================================================================
// function : parseColor
// function : ParseColor
// purpose :
//=======================================================================
Standard_Integer ViewerTest::parseColor (const Standard_Integer theArgNb,
Standard_Integer ViewerTest::ParseColor (const Standard_Integer theArgNb,
const char* const* const theArgVec,
Quantity_ColorRGBA& theColor,
const bool theToParseAlpha)
Quantity_ColorRGBA& theColor)
{
if ((theArgNb >= 1) && Quantity_ColorRGBA::ColorFromHex (theArgVec[0], theColor, !theToParseAlpha))
{
return 1;
}
if (theArgNb >= 1 && Quantity_ColorRGBA::ColorFromName (theArgVec[0], theColor))
{
if (theArgNb >= 2 && theToParseAlpha)
{
const Standard_CString anAlphaStr = theArgVec[1];
Standard_ShortReal anAlphaComponent;
if (parseColorComponent (anAlphaStr, anAlphaComponent))
{
theColor.SetAlpha (anAlphaComponent);
return 2;
}
}
return 1;
}
if (theArgNb >= 3)
{
const Standard_Integer aNumberOfColorComponentsToParse = Min (theArgNb, theToParseAlpha ? 4 : 3);
Standard_Integer aNumberOfColorComponentsParsed = aNumberOfColorComponentsToParse;
if (parseIntegerColor (aNumberOfColorComponentsParsed, theArgVec, theColor))
{
return aNumberOfColorComponentsParsed;
}
aNumberOfColorComponentsParsed = aNumberOfColorComponentsToParse;
if (parseRealColor (aNumberOfColorComponentsParsed, theArgVec, theColor))
{
return aNumberOfColorComponentsParsed;
}
return 0;
}
return 0;
return Draw::ParseColor (theArgNb, theArgVec, theColor);
}
//=======================================================================
// function : ParseColor
// purpose :
//=======================================================================
Standard_Integer ViewerTest::ParseColor (const Standard_Integer theArgNb,
const char* const* const theArgVec,
Quantity_Color& theColor)
{
return Draw::ParseColor (theArgNb, theArgVec, theColor);
}
//=======================================================================
@@ -303,21 +125,7 @@ Standard_Integer ViewerTest::parseColor (const Standard_Integer theArgNb,
Standard_Boolean ViewerTest::ParseOnOff (Standard_CString theArg,
Standard_Boolean& theIsOn)
{
TCollection_AsciiString aFlag(theArg);
aFlag.LowerCase();
if (aFlag == "on"
|| aFlag == "1")
{
theIsOn = Standard_True;
return Standard_True;
}
else if (aFlag == "off"
|| aFlag == "0")
{
theIsOn = Standard_False;
return Standard_True;
}
return Standard_False;
return Draw::ParseOnOff (theArg, theIsOn);
}
//=======================================================================
@@ -2483,7 +2291,7 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
aNames.Value (aNames.Upper() - 0).ToCString(),
};
Standard_Integer aNbParsed = ViewerTest::ParseColor (3, anArgVec, aChangeSet->Color);
Standard_Integer aNbParsed = Draw::ParseColor (3, anArgVec, aChangeSet->Color);
isOk = aNbParsed == 3;
aNames.Remove (aNames.Length());
aNames.Remove (aNames.Length());
@@ -2805,9 +2613,9 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
|| anArg == "-boundarycolor")
{
Quantity_Color aColor;
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aColor);
Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aColor);
if (aNbParsed == 0)
{
Message::SendFail() << "Syntax error at '" << anArg << "'";
@@ -3049,7 +2857,7 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
|| anArg == "-fb")
{
bool toEnable = true;
if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
if (!Draw::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
{
Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
@@ -3081,9 +2889,9 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
|| anArg == "-setfbcolor"
|| anArg == "-fbcolor")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aChangeSet->FreeBoundaryColor);
Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aChangeSet->FreeBoundaryColor);
if (aNbParsed == 0)
{
Message::SendFail() << "Syntax error at '" << anArg << "'";
@@ -3104,7 +2912,7 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
|| anArg == "-isoontriang")
{
bool toEnable = true;
if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
if (!Draw::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
{
Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
@@ -3129,7 +2937,7 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
|| anArg == "-faceedges")
{
bool toEnable = true;
if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
if (!Draw::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
{
Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
@@ -3307,7 +3115,7 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
{
bool toDrawOutline = true;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toDrawOutline))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toDrawOutline))
{
++anArgIter;
}
@@ -3321,7 +3129,7 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
{
bool toDrawEdges = true;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toDrawEdges))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toDrawEdges))
{
++anArgIter;
}
@@ -3334,7 +3142,7 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
{
bool isQuadMode = true;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], isQuadMode))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], isQuadMode))
{
++anArgIter;
}
@@ -3345,9 +3153,9 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
|| anArg == "-edgecolor"
|| anArg == "-edgescolor")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aChangeSet->EdgeColor);
Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aChangeSet->EdgeColor);
if (aNbParsed == 0)
{
Message::SendFail() << "Syntax error at '" << anArg << "'";
@@ -3421,7 +3229,7 @@ static Standard_Integer VAspects (Draw_Interpretor& theDI,
else if (anArg == "-dumpcompact")
{
toCompactDump = Standard_False;
if (++anArgIter >= theArgNb && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toCompactDump))
if (++anArgIter >= theArgNb && Draw::ParseOnOff (theArgVec[anArgIter + 1], toCompactDump))
++anArgIter;
}
else if (anArg == "-dumpdepth")
@@ -4467,7 +4275,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
{
bool toModulateBool = true;
if (anArgIter + 1 < theArgsNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toModulateBool))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toModulateBool))
{
++anArgIter;
}

View File

@@ -148,35 +148,6 @@ public:
Standard_EXPORT static void RemoveSelected();
Standard_EXPORT static Quantity_NameOfColor GetColorFromName (const Standard_CString name);
//! 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.
static Standard_Integer ParseColor (const Standard_Integer theArgNb,
const char* const* const theArgVec,
Quantity_ColorRGBA& theColor)
{
return parseColor (theArgNb, theArgVec, theColor, true);
}
//! Parses RGB color argument(s).
//! Returns number of handled arguments (1 or 3) or 0 on syntax error.
static Standard_Integer ParseColor (const Standard_Integer theArgNb,
const char* const* const theArgVec,
Quantity_Color& theColor)
{
Quantity_ColorRGBA anRgba;
const Standard_Integer aNbParsed = parseColor (theArgNb, theArgVec, anRgba, false);
if (aNbParsed != 0)
{
theColor = anRgba.GetRGB();
}
return aNbParsed;
}
//! redraws all defined views.
Standard_EXPORT static void RedrawAllViews();
@@ -187,11 +158,6 @@ public:
TCollection_AsciiString& theName,
TCollection_AsciiString& theValue);
//! Parses boolean argument.
//! Handles either flag specified by 0|1 or on|off.
Standard_EXPORT static Standard_Boolean ParseOnOff (Standard_CString theArg,
Standard_Boolean& theIsOn);
//! Returns list of selected shapes.
Standard_EXPORT static void GetSelectedShapes (TopTools_ListOfShape& theShapes);
@@ -241,17 +207,31 @@ public:
return parseZLayer (theArg, true, theLayer);
}
private:
public: //! @name deprecated methods
//! 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.
Standard_EXPORT static Standard_Integer parseColor (Standard_Integer theArgNb,
const char* const* theArgVec,
Quantity_ColorRGBA& theColor,
bool theToParseAlpha);
Standard_DEPRECATED("Method has been moved to Draw::ParseColor()")
Standard_EXPORT static Standard_Integer ParseColor (const Standard_Integer theArgNb,
const char* const* const theArgVec,
Quantity_ColorRGBA& theColor);
//! Parses RGB color argument(s).
//! Returns number of handled arguments (1 or 3) or 0 on syntax error.
Standard_DEPRECATED("Method has been moved to Draw::ParseColor()")
Standard_EXPORT static Standard_Integer ParseColor (const Standard_Integer theArgNb,
const char* const* const theArgVec,
Quantity_Color& theColor);
//! Parses boolean argument.
//! Handles either flag specified by 0|1 or on|off.
Standard_DEPRECATED("Method has been moved to Draw::ParseOnOff()")
Standard_EXPORT static Standard_Boolean ParseOnOff (Standard_CString theArg,
Standard_Boolean& theIsOn);
Standard_DEPRECATED("Method has been moved to Quantity_Color::ColorFromName()")
Standard_EXPORT static Quantity_NameOfColor GetColorFromName (const Standard_CString name);
private:
//! Parses ZLayer name.
//! @param theArg [in] layer name, enumeration alias or index (of existing Layer)

View File

@@ -507,9 +507,9 @@ bool ViewerTest_CmdParser::ArgColor (const ViewerTest_CommandOptionKey theOption
false);
const Standard_Integer aNumberOfAvailableArguments = aNumberOfArguments - theArgumentIndex;
TheColor aColor;
const Standard_Integer aNumberOfParsedArguments = ViewerTest::ParseColor (aNumberOfAvailableArguments,
&aRawStringArguments[theArgumentIndex],
aColor);
const Standard_Integer aNumberOfParsedArguments = Draw::ParseColor (aNumberOfAvailableArguments,
&aRawStringArguments[theArgumentIndex],
aColor);
if (aNumberOfParsedArguments == 0)
{
return false;

View File

@@ -170,7 +170,7 @@ namespace
theColorValues->Size() >= 2 ? theColorValues->Value (2).ToCString() : "",
theColorValues->Size() >= 3 ? theColorValues->Value (3).ToCString() : ""
};
return ViewerTest::ParseColor (theColorValues->Size(), anArgs, theColor) != 0;
return Draw::ParseColor (theColorValues->Size(), anArgs, theColor) != 0;
}
static bool convertToDatumPart (const TCollection_AsciiString& theValue,
@@ -354,7 +354,7 @@ namespace
Standard_Boolean toHideLabels = Standard_True;
if (aValues->Size() == 1)
{
ViewerTest::ParseOnOff (aValues->First().ToCString(), toHideLabels);
Draw::ParseOnOff (aValues->First().ToCString(), toHideLabels);
}
else if (aValues->Size() != 0)
{
@@ -374,7 +374,7 @@ namespace
Standard_Boolean toHideArrows = Standard_True;
if (aValues->Size() == 1)
{
ViewerTest::ParseOnOff (aValues->First().ToCString(), toHideArrows);
Draw::ParseOnOff (aValues->First().ToCString(), toHideArrows);
}
else if (aValues->Size() != 0)
{
@@ -2416,9 +2416,9 @@ static int VDrawText (Draw_Interpretor& theDI,
else if (aParam == "-color")
{
Quantity_Color aColor;
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgsNb - anArgIt - 1,
theArgVec + anArgIt + 1,
aColor);
Standard_Integer aNbParsed = Draw::ParseColor (theArgsNb - anArgIt - 1,
theArgVec + anArgIt + 1,
aColor);
if (aNbParsed == 0)
{
Message::SendFail() << "Syntax error at '" << aParam << "'";
@@ -2610,9 +2610,9 @@ static int VDrawText (Draw_Interpretor& theDI,
|| aParam == "-subtitlecolor")
{
Quantity_Color aColor;
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgsNb - anArgIt - 1,
theArgVec + anArgIt + 1,
aColor);
Standard_Integer aNbParsed = Draw::ParseColor (theArgsNb - anArgIt - 1,
theArgVec + anArgIt + 1,
aColor);
if (aNbParsed == 0)
{
Message::SendFail() << "Syntax error at '" << aParam << "'";
@@ -3124,7 +3124,7 @@ static int VComputeHLR (Draw_Interpretor& ,
{
toShowHiddenEdges = true;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toShowHiddenEdges))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toShowHiddenEdges))
{
++anArgIter;
}
@@ -3135,7 +3135,7 @@ static int VComputeHLR (Draw_Interpretor& ,
{
toShowCNEdges = true;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toShowCNEdges))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toShowCNEdges))
{
++anArgIter;
}
@@ -4320,13 +4320,17 @@ static Standard_Integer VConnect (Draw_Interpretor& /*di*/,
const TCollection_AsciiString aName (argv[anArgIter++]);
Handle(AIS_MultipleConnectedInteractive) aMultiConObject;
TCollection_AsciiString aColorString (argv[argc-1]);
Standard_CString aColorName = "";
Quantity_Color aColor;
Standard_Boolean hasColor = Standard_False;
if (aColorString.Search ("color=") != -1)
{
hasColor = Standard_True;
aColorString.Remove (1, 6);
aColorName = aColorString.ToCString();
if (!Quantity_Color::ColorFromName (aColorString.ToCString(), aColor))
{
Message::SendFail() << "Syntax error at " << aColorString;
return 1;
}
}
const Standard_Integer aNbShapes = hasColor ? (argc - 1) : argc;
@@ -4355,7 +4359,7 @@ static Standard_Integer VConnect (Draw_Interpretor& /*di*/,
anObject = aConnectedOrig;
aContext->Load (anObject);
anObject->SetColor (ViewerTest::GetColorFromName (aColorName));
anObject->SetColor (aColor);
}
if (aMultiConObject.IsNull())
@@ -4718,7 +4722,7 @@ static Standard_Integer VChild (Draw_Interpretor& ,
{
bool aVal = true;
if (anArgIter + 1 < theNbArgs
&& ViewerTest::ParseOnOff(theArgVec[anArgIter + 1], aVal))
&& Draw::ParseOnOff(theArgVec[anArgIter + 1], aVal))
{
++anArgIter;
}
@@ -4863,7 +4867,7 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
}
}
if (anObjNames.Size() < 2
|| !ViewerTest::ParseOnOff (anObjNames.Last().ToCString(), toTurnOn))
|| !Draw::ParseOnOff (anObjNames.Last().ToCString(), toTurnOn))
{
Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
@@ -5504,7 +5508,7 @@ static int TextToBRep (Draw_Interpretor& /*theDI*/,
return 1;
}
ViewerTest::ParseOnOff (theArgVec[anArgIt], anIsCompositeCurve);
Draw::ParseOnOff (theArgVec[anArgIt], anIsCompositeCurve);
}
else if (aParam == "-plane")
{
@@ -5743,7 +5747,7 @@ static int VFont (Draw_Interpretor& theDI,
{
bool toEnable = true;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
{
++anArgIter;
}
@@ -5755,7 +5759,7 @@ static int VFont (Draw_Interpretor& theDI,
{
bool toEnable = true;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
{
++anArgIter;
}
@@ -6341,7 +6345,7 @@ static int VNormals (Draw_Interpretor& theDI,
TCollection_AsciiString aParam (theArgs[anArgIter]);
aParam.LowerCase();
if (anArgIter == 2
&& ViewerTest::ParseOnOff (aParam.ToCString(), isOn))
&& Draw::ParseOnOff (aParam.ToCString(), isOn))
{
continue;
}
@@ -6366,7 +6370,7 @@ static int VNormals (Draw_Interpretor& theDI,
{
isOriented = Standard_True;
if (anArgIter + 1 < theArgNum
&& ViewerTest::ParseOnOff (theArgs[anArgIter + 1], isOriented))
&& Draw::ParseOnOff (theArgs[anArgIter + 1], isOriented))
{
++anArgIter;
}

View File

@@ -399,7 +399,17 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
}
else if (aParam.IsEqual ("-color"))
{
theAspect->SetCommonColor (Quantity_Color (ViewerTest::GetColorFromName (theArgVec[++anIt])));
Quantity_Color aColor;
Standard_Integer aNbParsed = Draw::ParseColor (theArgNum - anIt - 1,
theArgVec + anIt + 1,
aColor);
anIt += aNbParsed;
if (aNbParsed == 0)
{
Message::SendFail() << "Error: wrong syntax at '" << aParam << "'";
return 1;
}
theAspect->SetCommonColor (aColor);
}
else if (aParam.IsEqual ("-extension"))
{

View File

@@ -1964,7 +1964,7 @@ static int VInit (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const cha
{
ViewerTest_EventManager::ToExitOnCloseView() = true;
if (anArgIt + 1 < theArgsNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIt + 1], ViewerTest_EventManager::ToExitOnCloseView()))
&& Draw::ParseOnOff (theArgVec[anArgIt + 1], ViewerTest_EventManager::ToExitOnCloseView()))
{
++anArgIt;
}
@@ -1974,7 +1974,7 @@ static int VInit (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const cha
{
ViewerTest_EventManager::ToCloseViewOnEscape() = true;
if (anArgIt + 1 < theArgsNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIt + 1], ViewerTest_EventManager::ToCloseViewOnEscape()))
&& Draw::ParseOnOff (theArgVec[anArgIt + 1], ViewerTest_EventManager::ToCloseViewOnEscape()))
{
++anArgIt;
}
@@ -1985,7 +1985,7 @@ static int VInit (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const cha
{
bool toEnable = true;
if (anArgIt + 1 < theArgsNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIt + 1], toEnable))
&& Draw::ParseOnOff (theArgVec[anArgIt + 1], toEnable))
{
++anArgIt;
}
@@ -2138,7 +2138,7 @@ static int VHLR (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
}
else if (anArg == "-showhidden"
&& anArgIter + 1 < argc
&& ViewerTest::ParseOnOff (argv[anArgIter + 1], toShowHidden))
&& Draw::ParseOnOff (argv[anArgIter + 1], toShowHidden))
{
++anArgIter;
hasShowHiddenArg = Standard_True;
@@ -2154,14 +2154,14 @@ static int VHLR (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
continue;
}
else if (!hasHlrOnArg
&& ViewerTest::ParseOnOff (argv[anArgIter], isHLROn))
&& Draw::ParseOnOff (argv[anArgIter], isHLROn))
{
hasHlrOnArg = Standard_True;
continue;
}
// old syntax
else if (!hasShowHiddenArg
&& ViewerTest::ParseOnOff(argv[anArgIter], toShowHidden))
&& Draw::ParseOnOff(argv[anArgIter], toShowHidden))
{
hasShowHiddenArg = Standard_True;
continue;
@@ -3832,7 +3832,7 @@ static int VRepaint (Draw_Interpretor& , Standard_Integer theArgNb, const char**
{
isImmediateUpdate = Standard_True;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], isImmediateUpdate))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], isImmediateUpdate))
{
++anArgIter;
}
@@ -4133,9 +4133,9 @@ static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/,
else if (aFlag == "-colorlabel"
|| aFlag == "-colorlabels")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aLabelsColor);
Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aLabelsColor);
if (aNbParsed == 0)
{
Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
@@ -4145,9 +4145,9 @@ static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/,
}
else if (aFlag == "-colorarrowx")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorX);
Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorX);
if (aNbParsed == 0)
{
Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
@@ -4157,9 +4157,9 @@ static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/,
}
else if (aFlag == "-colorarrowy")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorY);
Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorY);
if (aNbParsed == 0)
{
Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
@@ -4169,9 +4169,9 @@ static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/,
}
else if (aFlag == "-colorarrowz")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorZ);
Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1,
theArgVec + anArgIter + 1,
anArrowColorZ);
if (aNbParsed == 0)
{
Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
@@ -4512,7 +4512,7 @@ static int VColorScale (Draw_Interpretor& theDI,
}
Standard_Boolean IsLog;
if (!ViewerTest::ParseOnOff(theArgVec[++anArgIter], IsLog))
if (!Draw::ParseOnOff(theArgVec[++anArgIter], IsLog))
{
Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
@@ -4535,13 +4535,13 @@ static int VColorScale (Draw_Interpretor& theDI,
else if (aFlag == "-colorrange")
{
Quantity_Color aColorMin, aColorMax;
Standard_Integer aNbParsed1 = ViewerTest::ParseColor (theArgNb - (anArgIter + 1),
theArgVec + (anArgIter + 1),
aColorMin);
Standard_Integer aNbParsed1 = Draw::ParseColor (theArgNb - (anArgIter + 1),
theArgVec + (anArgIter + 1),
aColorMin);
anArgIter += aNbParsed1;
Standard_Integer aNbParsed2 = ViewerTest::ParseColor (theArgNb - (anArgIter + 1),
theArgVec + (anArgIter + 1),
aColorMax);
Standard_Integer aNbParsed2 = Draw::ParseColor (theArgNb - (anArgIter + 1),
theArgVec + (anArgIter + 1),
aColorMax);
anArgIter += aNbParsed2;
if (aNbParsed1 == 0
|| aNbParsed2 == 0)
@@ -4559,7 +4559,7 @@ static int VColorScale (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff(theArgVec[anArgIter + 1], toEnable))
&& Draw::ParseOnOff(theArgVec[anArgIter + 1], toEnable))
{
++anArgIter;
}
@@ -4570,7 +4570,7 @@ static int VColorScale (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
{
++anArgIter;
}
@@ -4657,9 +4657,9 @@ static int VColorScale (Draw_Interpretor& theDI,
}
Quantity_Color aColor;
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - (anArgIter + 1),
theArgVec + (anArgIter + 1),
aColor);
Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - (anArgIter + 1),
theArgVec + (anArgIter + 1),
aColor);
if (aNbParsed == 0)
{
Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
@@ -4727,7 +4727,7 @@ static int VColorScale (Draw_Interpretor& theDI,
toEnable = (aLabAtBorder == 1);
}
else if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
{
++anArgIter;
}
@@ -4742,9 +4742,9 @@ static int VColorScale (Draw_Interpretor& theDI,
for (;;)
{
Quantity_Color aColor;
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - (anArgIter + 1),
theArgVec + (anArgIter + 1),
aColor);
Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - (anArgIter + 1),
theArgVec + (anArgIter + 1),
aColor);
if (aNbParsed == 0)
{
break;
@@ -6551,7 +6551,7 @@ static int VGlDebug (Draw_Interpretor& theDI,
{
Standard_Boolean toShowWarns = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toShowWarns))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toShowWarns))
{
--anArgIter;
}
@@ -6567,7 +6567,7 @@ static int VGlDebug (Draw_Interpretor& theDI,
{
Standard_Boolean toShow = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toShow))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toShow))
{
--anArgIter;
}
@@ -6583,7 +6583,7 @@ static int VGlDebug (Draw_Interpretor& theDI,
{
Standard_Boolean toSuppress = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toSuppress))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toSuppress))
{
--anArgIter;
}
@@ -6597,7 +6597,7 @@ static int VGlDebug (Draw_Interpretor& theDI,
{
Standard_Boolean toSync = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toSync))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toSync))
{
--anArgIter;
}
@@ -6625,13 +6625,13 @@ static int VGlDebug (Draw_Interpretor& theDI,
else if (anArgCase == "-debug")
{
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnableDebug))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnableDebug))
{
--anArgIter;
}
aDefCaps->contextDebug = toEnableDebug;
}
else if (ViewerTest::ParseOnOff (anArg, toEnableDebug)
else if (Draw::ParseOnOff (anArg, toEnableDebug)
&& (anArgIter + 1 == theArgNb))
{
// simple alias to turn on almost everything
@@ -6758,7 +6758,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6768,7 +6768,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6778,7 +6778,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6788,7 +6788,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6798,7 +6798,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6808,7 +6808,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6819,7 +6819,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6829,7 +6829,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6843,7 +6843,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6854,7 +6854,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6867,7 +6867,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6882,7 +6882,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6897,7 +6897,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -6909,7 +6909,7 @@ static int VCaps (Draw_Interpretor& theDI,
{
Standard_Boolean toDisable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toDisable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toDisable))
{
--anArgIter;
}
@@ -7328,7 +7328,7 @@ static int VDiffImage (Draw_Interpretor& theDI, Standard_Integer theArgNb, const
{
Standard_Boolean toEnable = Standard_True;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
{
++anArgIter;
}
@@ -7338,7 +7338,7 @@ static int VDiffImage (Draw_Interpretor& theDI, Standard_Integer theArgNb, const
{
Standard_Boolean toEnable = Standard_True;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
{
++anArgIter;
}
@@ -7348,7 +7348,7 @@ static int VDiffImage (Draw_Interpretor& theDI, Standard_Integer theArgNb, const
{
ViewerTest_EventManager::ToExitOnCloseView() = true;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], ViewerTest_EventManager::ToExitOnCloseView()))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], ViewerTest_EventManager::ToExitOnCloseView()))
{
++anArgIter;
}
@@ -7358,7 +7358,7 @@ static int VDiffImage (Draw_Interpretor& theDI, Standard_Integer theArgNb, const
{
ViewerTest_EventManager::ToCloseViewOnEscape() = true;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], ViewerTest_EventManager::ToCloseViewOnEscape()))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], ViewerTest_EventManager::ToCloseViewOnEscape()))
{
++anArgIter;
}
@@ -7555,7 +7555,7 @@ static Standard_Integer VSelect (Draw_Interpretor& ,
{
toAllowOverlap = true;
if (anArgIter + 1 < theNbArgs
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toAllowOverlap))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toAllowOverlap))
{
++anArgIter;
}
@@ -8115,12 +8115,12 @@ static Standard_Integer V2DMode (Draw_Interpretor&, Standard_Integer theArgsNb,
else if (anArgCase == "-mode")
{
if (anArgIt + 1 < theArgsNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIt + 1], is2dMode))
&& Draw::ParseOnOff (theArgVec[anArgIt + 1], is2dMode))
{
++anArgIt;
}
}
else if (ViewerTest::ParseOnOff (theArgVec[anArgIt], is2dMode))
else if (Draw::ParseOnOff (theArgVec[anArgIt], is2dMode))
{
//
}
@@ -9418,7 +9418,7 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
aChangeArg.LowerCase();
Standard_Boolean toEnable = Standard_True;
if (ViewerTest::ParseOnOff (aChangeArgs[0], toEnable))
if (Draw::ParseOnOff (aChangeArgs[0], toEnable))
{
aClipPlane->SetOn (toEnable);
}
@@ -9508,7 +9508,7 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
return 1;
}
if (ViewerTest::ParseOnOff (aChangeArgs[1], toEnable))
if (Draw::ParseOnOff (aChangeArgs[1], toEnable))
{
aClipPlane->SetCapping (toEnable);
anArgIter += 1;
@@ -9529,7 +9529,7 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
return 1;
}
if (ViewerTest::ParseOnOff (aChangeArgs[1], toEnable))
if (Draw::ParseOnOff (aChangeArgs[1], toEnable))
{
aClipPlane->SetUseObjectMaterial (toEnable == Standard_True);
anArgIter += 1;
@@ -9546,7 +9546,7 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
return 1;
}
if (ViewerTest::ParseOnOff (aChangeArgs[1], toEnable))
if (Draw::ParseOnOff (aChangeArgs[1], toEnable))
{
aClipPlane->SetUseObjectTexture (toEnable == Standard_True);
anArgIter += 1;
@@ -9561,7 +9561,7 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
return 1;
}
if (ViewerTest::ParseOnOff (aChangeArgs[1], toEnable))
if (Draw::ParseOnOff (aChangeArgs[1], toEnable))
{
aClipPlane->SetUseObjectShader (toEnable == Standard_True);
anArgIter += 1;
@@ -9571,9 +9571,9 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
|| aChangeArg == "color")
{
Quantity_Color aColor;
Standard_Integer aNbParsed = ViewerTest::ParseColor (aNbChangeArgs - 1,
aChangeArgs + 1,
aColor);
Standard_Integer aNbParsed = Draw::ParseColor (aNbChangeArgs - 1,
aChangeArgs + 1,
aColor);
if (aNbParsed == 0)
{
Message::SendFail ("Syntax error: need more arguments");
@@ -10124,7 +10124,7 @@ static int VCamera (Draw_Interpretor& theDI,
{
bool toLockUp = true;
if (++anArgIter < theArgsNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toLockUp))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toLockUp))
{
--anArgIter;
}
@@ -10453,7 +10453,7 @@ static int VStereo (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -10464,7 +10464,7 @@ static int VStereo (Draw_Interpretor& theDI,
{
Standard_Boolean toDisable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toDisable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toDisable))
{
--anArgIter;
}
@@ -10522,7 +10522,7 @@ static int VStereo (Draw_Interpretor& theDI,
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -10636,7 +10636,7 @@ static int VDefaults (Draw_Interpretor& theDi,
++anArgIter;
bool toTurnOn = true;
if (anArgIter >= theArgsNb
|| !ViewerTest::ParseOnOff (theArgVec[anArgIter], toTurnOn))
|| !Draw::ParseOnOff (theArgVec[anArgIter], toTurnOn))
{
Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
@@ -11062,16 +11062,17 @@ static int VLight (Draw_Interpretor& theDi,
|| anArgCase.IsEqual ("-COLOR")
|| anArgCase.IsEqual ("-COLOUR"))
{
if (++anArgIt >= theArgsNb
Quantity_Color aColor;
Standard_Integer aNbParsed = Draw::ParseColor (theArgsNb - anArgIt - 1,
theArgVec + anArgIt + 1,
aColor);
anArgIt += aNbParsed;
if (aNbParsed == 0
|| aLightCurr.IsNull())
{
Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
TCollection_AsciiString anArgNext (theArgVec[anArgIt]);
anArgNext.UpperCase();
const Quantity_Color aColor = ViewerTest::GetColorFromName (anArgNext.ToCString());
aLightCurr->SetColor (aColor);
}
else if (anArgCase.IsEqual ("POS")
@@ -11264,7 +11265,7 @@ static int VLight (Draw_Interpretor& theDi,
Standard_Boolean isHeadLight = Standard_True;
if (anArgIt + 1 < theArgsNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIt + 1], isHeadLight))
&& Draw::ParseOnOff (theArgVec[anArgIt + 1], isHeadLight))
{
++anArgIt;
}
@@ -11671,7 +11672,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
bool isRayTrace = true;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], isRayTrace))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], isRayTrace))
{
++anArgIter;
}
@@ -11689,7 +11690,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
bool isRaster = true;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], isRaster))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], isRaster))
{
++anArgIter;
}
@@ -11796,7 +11797,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
}
aParams.ToEnableDepthPrepass = Standard_True;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], aParams.ToEnableDepthPrepass))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], aParams.ToEnableDepthPrepass))
{
++anArgIter;
}
@@ -11811,7 +11812,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
}
aParams.ToEnableAlphaToCoverage = Standard_True;
if (anArgIter + 1 < theArgNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], aParams.ToEnableAlphaToCoverage))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], aParams.ToEnableAlphaToCoverage))
{
++anArgIter;
}
@@ -11880,7 +11881,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -11897,7 +11898,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -11913,7 +11914,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -11929,7 +11930,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -11945,7 +11946,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -11966,7 +11967,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -12013,7 +12014,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -12029,7 +12030,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -12045,7 +12046,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -12109,7 +12110,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -12125,7 +12126,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -12141,7 +12142,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -12304,7 +12305,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
&& !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
@@ -12493,7 +12494,7 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
TCollection_AsciiString aStateStr(theArgVec[anArgIter]);
aStateStr.LowerCase();
bool toEnable = true;
if (ViewerTest::ParseOnOff (aStateStr.ToCString(), toEnable))
if (Draw::ParseOnOff (aStateStr.ToCString(), toEnable))
{
aState = toEnable ? Graphic3d_RenderingParams::FrustumCulling_On : Graphic3d_RenderingParams::FrustumCulling_Off;
}
@@ -13154,7 +13155,7 @@ static int VSelectionProperties (Draw_Interpretor& theDi,
return 0;
}
else if (theArgsNb != 2
|| !ViewerTest::ParseOnOff (theArgVec[1], toEnable))
|| !Draw::ParseOnOff (theArgVec[1], toEnable))
{
Message::SendFail ("Syntax error: wrong number of parameters");
return 1;
@@ -13226,7 +13227,7 @@ static int VSelectionProperties (Draw_Interpretor& theDi,
{
Standard_Boolean toEnable = Standard_True;
if (anArgIter + 1 < theArgsNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
{
++anArgIter;
}
@@ -13239,7 +13240,7 @@ static int VSelectionProperties (Draw_Interpretor& theDi,
{
Standard_Boolean toEnable = Standard_True;
if (anArgIter + 1 < theArgsNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
{
++anArgIter;
}
@@ -13253,7 +13254,7 @@ static int VSelectionProperties (Draw_Interpretor& theDi,
{
Standard_Boolean toEnable = Standard_True;
if (anArgIter + 1 < theArgsNb
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toEnable))
{
++anArgIter;
}
@@ -13352,9 +13353,9 @@ static int VSelectionProperties (Draw_Interpretor& theDi,
}
Quantity_Color aColor;
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgsNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aColor);
Standard_Integer aNbParsed = Draw::ParseColor (theArgsNb - anArgIter - 1,
theArgVec + anArgIter + 1,
aColor);
if (aNbParsed == 0)
{
Message::SendFail ("Syntax error: need more arguments");
@@ -13695,9 +13696,9 @@ static int VViewCube (Draw_Interpretor& ,
|| anArg == "-innercolor"
|| anArg == "-textcolor")
{
Standard_Integer aNbParsed = ViewerTest::ParseColor (theNbArgs - anArgIter - 1,
theArgVec + anArgIter + 1,
aColorRgb);
Standard_Integer aNbParsed = Draw::ParseColor (theNbArgs - anArgIter - 1,
theArgVec + anArgIter + 1,
aColorRgb);
if (aNbParsed == 0)
{
Message::SendFail() << "Syntax error at '" << anArg << "'";
@@ -13767,7 +13768,7 @@ static int VViewCube (Draw_Interpretor& ,
{
bool toShow = true;
if (anArgIter + 1 < theNbArgs
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toShow))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], toShow))
{
++anArgIter;
}
@@ -13793,7 +13794,7 @@ static int VViewCube (Draw_Interpretor& ,
{
bool isOn = true;
if (anArgIter + 1 < theNbArgs
&& ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], isOn))
&& Draw::ParseOnOff (theArgVec[anArgIter + 1], isOn))
{
++anArgIter;
}