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

0031189: Draw Harness, ViewerTest - send messages to Message::DefaultMessenger()

Added short-cuts methods in Message_Messenger for sending message with specified gravity,
and stream buffer class for using stream-like interface for that.
Similar short-cuts to DefaultMessenger() are added in Message package.

ViewerTest has been updated to send messages to Message::DefaultMessenger()
instead of direct output to std::cout/std::cerr.

Off-topic: spelling error (duplicate "and") is corrected in two places

Added test bugs fclasses bug31189
This commit is contained in:
kgv
2019-11-24 15:02:39 +03:00
committed by bugmaster
parent 331bcfc0d0
commit 23fe70ec52
13 changed files with 1125 additions and 968 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -16,6 +16,7 @@
#include <ViewerTest_CmdParser.hxx>
#include <Draw.hxx>
#include <Message.hxx>
#include <ViewerTest.hxx>
#include <algorithm>
@@ -157,7 +158,7 @@ void ViewerTest_CmdParser::Parse (const Standard_Integer theArgsNb, const char*
}
else
{
std::cerr << "Error: unknown argument '" << anOptionName << "'\n";
Message::SendFail() << "Error: unknown argument '" << anOptionName << "'";
return;
}
}
@@ -261,9 +262,9 @@ bool ViewerTest_CmdParser::HasOption (const ViewerTest_CommandOptionKey theOptio
const bool aResult = (anOptionArguments.size() >= theMandatoryArgsNb);
if (isFatal && !aResult)
{
std::cerr << "Error: wrong syntax at option '" << myOptionStorage[theOptionKey].Name << "'\n"
<< "At least " << theMandatoryArgsNb << "expected, but only " << anOptionArguments.size()
<< "provided.\n";
Message::SendFail() << "Error: wrong syntax at option '" << myOptionStorage[theOptionKey].Name << "'\n"
<< "At least " << theMandatoryArgsNb << "expected, but only " << anOptionArguments.size()
<< "provided.";
}
return aResult;
}

File diff suppressed because it is too large Load Diff

View File

@@ -186,27 +186,27 @@ void VUserDrawObj::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
} // end of anonymous namespace
static Standard_Integer VUserDraw (Draw_Interpretor& di,
static Standard_Integer VUserDraw (Draw_Interpretor& ,
Standard_Integer argc,
const char ** argv)
{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
di << argv[0] << "Call 'vinit' before!\n";
Message::SendFail ("Error: no active viewer");
return 1;
}
Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aContext->CurrentViewer()->Driver());
if (aDriver.IsNull())
{
std::cerr << "Graphic driver not available.\n";
Message::SendFail ("Error: Graphic driver not available.");
return 1;
}
if (argc > 2)
{
di << argv[0] << "Wrong number of arguments, only the object name expected\n";
Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
@@ -233,7 +233,7 @@ static int VFeedback (Draw_Interpretor& theDI,
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
std::cerr << "No active view. Please call vinit.\n";
Message::SendFail ("Error: no active viewer");
return 1;
}
@@ -244,9 +244,9 @@ static int VFeedback (Draw_Interpretor& theDI,
if (aBytes / sizeof(GLfloat) != (size_t )aBufferSize)
{
// finito la commedia
std::cerr << "Can not allocate buffer - requested size ("
<< (double(aBufferSize / (1024 * 1024)) * double(sizeof(GLfloat)))
<< " MiB) is out of address space\n";
Message::SendFail() << "Can not allocate buffer - requested size ("
<< (double(aBufferSize / (1024 * 1024)) * double(sizeof(GLfloat)))
<< " MiB) is out of address space";
return 1;
}
@@ -254,9 +254,9 @@ static int VFeedback (Draw_Interpretor& theDI,
if (aBuffer == NULL)
{
// finito la commedia
std::cerr << "Can not allocate buffer with size ("
<< (double(aBufferSize / (1024 * 1024)) * double(sizeof(GLfloat)))
<< " MiB)\n";
Message::SendFail() << "Can not allocate buffer with size ("
<< (double(aBufferSize / (1024 * 1024)) * double(sizeof(GLfloat)))
<< " MiB)";
return 1;
}
@@ -390,21 +390,20 @@ static int VImmediateFront (Draw_Interpretor& /*theDI*/,
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
std::cerr << "No active view. Please call vinit.\n";
Message::SendFail ("Error: no active viewer");
return 1;
}
Handle(Graphic3d_GraphicDriver) aDriver = aContextAIS->CurrentViewer()->Driver();
if (aDriver.IsNull())
{
std::cerr << "Graphic driver not available.\n";
Message::SendFail ("Error: graphic driver not available.");
return 1;
}
if (theArgNb < 2)
{
std::cerr << "Wrong number of arguments.\n";
Message::SendFail ("Syntax error: wrong number of arguments.");
return 1;
}
@@ -440,7 +439,7 @@ static int VGlInfo (Draw_Interpretor& theDI,
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
std::cerr << "No active view. Please call vinit.\n";
Message::SendFail ("No active viewer");
return 1;
}
@@ -517,7 +516,7 @@ static int VGlInfo (Draw_Interpretor& theDI,
}
else
{
std::cerr << "Unknown key '" << aName.ToCString() << "'\n";
Message::SendFail() << "Syntax error: unknown key '" << aName.ToCString() << "'";
return 1;
}
@@ -590,12 +589,12 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
std::cout << "Error: no active view.\n";
Message::SendFail ("Error: no active viewer");
return 1;
}
else if (theArgNb < 2)
{
std::cout << "Syntax error: lack of arguments\n";
Message::SendFail ("Syntax error: lack of arguments");
return 1;
}
@@ -631,7 +630,7 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
}
if (aGlCtx.IsNull())
{
std::cout << "Error: no OpenGl_Context\n";
Message::SendFail ("Error: no OpenGl_Context");
return 1;
}
@@ -651,7 +650,7 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
Handle(OpenGl_ShaderProgram) aResProg;
if (!aGlCtx->GetResource (aShaderName, aResProg))
{
std::cout << "Syntax error: shader resource '" << aShaderName << "' is not found\n";
Message::SendFail() << "Syntax error: shader resource '" << aShaderName << "' is not found";
return 1;
}
if (aResProg->UpdateDebugDump (aGlCtx, "", false, anArg == "-dump"))
@@ -661,7 +660,7 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
}
if (anArgIter + 1 < theArgNb)
{
std::cout << "Syntax error: wrong number of arguments\n";
Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
return 0;
@@ -681,8 +680,8 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
const TCollection_AsciiString& aShadersRoot = Graphic3d_ShaderProgram::ShadersFolder();
if (aShadersRoot.IsEmpty())
{
std::cout << "Error: both environment variables CSF_ShadersDirectory and CASROOT are undefined!\n"
"At least one should be defined to load Phong program.\n";
Message::SendFail("Error: both environment variables CSF_ShadersDirectory and CASROOT are undefined!\n"
"At least one should be defined to load Phong program.");
return 1;
}
@@ -691,13 +690,13 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
if (!aSrcVert.IsEmpty()
&& !OSD_File (aSrcVert).Exists())
{
std::cout << "Error: PhongShading.vs is not found\n";
Message::SendFail ("Error: PhongShading.vs is not found");
return 1;
}
if (!aSrcFrag.IsEmpty()
&& !OSD_File (aSrcFrag).Exists())
{
std::cout << "Error: PhongShading.fs is not found\n";
Message::SendFail ("Error: PhongShading.fs is not found");
return 1;
}
@@ -745,7 +744,7 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
}
else
{
std::cerr << "Syntax error at '" << aPrimTypeStr << "'\n";
Message::SendFail() << "Syntax error at '" << aPrimTypeStr << "'";
return 1;
}
}
@@ -770,7 +769,7 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
Handle(AIS_InteractiveObject) anIO = GetMapOfAIS().Find2 (theArgVec[anArgIter]);
if (anIO.IsNull())
{
std::cerr << "Syntax error: " << theArgVec[anArgIter] << " is not an AIS object\n";
Message::SendFail() << "Syntax error: " << theArgVec[anArgIter] << " is not an AIS object";
return 1;
}
aPrsList.Append (anIO);
@@ -813,7 +812,7 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
}
if (aShaderType == Graphic3d_TypeOfShaderObject(-1))
{
std::cerr << "Error: non-existing or invalid shader source\n";
Message::SendFail() << "Error: non-existing or invalid shader source";
return 1;
}
@@ -821,7 +820,7 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
}
else
{
std::cerr << "Syntax error at '" << anArg << "'\n";
Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
@@ -946,7 +945,7 @@ static Standard_Integer VListMaterials (Draw_Interpretor& theDI,
}
else
{
std::cout << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
Message::SendFail() << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'";
return 1;
}
}
@@ -1000,7 +999,7 @@ static Standard_Integer VListMaterials (Draw_Interpretor& theDI,
OSD_OpenStream (aMatFile, aMatFilePath.ToCString(), std::ios::out | std::ios::binary);
if (!aMatFile.is_open())
{
std::cout << "Error: unable creating material file\n";
Message::SendFail ("Error: unable creating material file");
return 0;
}
if (!aDumpFile.EndsWith (".mtl"))
@@ -1008,7 +1007,7 @@ static Standard_Integer VListMaterials (Draw_Interpretor& theDI,
OSD_OpenStream (anObjFile, anObjFilePath.ToCString(), std::ios::out | std::ios::binary);
if (!anObjFile.is_open())
{
std::cout << "Error: unable creating OBJ file\n";
Message::SendFail ("Error: unable creating OBJ file");
return 0;
}
@@ -1023,7 +1022,7 @@ static Standard_Integer VListMaterials (Draw_Interpretor& theDI,
OSD_OpenStream (anHtmlFile, aDumpFile.ToCString(), std::ios::out | std::ios::binary);
if (!anHtmlFile.is_open())
{
std::cout << "Error: unable creating HTML file\n";
Message::SendFail ("Error: unable creating HTML file");
return 0;
}
anHtmlFile << "<html>\n"
@@ -1082,7 +1081,7 @@ static Standard_Integer VListMaterials (Draw_Interpretor& theDI,
}
else if (!aDumpFile.IsEmpty())
{
std::cout << "Syntax error: unknown output file format\n";
Message::SendFail ("Syntax error: unknown output file format");
return 1;
}
@@ -1224,7 +1223,7 @@ static Standard_Integer VListColors (Draw_Interpretor& theDI,
}
else
{
std::cout << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
Message::SendFail() << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'";
return 1;
}
}
@@ -1255,7 +1254,7 @@ static Standard_Integer VListColors (Draw_Interpretor& theDI,
}
else if (!aDumpFile.IsEmpty())
{
std::cout << "Syntax error: unknown output file format\n";
Message::SendFail ("Syntax error: unknown output file format");
return 1;
}
@@ -1285,7 +1284,7 @@ static Standard_Integer VListColors (Draw_Interpretor& theDI,
OSD_OpenStream (anHtmlFile, aDumpFile.ToCString(), std::ios::out | std::ios::binary);
if (!anHtmlFile.is_open())
{
std::cout << "Error: unable creating HTML file\n";
Message::SendFail ("Error: unable creating HTML file");
return 0;
}
anHtmlFile << "<html>\n"
@@ -1392,7 +1391,7 @@ static Standard_Integer VGenEnvLUT (Draw_Interpretor&,
{
if (anArgIter + 1 >= theArgNb)
{
std::cerr << "Syntax error: size of PBR environment look up table is undefined" << "\n";
Message::SendFail ("Syntax error: size of PBR environment look up table is undefined");
return 1;
}
@@ -1400,7 +1399,7 @@ static Standard_Integer VGenEnvLUT (Draw_Interpretor&,
if (aTableSize < 16)
{
std::cerr << "Error: size of PBR environment look up table must be greater or equal 16\n";
Message::SendFail ("Error: size of PBR environment look up table must be greater or equal 16");
return 1;
}
}
@@ -1409,7 +1408,7 @@ static Standard_Integer VGenEnvLUT (Draw_Interpretor&,
{
if (anArgIter + 1 >= theArgNb)
{
std::cerr << "Syntax error: number of samples to generate PBR environment look up table is undefined" << "\n";
Message::SendFail ("Syntax error: number of samples to generate PBR environment look up table is undefined");
return 1;
}
@@ -1417,13 +1416,13 @@ static Standard_Integer VGenEnvLUT (Draw_Interpretor&,
if (aNbSamples < 1)
{
std::cerr << "Syntax error: number of samples to generate PBR environment look up table must be greater than 1\n" << "\n";
Message::SendFail ("Syntax error: number of samples to generate PBR environment look up table must be greater than 1");
return 1;
}
}
else
{
std::cerr << "Syntax error: unknown argument " << anArg << ";\n";
Message::SendFail() << "Syntax error: unknown argument " << anArg;
return 1;
}
}
@@ -1444,7 +1443,7 @@ static Standard_Integer VGenEnvLUT (Draw_Interpretor&,
if (!aFile.good())
{
std::cerr << "Error: unable to write to " << aFilePath << "\n";
Message::SendFail() << "Error: unable to write to " << aFilePath;
return 1;
}

View File

@@ -69,6 +69,7 @@
#include <gp_Pln.hxx>
#include <IntAna_IntConicQuad.hxx>
#include <IntAna_Quadric.hxx>
#include <Message.hxx>
#include <Precision.hxx>
#include <StdSelect.hxx>
#include <TCollection_AsciiString.hxx>
@@ -251,7 +252,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
{
if (!theShapeList)
{
std::cerr << "Error: unknown parameter '" << aParam << "'\n";
Message::SendFail() << "Error: unknown parameter '" << aParam << "'";
return 1;
}
@@ -269,7 +270,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
// Before all non-boolean flags parsing check if a flag have at least one value.
if (anIt + 1 >= theArgNum)
{
std::cerr << "Error: "<< aParam <<" flag should have value.\n";
Message::SendFail() << "Error: "<< aParam <<" flag should have value.";
return 1;
}
@@ -279,7 +280,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
{
if (!theShapeList)
{
std::cerr << "Error: unknown parameter '" << aParam << "'\n";
Message::SendFail() << "Error: unknown parameter '" << aParam << "'";
return 1;
}
@@ -297,7 +298,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
else if (!GetMapOfAIS().Find2 (anArgString, anAISObject)
|| anAISObject.IsNull())
{
std::cerr << "Error: shape with name '" << aStr << "' is not found.\n";
Message::SendFail() << "Error: shape with name '" << aStr << "' is not found.";
return 1;
}
theShapeList->Append (anAISObject);
@@ -338,7 +339,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
{
if (anIt + 1 >= theArgNum)
{
std::cout << "Error: wrong number of values for parameter '" << aParam << "'.\n";
Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
@@ -361,7 +362,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
else if (aParamValue == "vcenter") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_Center);}
else
{
std::cerr << "Error: invalid label position: '" << aParamValue << "'.\n";
Message::SendFail() << "Error: invalid label position: '" << aParamValue << "'.";
return 1;
}
}
@@ -381,7 +382,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
TCollection_AsciiString aValue (theArgVec[++anIt]);
if (!aValue.IsRealValue())
{
std::cerr << "Error: arrow lenght should be float degree value.\n";
Message::SendFail() << "Error: arrow lenght should be float degree value.";
return 1;
}
theAspect->ArrowAspect()->SetLength (Draw::Atof (aValue.ToCString()));
@@ -391,7 +392,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
TCollection_AsciiString aValue (theArgVec[++anIt]);
if (!aValue.IsRealValue())
{
std::cerr << "Error: arrow angle should be float degree value.\n";
Message::SendFail ("Error: arrow angle should be float degree value.");
return 1;
}
theAspect->ArrowAspect()->SetAngle (Draw::Atof (aValue.ToCString()));
@@ -405,7 +406,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
TCollection_AsciiString aLocalParam(theArgVec[++anIt]);
if (!aLocalParam.IsRealValue())
{
std::cerr << "Error: extension size for dimension should be real value.\n";
Message::SendFail ("Error: extension size for dimension should be real value.");
return 1;
}
theAspect->SetExtensionSize (Draw::Atof (aLocalParam.ToCString()));
@@ -431,7 +432,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
}
else
{
std::cerr << "Error: wrong plane '" << aValue << "'.\n";
Message::SendFail() << "Error: wrong plane '" << aValue << "'";
return 1;
}
}
@@ -440,7 +441,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
TCollection_AsciiString aLocalParam(theArgVec[++anIt]);
if (!aLocalParam.IsRealValue())
{
std::cerr << "Error: flyout for dimension should be real value.\n";
Message::SendFail ("Error: flyout for dimension should be real value.");
return 1;
}
@@ -451,7 +452,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
TCollection_AsciiString aLocalParam(theArgVec[++anIt]);
if (!aLocalParam.IsRealValue())
{
std::cerr << "Error: dimension value for dimension should be real value.\n";
Message::SendFail ("Error: dimension value for dimension should be real value");
return 1;
}
@@ -477,7 +478,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
}
else
{
std::cerr << "Error: unknown parameter '" << aParam << "'.\n";
Message::SendFail() << "Error: unknown parameter '" << aParam << "'";
return 1;
}
}
@@ -546,14 +547,14 @@ static int ParseAngleDimensionParams (Standard_Integer theArgNum,
if (aParam.Search ("-") == -1)
{
std::cerr << "Error: wrong parameter '" << aParam << "'.\n";
Message::SendFail() << "Error: wrong parameter '" << aParam << "'.";
return 1;
}
// Before all non-boolean flags parsing check if a flag have at least one value.
if (anIt + 1 >= theArgNum)
{
std::cerr << "Error: "<< aParam <<" flag should have value.\n";
Message::SendFail() << "Error: "<< aParam <<" flag should have value.";
return 1;
}
@@ -571,7 +572,7 @@ static int ParseAngleDimensionParams (Standard_Integer theArgNum,
}
else
{
std::cerr << "Error: unknown parameter '" << aParam << "'.\n";
Message::SendFail() << "Error: unknown parameter '" << aParam << "'.";
return 1;
}
}
@@ -607,7 +608,7 @@ static void SetAngleDimensionParams (const Handle(PrsDim_Dimension)& theDim,
}
else
{
std::cerr << "Error: wrong angle type.\n";
Message::SendFail() << "Error: wrong angle type.";
}
anAngleDim->SetType(anAngleType);
}
@@ -634,7 +635,7 @@ static void SetAngleDimensionParams (const Handle(PrsDim_Dimension)& theDim,
}
else
{
std::cerr << "Error: wrong showarrow type.\n";
Message::SendFail() << "Error: wrong showarrow type.";
}
anAngleDim->SetArrowsVisibility(anArrowType);
}
@@ -651,7 +652,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
{
if (theArgsNb < 2)
{
std::cerr << "Error: wrong number of arguments.\n";
Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
@@ -687,7 +688,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
}
else
{
std::cerr << "Error: wrong type of dimension.\n";
Message::SendFail ("Error: wrong type of dimension");
return 1;
}
@@ -710,12 +711,12 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
if (aShapes.First()->Type() == AIS_KOI_Shape
&& (Handle(AIS_Shape)::DownCast(aShapes.First()))->Shape().ShapeType() != TopAbs_EDGE)
{
std::cerr << theArgs[0] << ": wrong shape type.\n";
Message::SendFail ("Error: wrong shape type");
return 1;
}
if (!isPlaneCustom)
{
std::cerr << theArgs[0] << ": can not build dimension without working plane.\n";
Message::SendFail ("Error: can not build dimension without working plane");
return 1;
}
@@ -753,7 +754,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
if (aShape1.IsNull() || aShape2.IsNull())
{
std::cerr << theArgs[0] << ": wrong shape type.\n";
Message::SendFail ("Error: wrong shape type.");
return 1;
}
@@ -774,7 +775,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
{
if (!isPlaneCustom)
{
std::cerr << theArgs[0] << ": can not build dimension without working plane.\n";
Message::SendFail ("Error: can not build dimension without working plane.");
return 1;
}
// Vertex-Vertex case
@@ -792,7 +793,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
}
else
{
std::cerr << theArgs[0] << ": wrong number of shapes to build dimension.\n";
Message::SendFail ("Error: wrong number of shapes to build dimension");
return 1;
}
@@ -816,7 +817,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
aDim = new PrsDim_AngleDimension (TopoDS::Edge(aShape1->Shape()),TopoDS::Edge(aShape2->Shape()));
else
{
std::cerr << theArgs[0] << ": wrong shapes for angle dimension.\n";
Message::SendFail ("Error: wrong shapes for angle dimension");
return 1;
}
}
@@ -841,7 +842,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
}
else
{
std::cerr << theArgs[0] << ": wrong number of shapes to build dimension.\n";
Message::SendFail ("Error: wrong number of shapes to build dimension");
return 1;
}
@@ -863,7 +864,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
}
if (aShapes.Extent() != 1)
{
std::cout << "Syntax error: wrong number of shapes to build dimension.\n";
Message::SendFail ("Syntax error: wrong number of shapes to build dimension");
return 1;
}
@@ -890,7 +891,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
}
else
{
std::cout << "Error: shape for radius has wrong type.\n";
Message::SendFail ("Error: shape for radius has wrong type");
return 1;
}
break;
@@ -910,7 +911,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (aShapes.First());
if (aShape.IsNull())
{
std::cerr << "Error: shape for radius is of wrong type.\n";
Message::SendFail ("Error: shape for radius is of wrong type");
return 1;
}
aDim = new PrsDim_DiameterDimension (aShape->Shape());
@@ -918,7 +919,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
}
else
{
std::cerr << theArgs[0] << ": wrong number of shapes to build dimension.\n";
Message::SendFail ("Error: wrong number of shapes to build dimension");
return 1;
}
@@ -926,7 +927,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
}
default:
{
std::cerr << theArgs[0] << ": wrong type of dimension. Type help for more information.\n";
Message::SendFail ("Error: wrong type of dimension. Type help for more information");
return 1;
}
}
@@ -934,8 +935,8 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
// Check dimension geometry
if (!aDim->IsValid())
{
std::cerr << theArgs[0] << ":dimension geometry is invalid, " << aDimType.ToCString()
<< " dimension can't be built on input shapes.\n";
Message::SendFail() << "Error: dimension geometry is invalid, " << aDimType
<< " dimension can't be built on input shapes.";
return 1;
}
@@ -975,7 +976,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
{
if (theArgsNb < 2)
{
std::cerr << "Error: wrong number of arguments.\n";
Message::SendFail ("Error: wrong number of arguments");
return 1;
}
@@ -1035,7 +1036,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
{
if (aShapes.Extent() != 2)
{
std::cerr << "Error: Wrong number of selected shapes.\n";
Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
@@ -1045,7 +1046,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
if (!(aShape1.ShapeType() == TopAbs_EDGE
&& aShape2.ShapeType() == TopAbs_EDGE))
{
std::cerr << "Syntax error: selected shapes are not edges.\n";
Message::SendFail ("Syntax error: selected shapes are not edges");
return 1;
}
@@ -1064,7 +1065,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
{
if (aShapes.Extent() != 4)
{
std::cerr << "Error: Wrong number of selected shapes.\n";
Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
@@ -1080,7 +1081,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
if (!IsParallel (aSelectedShapes[0], aSelectedShapes[1])
|| !IsParallel (aSelectedShapes[2], aSelectedShapes[3]))
{
std::cerr << "Syntax error: non parallel edges.\n";
Message::SendFail ("Syntax error: non parallel edges");
return 1;
}
@@ -1134,7 +1135,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
{
if (aShapes.Extent() != 2 && aShapes.Extent() != 1)
{
std::cerr << "Error: Wrong number of selected shapes.\n";
Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
@@ -1143,7 +1144,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
if (!(aShape1.ShapeType() == TopAbs_EDGE
&& aShape2.ShapeType() == TopAbs_EDGE))
{
std::cerr << "Syntax error: selected shapes are not edges.\n";
Message::SendFail ("Syntax error: selected shapes are not edges");
return 1;
}
@@ -1162,14 +1163,14 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
{
if (aShapes.Extent() != 1)
{
std::cerr << "Error: Wrong number of selected shapes.\n";
Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
const TopoDS_Shape& aShape = aShapes.First();
if (aShape.ShapeType() != TopAbs_EDGE)
{
std::cerr << "Syntax error: selected shapes are not edges.\n";
Message::SendFail ("Syntax error: selected shapes are not edges");
return 1;
}
@@ -1188,7 +1189,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
{
if (aShapes.Extent() != 2)
{
std::cerr << "Error: Wrong number of selected shapes.\n";
Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
@@ -1258,7 +1259,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
{
if (aShapes.Extent() != 2)
{
std::cerr << "Error: Wrong number of selected shapes.\n";
Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
@@ -1267,7 +1268,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
if (!(aShape1.ShapeType() == TopAbs_FACE
&& aShape2.ShapeType() == TopAbs_FACE))
{
std::cerr << "Syntax error: selected shapes are not faces.\n";
Message::SendFail ("Syntax error: selected shapes are not faces");
return 1;
}
@@ -1277,7 +1278,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
BRepExtrema_ExtFF aDelta (aFace1, aFace2);
if (!aDelta.IsParallel())
{
std::cerr << "Syntax error: the faces are not parallel.\n";
Message::SendFail ("Syntax error: the faces are not parallel");
return 1;
}
@@ -1290,7 +1291,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
{
if (aShapes.Extent() != 2)
{
std::cerr << "Error: wrong number of selected shapes.\n";
Message::SendFail ("Error: wrong number of selected shapes");
return 1;
}
@@ -1304,7 +1305,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
if (!aDeltaEdge.IsParallel())
{
std::cerr << "Error: the edges are not parallel.\n";
Message::SendFail ("Error: the edges are not parallel");
return 1;
}
@@ -1327,7 +1328,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
BRepExtrema_ExtFF aDeltaFace (aFaceA, aFaceB);
if (!aDeltaFace.IsParallel())
{
std::cerr << "Error: the faces are not parallel.\n";
Message::SendFail ("Error: the faces are not parallel");
return 1;
}
@@ -1353,7 +1354,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
{
if (aShapes.Extent() != 2)
{
std::cerr << "Error: Wrong number of selected shapes.\n";
Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
@@ -1405,7 +1406,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
{
if (aShapes.Extent() != 2)
{
std::cerr << "Error: Wrong number of selected shapes.\n";
Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
@@ -1456,7 +1457,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
{
if (aShapes.Extent() != 3)
{
std::cerr << "Error: Wrong number of selected shapes.\n";
Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
@@ -1480,12 +1481,12 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
if (!aDeltaEdgeAB.IsParallel())
{
std::cerr << "Syntax error: the edges are not parallel.\n";
Message::SendFail ("Syntax error: the edges are not parallel");
return 1;
}
if (!aDeltaEdgeAC.IsParallel())
{
std::cerr << "Syntax error: the edges are not parallel.\n";
Message::SendFail ("Syntax error: the edges are not parallel");
return 1;
}
@@ -1521,7 +1522,7 @@ static int VRelationBuilder (Draw_Interpretor& /*theDi*/,
}
case PrsDim_KOR_NONE:
{
std::cerr << "Error: Unknown type of relation!\n";
Message::SendFail ("Error: Unknown type of relation!");
return 1;
}
}
@@ -1582,7 +1583,7 @@ static int VDimParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
if (!aDim->IsValid())
{
std::cerr << "Error: Dimension geometry or plane is not valid.\n";
Message::SendFail ("Error: Dimension geometry or plane is not valid");
return 1;
}
@@ -1603,7 +1604,7 @@ static int VLengthParam (Draw_Interpretor&, Standard_Integer theArgNum, const ch
{
if (theArgNum < 3)
{
std::cout << theArgVec[0] << " error: the wrong number of input parameters.\n";
Message::SendFail ("Syntax error: the wrong number of input parameters");
return 1;
}
@@ -1611,14 +1612,14 @@ static int VLengthParam (Draw_Interpretor&, Standard_Integer theArgNum, const ch
Handle(AIS_InteractiveObject) anObject;
if (!GetMapOfAIS().Find2 (aName, anObject))
{
std::cout << theArgVec[0] << "error: no object with this name.\n";
Message::SendFail() << "Syntax error: no object with name '" << aName << "'";
return 1;
}
Handle(PrsDim_LengthDimension) aLengthDim = Handle(PrsDim_LengthDimension)::DownCast (anObject);
if (aLengthDim.IsNull())
{
std::cout << theArgVec[0] << "error: no length dimension with this name.\n";
Message::SendFail() << "Syntax error: no length dimension with name '" << aName << "'";
return 1;
}
@@ -1633,7 +1634,7 @@ static int VLengthParam (Draw_Interpretor&, Standard_Integer theArgNum, const ch
{
if (anArgumentIt + 1 >= theArgNum)
{
std::cout << "Error: "<< aParam <<" direction should have value.\n";
Message::SendFail() << "Error: "<< aParam <<" direction should have value";
return 1;
}
anArgumentIt++;
@@ -1652,7 +1653,7 @@ static int VLengthParam (Draw_Interpretor&, Standard_Integer theArgNum, const ch
{
if (anArgumentIt + 2 >= theArgNum)
{
std::cout << "Error: wrong number of values for parameter '" << aParam << "'.\n";
Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
// access coordinate arguments
@@ -1669,7 +1670,7 @@ static int VLengthParam (Draw_Interpretor&, Standard_Integer theArgNum, const ch
// non-numeric argument too early
if (aCoords.IsEmpty() || aCoords.Size() != 3)
{
std::cout << "Error: wrong number of direction arguments.\n";
Message::SendFail ("Error: wrong number of direction arguments");
return 1;
}
aDirection = gp_Dir (aCoords.Value (1), aCoords.Value (2), aCoords.Value (3));
@@ -1679,7 +1680,7 @@ static int VLengthParam (Draw_Interpretor&, Standard_Integer theArgNum, const ch
aLengthDim->SetDirection (aDirection, isCustomDirection);
if (!aLengthDim->IsValid())
{
std::cout << "Error: Dimension geometry or plane is not valid.\n";
Message::SendFail ("Error: Dimension geometry or plane is not valid");
return 1;
}
@@ -1734,7 +1735,7 @@ static int VAngleParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, con
if (!aDim->IsValid())
{
std::cerr << "Error: Dimension geometry or plane is not valid.\n";
Message::SendFail ("Error: Dimension geometry or plane is not valid");
return 1;
}

File diff suppressed because it is too large Load Diff