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
#ifndef _Message_HeaderFile
#define _Message_HeaderFile
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Integer.hxx>
-#include <Standard_Real.hxx>
-class Message_Messenger;
-class TCollection_AsciiString;
-class Message_Msg;
-class Message_MsgFile;
-class Message_Messenger;
-class Message_Algorithm;
-class Message_Printer;
-class Message_PrinterOStream;
-class Message_ProgressIndicator;
-class Message_ProgressScale;
-class Message_ProgressSentry;
-
+#include <Message_Messenger.hxx>
//! Defines
//! - tools to work with messages
//! - basic tools intended for progress indication
-class Message
+class Message
{
public:
DEFINE_STANDARD_ALLOC
-
//! Defines default messenger for OCCT applications.
//! This is global static instance of the messenger.
//! By default, it contains single printer directed to std::cout.
//! It can be customized according to the application needs.
+ //!
+ //! The following syntax can be used to print messages:
+ //! @begincode
+ //! Message::DefaultMessenger()->Send ("My Warning", Message_Warning);
+ //! Message::SendWarning ("My Warning"); // short-cut for Message_Warning
+ //! Message::SendWarning() << "My Warning with " << theCounter << " arguments";
+ //! Message::SendFail ("My Failure"); // short-cut for Message_Fail
+ //! @endcode
Standard_EXPORT static const Handle(Message_Messenger)& DefaultMessenger();
-
+
+public:
+ //!@name Short-cuts to DefaultMessenger
+
+ static Message_Messenger::StreamBuffer Send(Message_Gravity theGravity)
+ {
+ return DefaultMessenger()->Send (theGravity);
+ }
+
+ static void Send(const TCollection_AsciiString& theMessage, Message_Gravity theGravity)
+ {
+ DefaultMessenger()->Send (theMessage, theGravity);
+ }
+
+ static Message_Messenger::StreamBuffer SendFail() { return DefaultMessenger()->SendFail (); }
+ static Message_Messenger::StreamBuffer SendAlarm() { return DefaultMessenger()->SendAlarm (); }
+ static Message_Messenger::StreamBuffer SendWarning() { return DefaultMessenger()->SendWarning (); }
+ static Message_Messenger::StreamBuffer SendInfo() { return DefaultMessenger()->SendInfo (); }
+ static Message_Messenger::StreamBuffer SendTrace() { return DefaultMessenger()->SendTrace (); }
+
+ static void SendFail (const TCollection_AsciiString& theMessage) { return DefaultMessenger()->SendFail (theMessage); }
+ static void SendAlarm (const TCollection_AsciiString& theMessage) { return DefaultMessenger()->SendAlarm (theMessage); }
+ static void SendWarning (const TCollection_AsciiString& theMessage) { return DefaultMessenger()->SendWarning (theMessage); }
+ static void SendInfo (const TCollection_AsciiString& theMessage) { return DefaultMessenger()->SendInfo (theMessage); }
+ static void SendTrace (const TCollection_AsciiString& theMessage) { return DefaultMessenger()->SendTrace (theMessage); }
+
+public:
+
//! Returns the string filled with values of hours, minutes and seconds.
//! Example:
//! 1. (5, 12, 26.3345) returns "05h:12m:26.33s",
//! 3. (0, 0, 4.5 ) returns "4.50s"
Standard_EXPORT static TCollection_AsciiString FillTime (const Standard_Integer Hour, const Standard_Integer Minute, const Standard_Real Second);
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class Message_Msg;
-friend class Message_MsgFile;
-friend class Message_Messenger;
-friend class Message_Algorithm;
-friend class Message_Printer;
-friend class Message_PrinterOStream;
-friend class Message_ProgressIndicator;
-friend class Message_ProgressScale;
-friend class Message_ProgressSentry;
-
};
-
-
-
-
-
-
#endif // _Message_HeaderFile
#include <Message_Gravity.hxx>
#include <Message_SequenceOfPrinters.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_CString.hxx>
+
#include <TCollection_HAsciiString.hxx>
#include <TCollection_HExtendedString.hxx>
//! customized by the application, and dispatches every received
//! message to all the printers.
//!
-//! For convenience, a number of operators << are defined with left
-//! argument being Handle(Message_Messenger); thus it can be used
-//! with syntax similar to C++ streams.
-//! Note that all these operators use trace level Warning.
+//! For convenience, a set of methods Send...() returning a string
+//! stream buffer is defined for use of stream-like syntax with operator <<
+//!
+//! Example:
+//! ~~~~~
+//! Messenger->SendFail() << " Unknown fail at line " << aLineNo << " in file " << aFile;
+//! ~~~~~
+//!
+//! The message is sent to messenger on destruction of the stream buffer,
+//! call to Flush(), or passing manipulator std::ends, std::endl, or std::flush.
+//! Empty messages are not sent except if manipulator is used.
class Message_Messenger : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Message_Messenger, Standard_Transient)
+public:
+ //! Auxiliary class wrapping std::stringstream thus allowing constructing
+ //! message via stream interface, and putting result into its creator
+ //! Message_Messenger within destructor.
+ //!
+ //! It is intended to be used either as temporary object or as local
+ //! variable, note that content will be lost if it is copied.
+ class StreamBuffer
+ {
+ public:
+
+ //! Destructor flushing constructed message.
+ ~StreamBuffer() { Flush(); }
+
+ //! Flush collected string to messenger
+ void Flush(Standard_Boolean doForce = Standard_False)
+ {
+ myStream.flush();
+ if (doForce || myStream.rdbuf()->in_avail() > 0)
+ {
+ myMessenger->Send (myStream.str().c_str(), myGravity);
+ myStream.str(std::string()); // empty the buffer for possible reuse
+ }
+ }
+
+ //! Formal copy constructor.
+ //!
+ //! Since buffer is intended for use as temporary object or local
+ //! variable, copy (or move) is needed only formally to be able to
+ //! return the new instance from relevant creation method.
+ //! In practice it should never be called because modern compilers
+ //! create such instances in place.
+ //! However note that if this constructor is called, the buffer
+ //! content (string) will not be copied (move is not supported for
+ //! std::stringstream class on old compilers such as gcc 4.4, msvc 9).
+ StreamBuffer (const StreamBuffer& theOther)
+ : myMessenger(theOther.myMessenger), myGravity(theOther.myGravity)
+ {
+ }
+
+ //! Wrapper for operator << of the stream
+ template <typename T>
+ StreamBuffer& operator << (const T& theArg)
+ {
+ myStream << theArg;
+ return *this;
+ }
+
+ //! Operator << for manipulators of ostream (ends, endl, flush),
+ //! flushes the buffer (sends the message)
+ StreamBuffer& operator << (std::ostream& (*)(std::ostream&))
+ {
+ Flush(Standard_True);
+ return *this;
+ }
+
+ //! Access to the stream object
+ Standard_SStream& Stream () { return myStream; }
+
+ private:
+ friend class Message_Messenger;
+
+ //! Main constructor creating temporary buffer.
+ //! Accessible only to Messenger class.
+ StreamBuffer (Message_Messenger* theMessenger, Message_Gravity theGravity)
+ : myMessenger (theMessenger),
+ myGravity (theGravity)
+ {}
+
+ private:
+ Message_Messenger* myMessenger; // don't make a Handle since this object should be created on stack
+ Message_Gravity myGravity;
+ Standard_SStream myStream;
+ };
+
public:
//! Empty constructor; initializes by single printer directed to std::cout.
//! The parameter putEndl specifies whether the new line should
//! be started after this message (default) or not (may have
//! sense in some conditions).
- Standard_EXPORT void Send (const Standard_CString theString, const Message_Gravity theGravity = Message_Warning, const Standard_Boolean putEndl = Standard_True) const;
+ Standard_EXPORT void Send (const Standard_CString theString,
+ const Message_Gravity theGravity = Message_Warning,
+ const Standard_Boolean putEndl = Standard_True) const;
//! See above
- Standard_EXPORT void Send (const TCollection_AsciiString& theString, const Message_Gravity theGravity = Message_Warning, const Standard_Boolean putEndl = Standard_True) const;
+ Standard_EXPORT void Send (const TCollection_AsciiString& theString,
+ const Message_Gravity theGravity = Message_Warning,
+ const Standard_Boolean putEndl = Standard_True) const;
//! See above
- Standard_EXPORT void Send (const TCollection_ExtendedString& theString, const Message_Gravity theGravity = Message_Warning, const Standard_Boolean putEndl = Standard_True) const;
+ Standard_EXPORT void Send (const TCollection_ExtendedString& theString,
+ const Message_Gravity theGravity = Message_Warning,
+ const Standard_Boolean putEndl = Standard_True) const;
+
+ //! Create string buffer for message of specified type
+ StreamBuffer Send (Message_Gravity theGravity) { return StreamBuffer (this, theGravity); }
+
+ //! Create string buffer for sending Fail message
+ StreamBuffer SendFail () { return Send (Message_Fail); }
+
+ //! Create string buffer for sending Alarm message
+ StreamBuffer SendAlarm () { return Send (Message_Alarm); }
+
+ //! Create string buffer for sending Warning message
+ StreamBuffer SendWarning () { return Send (Message_Warning); }
+
+ //! Create string buffer for sending Info message
+ StreamBuffer SendInfo () { return Send (Message_Info); }
+
+ //! Create string buffer for sending Trace message
+ StreamBuffer SendTrace () { return Send (Message_Trace); }
+
+ //! Short-cut to Send (theMessage, Message_Fail)
+ void SendFail (const TCollection_AsciiString& theMessage) { Send (theMessage, Message_Fail); }
+
+ //! Short-cut to Send (theMessage, Message_Alarm)
+ void SendAlarm (const TCollection_AsciiString& theMessage) { Send (theMessage, Message_Alarm); }
+
+ //! Short-cut to Send (theMessage, Message_Warning)
+ void SendWarning (const TCollection_AsciiString& theMessage) { Send (theMessage, Message_Warning); }
+
+ //! Short-cut to Send (theMessage, Message_Info)
+ void SendInfo (const TCollection_AsciiString& theMessage) { Send (theMessage, Message_Info); }
+
+ //! Short-cut to Send (theMessage, Message_Trace)
+ void SendTrace (const TCollection_AsciiString& theMessage) { Send (theMessage, Message_Trace); }
private:
return aCpuMask;
}
- // if we're not at the end of the item, expect a dash and and integer; extract end value.
+ // if we're not at the end of the item, expect a dash and integer; extract end value.
int anIndexUpper = anIndexLower;
if (aCharIter < aChunkEnd && *aCharIter == '-')
{
#include <BRepFeat_SplitShape.hxx>
#include <BRepAlgoAPI_Section.hxx>
#include <TColStd_PackedMapOfInteger.hxx>
+#include <Message.hxx>
+#include <Draw_Printer.hxx>
#if ! defined(_WIN32)
extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
return 0;
}
+Standard_Integer OCC31189 (Draw_Interpretor& theDI, Standard_Integer /*argc*/, const char ** /*argv*/)
+{
+ // redirect output of default messenger to DRAW (temporarily)
+ const Handle(Message_Messenger)& aMsgMgr = Message::DefaultMessenger();
+ Message_SequenceOfPrinters aPrinters;
+ aPrinters.Append (aMsgMgr->ChangePrinters());
+ aMsgMgr->AddPrinter (new Draw_Printer (theDI));
+
+ // scope block to test output of message on destruction of a stream buffer
+ {
+ Message_Messenger::StreamBuffer aSender = Message::SendInfo();
+
+ // check that messages output to sender and directly to messenger do not intermix
+ aSender << "Sender message 1: start ...";
+ aMsgMgr->Send ("Direct message 1");
+ aSender << "... end" << std::endl; // endl should send the message
+
+ // check that empty stream buffer does not produce output on destruction
+ Message::SendInfo();
+
+ // additional message to check that they go in expected order
+ aMsgMgr->Send ("Direct message 2");
+
+ // check that empty stream buffer does produce empty line if std::endl is passed
+ Message::SendInfo() << std::endl;
+
+ // last message should be sent on destruction of a sender
+ aSender << "Sender message 2";
+ }
+
+ // restore initial output queue
+ aMsgMgr->RemovePrinters (STANDARD_TYPE(Draw_Printer));
+ aMsgMgr->ChangePrinters().Append (aPrinters);
+
+ return 0;
+}
+
void QABugs::Commands_11(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
theCommands.Add("OCC136", "OCC136", __FILE__, OCC136, group);
theCommands.Add("BUC60610","BUC60610 iges_input [name]",__FILE__,BUC60610,group);
-//====================================================
-//
-// Following commands are inserted from
-// /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
-// ( 75455 Apr 16 18:59)
-//
-//====================================================
-
theCommands.Add("OCC105","OCC105 shape",__FILE__,OCC105,group);
theCommands.Add("OCC9"," result path cur1 cur2 radius [tolerance]:\t test GeomFill_Pipe", __FILE__, pipe_OCC9,group);
theCommands.Add("CR23403", "CR23403 string", __FILE__, CR23403, group);
theCommands.Add("OCC23429", "OCC23429 res shape tool [appr]", __FILE__, OCC23429, group);
theCommands.Add("OCC28478", "OCC28478 [nb_outer=3 [nb_inner=2] [-inf]: test progress indicator on nested cycles", __FILE__, OCC28478, group);
+ theCommands.Add("OCC31189", "OCC31189: check stream buffer interface of Message_Messenger", __FILE__, OCC31189, group);
return;
}
#include <Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_MediaTextureSet.hxx>
#include <Image_AlienPixMap.hxx>
+#include <Message.hxx>
#include <OSD_File.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_ShadingAspect.hxx>
Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
- std::cout << "Error: AIS context is not available.\n";
+ Message::SendFail ("Error: AIS context is not available.");
return Standard_False;
}
{
if (!theReplaceIfExists)
{
- std::cout << "Error: other interactive object has been already registered with name: " << theName << ".\n"
- << "Please use another name.\n";
+ Message::SendFail() << "Error: other interactive object has been already registered with name: " << theName << ".\n"
+ << "Please use another name.";
return Standard_False;
}
if (theCtx.IsNull()
|| theView.IsNull())
{
- std::cout << "Error: cannot find an active view!\n";
+ Message::SendFail ("Error: cannot find an active view!");
return Standard_False;
}
return Standard_True;
continue;
}
- std::cout << "Remove " << anObjIter.Key2() << std::endl;
+ Message::SendInfo() << "Remove " << anObjIter.Key2();
TheAISContext()->Remove (anObj, Standard_False);
aListRemoved.Append (anObj);
}
GetMapOfAIS().Find2(name, aShape);
if (aShape.IsNull())
{
- std::cout << "Syntax error: object '" << name << "' is not found\n";
+ Message::SendFail() << "Syntax error: object '" << name << "' is not found";
return 1;
}
{
if (theArgNb > 1)
{
- std::cout << "Error: wrong syntax!\n";
+ Message::SendFail ("Error: wrong syntax!");
return 1;
}
{
if (theArgNb > 1)
{
- std::cout << "Error: wrong syntax!\n";
+ Message::SendFail ("Error: wrong syntax!");
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1;
}
}
{
if (theArgNb < 2)
{
- std::cout << "Error: wrong number of arguments! Image file name should be specified at least.\n";
+ Message::SendFail ("Error: wrong number of arguments! Image file name should be specified at least.");
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
}
else
{
- std::cout << "Error: unknown buffer '" << aBufArg << "'\n";
+ Message::SendFail() << "Error: unknown buffer '" << aBufArg << "'";
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
}
else
{
- std::cout << "Error: unknown stereo format '" << aStereoArg << "'\n";
+ Message::SendFail() << "Error: unknown stereo format '" << aStereoArg << "'";
return 1;
}
}
{
if (aParams.Width != 0)
{
- std::cout << "Error: wrong syntax at " << theArgVec[anArgIter] << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << theArgVec[anArgIter];
return 1;
}
else if (++anArgIter >= theArgNb)
{
- std::cout << "Error: integer value is expected right after 'width'\n";
+ Message::SendFail() << "Error: integer value is expected right after 'width'";
return 1;
}
aParams.Width = Draw::Atoi (theArgVec[anArgIter]);
{
if (aParams.Height != 0)
{
- std::cout << "Error: wrong syntax at " << theArgVec[anArgIter] << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << theArgVec[anArgIter];
return 1;
}
else if (++anArgIter >= theArgNb)
{
- std::cout << "Error: integer value is expected right after 'height'\n";
+ Message::SendFail() << "Error: integer value is expected right after 'height'";
return 1;
}
aParams.Height = Draw::Atoi (theArgVec[anArgIter]);
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: integer value is expected right after 'tileSize'\n";
+ Message::SendFail() << "Error: integer value is expected right after 'tileSize'";
return 1;
}
aParams.TileSize = Draw::Atoi (theArgVec[anArgIter]);
}
else
{
- std::cout << "Error: unknown argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Error: unknown argument '" << theArgVec[anArgIter] << "'";
return 1;
}
}
if ((aParams.Width <= 0 && aParams.Height > 0)
|| (aParams.Width > 0 && aParams.Height <= 0))
{
- std::cout << "Error: dimensions " << aParams.Width << "x" << aParams.Height << " are incorrect\n";
+ Message::SendFail() << "Error: dimensions " << aParams.Width << "x" << aParams.Height << " are incorrect";
return 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cout << "Error: cannot find an active view!\n";
+ Message::SendFail() << "Error: cannot find an active view!";
return 1;
}
if (argc < 1
|| argc > 3)
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail() << "Syntax error: wrong number of arguments";
return 1;
}
{
if (!GetMapOfAIS().IsBound2 (mySeqIter.Value()))
{
- std::cout << "Error: object " << mySeqIter.Value() << " is not displayed!\n";
+ Message::SendFail() << "Error: object " << mySeqIter.Value() << " is not displayed!";
return;
}
myCurrentName = mySeqIter.Value();
Standard_Boolean isOk = Standard_True;
if (Visibility != 0 && Visibility != 1)
{
- std::cout << "Error: the visibility should be equal to 0 or 1 (0 - invisible; 1 - visible) (specified " << Visibility << ")\n";
+ Message::SendFail() << "Error: the visibility should be equal to 0 or 1 (0 - invisible; 1 - visible) (specified " << Visibility << ")";
isOk = Standard_False;
}
if (LineWidth <= 0.0
|| LineWidth > 10.0)
{
- std::cout << "Error: the width should be within [1; 10] range (specified " << LineWidth << ")\n";
+ Message::SendFail() << "Error: the width should be within [1; 10] range (specified " << LineWidth << ")";
isOk = Standard_False;
}
if (Transparency < 0.0
|| Transparency > 1.0)
{
- std::cout << "Error: the transparency should be within [0; 1] range (specified " << Transparency << ")\n";
+ Message::SendFail() << "Error: the transparency should be within [0; 1] range (specified " << Transparency << ")";
isOk = Standard_False;
}
if (ToSetAlphaMode == 1
&& (AlphaCutoff <= 0.0f || AlphaCutoff >= 1.0f))
{
- std::cout << "Error: alpha cutoff value should be within (0; 1) range (specified " << AlphaCutoff << ")\n";
+ Message::SendFail() << "Error: alpha cutoff value should be within (0; 1) range (specified " << AlphaCutoff << ")";
isOk = Standard_False;
}
if (FreeBoundaryWidth <= 0.0
|| FreeBoundaryWidth > 10.0)
{
- std::cout << "Error: the free boundary width should be within [1; 10] range (specified " << FreeBoundaryWidth << ")\n";
+ Message::SendFail() << "Error: the free boundary width should be within [1; 10] range (specified " << FreeBoundaryWidth << ")";
isOk = Standard_False;
}
if (MaxParamValue < 0.0)
{
- std::cout << "Error: the max parameter value should be greater than zero (specified " << MaxParamValue << ")\n";
+ Message::SendFail() << "Error: the max parameter value should be greater than zero (specified " << MaxParamValue << ")";
isOk = Standard_False;
}
if (Sensitivity <= 0 && ToSetSensitivity)
{
- std::cout << "Error: sensitivity parameter value should be positive (specified " << Sensitivity << ")\n";
+ Message::SendFail() << "Error: sensitivity parameter value should be positive (specified " << Sensitivity << ")";
isOk = Standard_False;
}
if (ToSetHatch == 1 && StdHatchStyle < 0 && PathToHatchPattern == "")
{
- std::cout << "Error: hatch style must be specified\n";
+ Message::SendFail ("Error: hatch style must be specified");
isOk = Standard_False;
}
if (ToSetShadingModel == 1
&& (ShadingModel < Graphic3d_TOSM_DEFAULT || ShadingModel > Graphic3d_TOSM_PBR_FACET))
{
- std::cout << "Error: unknown shading model " << ShadingModelName << ".\n";
+ Message::SendFail() << "Error: unknown shading model " << ShadingModelName << ".";
isOk = Standard_False;
}
return isOk;
}
else
{
- std::cout << "Error: cannot load the following image: " << PathToHatchPattern << "\n";
+ Message::SendFail() << "Error: cannot load the following image: " << PathToHatchPattern;
}
}
else if (StdHatchStyle != -1)
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
if (aCtx.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
if (!aNames.IsEmpty() && isDefaults)
{
- std::cout << "Error: wrong syntax. If -defaults is used there should not be any objects' names!\n";
+ Message::SendFail ("Error: wrong syntax. If -defaults is used there should not be any objects' names!");
return 1;
}
if (aNames.IsEmpty()
|| !aNames.Last().IsRealValue())
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
aChangeSet->ToSetLineWidth = 1;
{
if (aNames.IsEmpty())
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
aChangeSet->ToSetColor = 1;
}
if (!isOk)
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
}
if (aNames.IsEmpty()
|| !aNames.Last().IsRealValue())
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
aChangeSet->ToSetTransparency = 1;
{
if (aNames.IsEmpty())
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
aChangeSet->ToSetMaterial = 1;
aNames.Remove (aNames.Length());
if (!Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString(), aChangeSet->Material))
{
- std::cout << "Syntax error: unknown material '" << aChangeSet->MatName << "'.\n";
+ Message::SendFail() << "Syntax error: unknown material '" << aChangeSet->MatName << "'.";
return 1;
}
}
if (aNames.IsEmpty()
|| !aNames.Last().IsRealValue())
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
aChangeSet->ToSetInterior = 1;
if (!parseInteriorStyle (aNames.Last(), aChangeSet->InteriorStyle))
{
- std::cout << "Error: wrong syntax at " << aNames.Last() << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << aNames.Last();
return 1;
}
aNames.Remove (aNames.Length());
}
else if (anArgIter >= theArgNb)
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetTransparency = 1;
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetAlphaMode = 1;
}
else
{
- std::cout << "Error: wrong syntax at " << aParam << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << aParam;
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetTransparency = 1;
if (aChangeSet->Transparency < 0.0
|| aChangeSet->Transparency > 1.0)
{
- std::cout << "Error: the transparency should be within [0; 1] range (specified " << aChangeSet->Transparency << ")\n";
+ Message::SendFail() << "Error: the transparency should be within [0; 1] range (specified " << aChangeSet->Transparency << ")";
return 1;
}
aChangeSet->Transparency = 1.0 - aChangeSet->Transparency;
aColor);
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
Aspect_TypeOfLine aLineType = Aspect_TOL_EMPTY;
uint16_t aLinePattern = 0xFFFF;
if (!ViewerTest::ParseLineType (theArgVec[anArgIter], aLineType, aLinePattern))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
if (!ViewerTest::ParseMarkerType (theArgVec[anArgIter], aChangeSet->TypeOfMarker, aChangeSet->MarkerImage))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetMarkerSize = 1;
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetMaterial = 1;
aChangeSet->MatName = theArgVec[anArgIter];
if (!Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString(), aChangeSet->Material))
{
- std::cout << "Syntax error: unknown material '" << aChangeSet->MatName << "'.\n";
+ Message::SendFail() << "Syntax error: unknown material '" << aChangeSet->MatName << "'.";
return 1;
}
}
{
if (isDefaults)
{
- std::cout << "Error: wrong syntax. -subshapes can not be used together with -defaults call!\n";
+ Message::SendFail() << "Error: wrong syntax. -subshapes can not be used together with -defaults call!";
return 1;
}
if (aNames.IsEmpty())
{
- std::cout << "Error: main objects should specified explicitly when -subshapes is used!\n";
+ Message::SendFail() << "Error: main objects should specified explicitly when -subshapes is used!";
return 1;
}
TopoDS_Shape aSubShape = DBRep::Get (aSubShapeName);
if (aSubShape.IsNull())
{
- std::cerr << "Error: shape " << aSubShapeName << " doesn't found!\n";
+ Message::SendFail() << "Error: shape " << aSubShapeName << " doesn't found!";
return 1;
}
aChangeSet->SubShapes.Append (aSubShape);
if (aChangeSet->SubShapes.IsEmpty())
{
- std::cerr << "Error: empty list is specified after -subshapes!\n";
+ Message::SendFail() << "Error: empty list is specified after -subshapes!";
return 1;
}
}
bool toEnable = true;
if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
++anArgIter;
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetFreeBoundaryWidth = 1;
aChangeSet->FreeBoundaryColor);
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
bool toEnable = true;
if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
++anArgIter;
bool toEnable = true;
if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
++anArgIter;
}
else
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetMaxParamValue = 1;
{
if (isDefaults)
{
- std::cout << "Error: wrong syntax. -setSensitivity can not be used together with -defaults call!\n";
+ Message::SendFail() << "Error: wrong syntax. -setSensitivity can not be used together with -defaults call!";
return 1;
}
if (aNames.IsEmpty())
{
- std::cout << "Error: object and selection mode should specified explicitly when -setSensitivity is used!\n";
+ Message::SendFail() << "Error: object and selection mode should specified explicitly when -setSensitivity is used!";
return 1;
}
if (anArgIter + 2 >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetSensitivity = 1;
{
if (isDefaults)
{
- std::cout << "Error: wrong syntax. -setHatch can not be used together with -defaults call!\n";
+ Message::SendFail() << "Error: wrong syntax. -setHatch can not be used together with -defaults call!";
return 1;
}
if (aNames.IsEmpty())
{
- std::cout << "Error: object should be specified explicitly when -setHatch is used!\n";
+ Message::SendFail() << "Error: object should be specified explicitly when -setHatch is used!";
return 1;
}
if (anIntStyle < 0
|| anIntStyle >= Aspect_HS_NB)
{
- std::cout << "Error: hatch style is out of range [0, " << (Aspect_HS_NB - 1) << "]!\n";
+ Message::SendFail() << "Error: hatch style is out of range [0, " << (Aspect_HS_NB - 1) << "]!";
return 1;
}
aChangeSet->StdHatchStyle = anIntStyle;
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetShadingModel = 1;
aChangeSet->ShadingModelName = theArgVec[anArgIter];
if (!ViewerTest::ParseShadingModel (theArgVec[anArgIter], aChangeSet->ShadingModel))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetInterior = 1;
if (!parseInteriorStyle (theArgVec[anArgIter], aChangeSet->InteriorStyle))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
}
aChangeSet->EdgeColor);
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aDumpDepth = Draw::Atoi (theArgVec[anArgIter]);
}
else
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
}
Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast (aPrs);
if (aShapePrs.IsNull())
{
- std::cout << "Error: an object " << aName << " is not an AIS_Shape presentation!\n";
+ Message::SendFail() << "Error: an object " << aName << " is not an AIS_Shape presentation!";
return 1;
}
aColoredPrs = Handle(AIS_ColoredShape)::DownCast (aShapePrs);
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
if (aCtx.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
if (aCtx.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
if (toRemoveAll
&& anArgIter < theArgNb)
{
- std::cerr << "Error: wrong syntax!\n";
+ Message::SendFail ("Error: wrong syntax!");
return 1;
}
{
if (toFailOnError)
{
- std::cout << "Syntax error: '" << aName << "' was not bound to some object.\n";
+ Message::SendFail() << "Syntax error: '" << aName << "' was not bound to some object.";
return 1;
}
}
{
if (toFailOnError)
{
- std::cout << "Syntax error: '" << aName << "' was not displayed in current context.\n"
- << "Please activate view with this object displayed and try again.\n";
+ Message::SendFail() << "Syntax error: '" << aName << "' was not displayed in current context.\n"
+ << "Please activate view with this object displayed and try again.";
return 1;
}
}
ViewerTest_AutoUpdater anUpdateTool (aCtx, aView);
if (aCtx.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
if (!aNamesOfEraseIO.IsEmpty() && toEraseAll)
{
- std::cerr << "Error: wrong syntax, " << theArgVec[0] << " too much arguments.\n";
+ Message::SendFail() << "Error: wrong syntax, " << theArgVec[0] << " too much arguments.";
return 1;
}
{
if (toFailOnError)
{
- std::cout << "Syntax error: '" << aName << "' is not found\n";
+ Message::SendFail() << "Syntax error: '" << aName << "' is not found";
return 1;
}
}
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
if (aCtx.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
}
if (anArgIter < theArgNb)
{
- std::cout << theArgVec[0] << "Error: wrong syntax\n";
+ Message::SendFail() << theArgVec[0] << "Error: wrong syntax";
return 1;
}
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
if (aCtx.IsNull())
{
- std::cout << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aMode = Draw::Atoi (theArgVec[anArgIter]);
Handle(AIS_InteractiveObject) anIO;
if (!GetMapOfAIS().Find2 (aName, anIO))
{
- std::cout << "Error: presentation " << aName << " does not exist\n";
+ Message::SendFail() << "Error: presentation " << aName << " does not exist";
return 1;
}
aHighlightedMode = checkMode (aCtx, anIO, aMode);
if (aHighlightedMode == -1)
{
- std::cout << "Error: object " << aName << " has no presentation with mode " << aMode << std::endl;
+ Message::SendFail() << "Error: object " << aName << " has no presentation with mode " << aMode;
return 1;
}
bndPresentation (theDI, aCtx->MainPrsMgr(), anIO, aHighlightedMode, aName, anAction, aStyle);
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
- std::cout << "Error: no active view!\n";
+ Message::SendFail() << "Error: no active view!";
return 1;
}
}
if (aTexturedIO.IsNull())
{
- std::cout << "Syntax error: shape " << aName << " does not exists in the viewer.\n";
+ Message::SendFail() << "Syntax error: shape " << aName << " does not exists in the viewer.";
return 1;
}
}
}
}
- std::cout << "Syntax error: unexpected argument '" << aName << "'\n";
+ Message::SendFail() << "Syntax error: unexpected argument '" << aName << "'";
return 1;
}
else if (!aTexturedShape.IsNull()
}
}
}
- std::cout << "Syntax error: unexpected argument '" << aName << "'\n";
+ Message::SendFail() << "Syntax error: unexpected argument '" << aName << "'";
return 1;
}
else if (!aTexturedShape.IsNull()
}
}
}
- std::cout << "Syntax error: unexpected argument '" << aName << "'\n";
+ Message::SendFail() << "Syntax error: unexpected argument '" << aName << "'";
return 1;
}
else if (aNameCase == "-modulate")
}
else
{
- std::cout << "Syntax error: unexpected argument '" << aValue << "'\n";
+ Message::SendFail() << "Syntax error: unexpected argument '" << aValue << "'";
return 1;
}
}
}
else
{
- std::cout << "Syntax error: unexpected argument '" << aValue << "'\n";
+ Message::SendFail() << "Syntax error: unexpected argument '" << aValue << "'";
return 1;
}
}
if (anArgIter + 1 >= theArgsNb
|| aNameCase.Length() < 5)
{
- std::cout << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'";
return 1;
}
TCollection_AsciiString aTexIndexStr = aNameCase.SubString (5, aNameCase.Length());
if (!aTexIndexStr.IsIntegerValue())
{
- std::cout << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'";
return 1;
}
if (aTexIndex >= Graphic3d_TextureUnit_NB
|| aTexIndex >= aCtx->CurrentViewer()->Driver()->InquireLimit (Graphic3d_TypeOfLimit_MaxCombinedTextureUnits))
{
- std::cout << "Error: too many textures specified\n";
+ Message::SendFail ("Error: too many textures specified");
return 1;
}
const Standard_Integer aValue = aTexName.IntegerValue();
if (aValue < 0 || aValue >= Graphic3d_Texture2D::NumberOfTextures())
{
- std::cout << "Syntax error: texture with ID " << aValue << " is undefined!\n";
+ Message::SendFail() << "Syntax error: texture with ID " << aValue << " is undefined!";
return 1;
}
aTextureVecNew.SetValue (aTexIndex, new Graphic3d_Texture2Dmanual (Graphic3d_NameOfTexture2D (aValue)));
{
if (!OSD_File (aTexName).Exists())
{
- std::cout << "Syntax error: non-existing image file has been specified '" << aTexName << "'.\n";
+ Message::SendFail() << "Syntax error: non-existing image file has been specified '" << aTexName << "'.";
return 1;
}
aTextureVecNew.SetValue (aTexIndex, new Graphic3d_Texture2Dmanual (aTexName));
}
else
{
- std::cout << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'";
return 1;
}
}
{
if (theArgNb < 2)
{
- std::cerr << theArgVec[0] << "Error: wrong number of arguments.\n";
+ Message::SendFail ("Syntax error: wrong number of arguments.");
return 1;
}
if (theArgNb == 2
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
if (++anArgIter >= theArgNb
|| !aTrsfPers.IsNull())
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
aPersFlags.LowerCase();
if (!parseTrsfPersFlag (aPersFlags, aTrsfPersFlags))
{
- std::cerr << "Error: wrong transform persistence flags " << theArgVec [anArgIter] << ".\n";
+ Message::SendFail() << "Error: wrong transform persistence flags " << theArgVec [anArgIter] << ".";
return 1;
}
if (anArgIter + 2 >= theArgNb
|| aTrsfPers.IsNull())
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
if (!aX.IsRealValue()
|| !aY.IsRealValue())
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
if (anArgIter + 1 < theArgNb)
|| !ViewerTest::ParseZLayer (theArgVec[anArgIter], aZLayer)
|| aZLayer == Graphic3d_ZLayerId_UNKNOWN)
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
}
if (aNamesOfDisplayIO.IsEmpty())
{
- std::cerr << theArgVec[0] << "Error: wrong number of arguments.\n";
+ Message::SendFail ("Syntax error: wrong number of arguments.");
return 1;
}
}
if (!aShape->AcceptDisplayMode (anObjDispMode))
{
- std::cout << "Syntax error: " << aShape->DynamicType()->Name() << " rejects " << anObjDispMode << " display mode\n";
+ Message::SendFail() << "Syntax error: " << aShape->DynamicType()->Name() << " rejects " << anObjDispMode << " display mode";
return 1;
}
else
if (anObjHighMode != -1
&& !aShape->AcceptDisplayMode (anObjHighMode))
{
- std::cout << "Syntax error: " << aShape->DynamicType()->Name() << " rejects " << anObjHighMode << " display mode\n";
+ Message::SendFail() << "Syntax error: " << aShape->DynamicType()->Name() << " rejects " << anObjHighMode << " display mode";
return 1;
}
aShape->SetHilightMode (anObjHighMode);
}
else
{
- std::cerr << "Error: object with name '" << aName << "' does not exist!\n";
+ Message::SendFail() << "Error: object with name '" << aName << "' does not exist!";
}
continue;
}
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
- std::cout << theArgVec[0] << "AIS context is not available.\n";
+ Message::SendFail ("Syntax error: AIS context is not available.");
return 1;
}
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
- std::cout << theArgVec[0] << "AIS context is not available.\n";
+ Message::SendFail ("Syntax error: AIS context is not available.");
return 1;
}
if (theArgsNb < 2)
{
- std::cout << theArgVec[0] << ": insufficient arguments. Type help for more information.\n";
+ Message::SendFail ("Syntax error: insufficient arguments. Type help for more information.");
return 1;
}
GetMapOfAIS().Find2 (aName, anAISObj);
if (anAISObj.IsNull())
{
- std::cout << theArgVec[0] << ": no AIS interactive object named \"" << aName << "\".\n";
+ Message::SendFail() << theArgVec[0] << ": no AIS interactive object named \"" << aName << "\".";
return 1;
}
Handle(AIS_InteractiveContext) aCtx = TheAISContext();
if (aCtx.IsNull())
{
- std::cerr << "Error: No opened viewer!\n";
+ Message::SendFail ("Error: No opened viewer!");
return 1;
}
const Standard_Integer aNbToReach = theResArray->Length();
if (aNbToReach > 1)
{
- std::cout << " WARNING : Pick with Shift+ MB1 for Selection of more than 1 object\n";
+ Message::SendWarning ("WARNING : Pick with Shift+ MB1 for Selection of more than 1 object");
}
// step 1: prepare the data
{
++aNbPickFail;
}
- std::cout << "NbPicked = " << aNbPickGood << " | Nb Pick Fail :" << aNbPickFail << "\n";
+ Message::SendInfo() << "NbPicked = " << aNbPickGood << " | Nb Pick Fail :" << aNbPickFail;
}
// step3 get result.
else if (aShapeArg == "solid") aShapeType = TopAbs_SOLID;
else
{
- std::cout << "Syntax error at '" << argv[1] << "'\n";
+ Message::SendFail() << "Syntax error at '" << argv[1] << "'";
return 1;
}
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "Error: AIS context is not available.\n";
+ Message::SendFail ("Error: AIS context is not available.");
return 1;
}
TopAbs_ShapeEnum aShapeType = TopAbs_COMPOUND;
if (!TopAbs::ShapeTypeFromString (aVal.ToCString(), aShapeType))
{
- std::cout << "Syntax error: wrong command attribute value '" << aVal << "'\n";
+ Message::SendFail() << "Syntax error: wrong command attribute value '" << aVal << "'";
return 1;
}
}
else
{
- std::cout << "Syntax error: unknown argument '" << theArgv[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << theArgv[anArgIter] << "'";
return 1;
}
}
if (aView.IsNull()
|| aViewer.IsNull())
{
- std::cerr << "No active viewer!\n";
+ Message::SendFail ("Error: No active viewer!");
return 1;
}
Handle(AIS_InteractiveObject) anIObj;
if (!GetMapOfAIS().Find2 (aName, anIObj))
{
- std::cerr << "Use 'vdisplay' before\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (theArgNb < 2)
{
- std::cerr << theArgVec[0] << "Error: wrong number of arguments.\n";
+ Message::SendFail ("Syntax error: wrong number of arguments.");
return 1;
}
}
if (aShape.IsNull())
{
- std::cout << "Syntax error: presentation '" << aName << "' not found\n";
+ Message::SendFail() << "Syntax error: presentation '" << aName << "' not found";
return 1;
}
#include <ViewerTest_CmdParser.hxx>
#include <Draw.hxx>
+#include <Message.hxx>
#include <ViewerTest.hxx>
#include <algorithm>
}
else
{
- std::cerr << "Error: unknown argument '" << anOptionName << "'\n";
+ Message::SendFail() << "Error: unknown argument '" << anOptionName << "'";
return;
}
}
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;
}
#include <Font_BRepFont.hxx>
#include <Font_BRepTextBuilder.hxx>
#include <Font_FontMgr.hxx>
-
+#include <Message.hxx>
#include <NCollection_List.hxx>
#include <OSD_Chronometer.hxx>
if ((aMapOfArgs.IsBound ("xaxis") && !aMapOfArgs.IsBound ("zaxis"))
|| (!aMapOfArgs.IsBound ("xaxis") && aMapOfArgs.IsBound ("zaxis")))
{
- std::cout << "Syntax error: -xaxis and -zaxis parameters are to set together.\n";
+ Message::SendFail ("Syntax error: -xaxis and -zaxis parameters are to set together");
return Standard_False;
}
if (!aZDir.IsNormal (aXDir, M_PI / 180.0))
{
- std::cout << "Syntax error - parameters 'xaxis' and 'zaxis' are not applied as VectorX is not normal to VectorZ\n";
+ Message::SendFail ("Syntax error - parameters 'xaxis' and 'zaxis' are not applied as VectorX is not normal to VectorZ");
return Standard_False;
}
}
else if (aValues->Size() != 0)
{
- std::cout << "Syntax error: -hidelabels expects parameter 'on' or 'off' after.\n";
+ Message::SendFail ("Syntax error: -hidelabels expects parameter 'on' or 'off' after");
return Standard_False;
}
}
else if (aValues->Size() != 0)
{
- std::cout << "Syntax error: -hidearrows expects parameter 'on' or 'off' after.\n";
+ Message::SendFail ("Syntax error: -hidearrows expects parameter 'on' or 'off' after");
return Standard_False;
}
NCollection_List<Prs3d_DatumParts> aParts;
if (aValues->Size() < 2)
{
- std::cout << "Syntax error: -color wrong parameters.\n";
+ Message::SendFail ("Syntax error: -color wrong parameters");
return Standard_False;
}
Quantity_Color aColor;
if (!convertToColor (aValues, aColor))
{
- std::cout << "Syntax error: -color wrong parameters.\n";
+ Message::SendFail ("Syntax error: -color wrong parameters");
return Standard_False;
}
Quantity_Color aColor;
if (!convertToColor (aValues, aColor))
{
- std::cout << "Syntax error: -textcolor wrong parameters.\n";
+ Message::SendFail ("Syntax error: -textcolor wrong parameters");
return Standard_False;
}
theTrihedron->SetTextColor (aColor);
Quantity_Color aColor;
if (!convertToColor (aValues, aColor))
{
- std::cout << "Syntax error: -arrowcolor wrong parameters.\n";
+ Message::SendFail ("Syntax error: -arrowcolor wrong parameters");
return Standard_False;
}
theTrihedron->SetArrowColor (aColor);
NCollection_List<Prs3d_DatumAttribute> anAttributes;
if (aValues->Size() != 2)
{
- std::cout << "Syntax error: -attribute wrong parameters.\n";
+ Message::SendFail ("Syntax error: -attribute wrong parameters");
return Standard_False;
}
if (aValues->Size() < 2
|| !convertToDatumPart (aValues->Value (1), aDatumPart))
{
- std::cout << "Syntax error: -priority wrong parameters.\n";
+ Message::SendFail ("Syntax error: -priority wrong parameters");
return Standard_False;
}
theTrihedron->SetSelectionPriority (aDatumPart, aValues->Value (2).IntegerValue());
}
else
{
- std::cout << "Syntax error: -labels wrong parameters.\n";
+ Message::SendFail ("Syntax error: -labels wrong parameters");
return Standard_False;
}
}
if (aValues->Size() < 1
|| !convertToDatumAxes (aValues->Value (1), aDatumAxes))
{
- std::cout << "Syntax error: -drawaxes wrong parameters.\n";
+ Message::SendFail ("Syntax error: -drawaxes wrong parameters");
return Standard_False;
}
if (!theTrihedron->Attributes()->HasOwnDatumAspect())
{
if (theArgsNum != 2)
{
- std::cerr << theArgVec[0]<< " error.\n";
+ Message::SendFail() << "Syntax error: wrong number of arguments.";
return 1;
}
if (aShapes.Extent() != 1)
{
- std::cerr << "Error: wrong number of selected shapes.\n";
+ Message::SendFail ("Error: wrong number of selected shapes.");
return 1;
}
{
if (theArgsNb < 2)
{
- std::cout << "Syntax error: the wrong number of input parameters.\n";
+ Message::SendFail ("Syntax error: the wrong number of input parameters");
return 1;
}
aTrihedron = Handle(AIS_Trihedron)::DownCast (anObject);
if (aTrihedron.IsNull())
{
- std::cout << "Syntax error: no trihedron with this name.\n";
+ Message::SendFail ("Syntax error: no trihedron with this name");
return 1;
}
}
if (TheAISContext()->NbSelected() != 1)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
Handle(AIS_Plane) aPlane = Handle(AIS_Plane)::DownCast (aTest);
if (aPlane.IsNull())
{
- std::cerr << "Error: Selected shape is not a plane.\n";
+ Message::SendFail ("Error: Selected shape is not a plane.");
return 1;
}
if ( !strcasecmp(argv[0], "vaxis")) {
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;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wron number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
const TopoDS_Shape& aShapeB = aShapes.Last();
if (aShapeB.ShapeType() != TopAbs_VERTEX)
{
- std::cerr << "Syntax error: You should select two vertices or one edge.\n";
+ Message::SendFail ("Syntax error: You should select two vertices or one edge.");
return 1;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
if (!(aShapeA.ShapeType() == TopAbs_EDGE
&& aShapeB.ShapeType() == TopAbs_VERTEX))
{
- std::cerr << "Syntax error: You should select face and then vertex.\n";
+ Message::SendFail ("Syntax error: You should select face and then vertex.");
return 1;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
if (!(aShapeA.ShapeType() == TopAbs_EDGE
&& aShapeB.ShapeType() == TopAbs_VERTEX))
{
- std::cerr << "Syntax error: You should select face and then vertex.\n";
+ Message::SendFail ("Syntax error: You should select face and then vertex.");
return 1;
}
if (aShapes.Extent() != 1)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
- std::cerr << "\tYou should select one edge or vertex.\n";
+ Message::SendFail() << "Error: Wrong number of selected shapes.\n"
+ << "\tYou should select one edge or vertex.";
return 1;
}
// Verification
if (argc<2 || argc>6 )
{
- std::cout<<" Syntax error\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
if (argc == 6 || argc==5 || argc==4)
Handle(AIS_InteractiveObject) aShapeA;
if (!GetMapOfAIS().Find2 (argv[2], aShapeA))
{
- std::cout<<"vplane: error 1st name doesn't exist in the GetMapOfAIS()\n";
+ Message::SendFail ("Syntax error: 1st name is not displayed");
return 1;
}
Handle(AIS_InteractiveObject) aShapeB;
if (argc<5 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
{
- std::cout<<"vplane: error 2nd name doesn't exist in the GetMapOfAIS()\n";
+ Message::SendFail ("Syntax error: 2nd name is not displayed");
return 1;
}
// If B is not an AIS_Point
if (aShapeB.IsNull() ||
(!(aShapeB->Type()==AIS_KOI_Datum && aShapeB->Signature()==1)))
{
- std::cout<<"vplane: error 2nd object is expected to be an AIS_Point.\n";
+ Message::SendFail ("Syntax error: 2nd object is expected to be an AIS_Point");
return 1;
}
// The third object is an AIS_Point
Handle(AIS_InteractiveObject) aShapeC;
if (!GetMapOfAIS().Find2(argv[4], aShapeC))
{
- std::cout<<"vplane: error 3d name doesn't exist in the GetMapOfAIS().\n";
+ Message::SendFail ("Syntax error: 3d name is not displayed");
return 1;
}
// If C is not an AIS_Point
if (aShapeC.IsNull() ||
(!(aShapeC->Type()==AIS_KOI_Datum && aShapeC->Signature()==1)))
{
- std::cout<<"vplane: error 3d object is expected to be an AIS_Point.\n";
+ Message::SendFail ("Syntax error: 3d object is expected to be an AIS_Point");
return 1;
}
Abs(aCartPointB->Z()-aCartPointA->Z())<=Precision::Confusion())
{
// B=A
- std::cout<<"vplane error: same points\n";return 1;
+ Message::SendFail ("Error: same points");
+ return 1;
}
if(Abs(aCartPointC->X()-aCartPointA->X())<=Precision::Confusion() &&
Abs(aCartPointC->Y()-aCartPointA->Y())<=Precision::Confusion() &&
Abs(aCartPointC->Z()-aCartPointA->Z())<=Precision::Confusion())
{
// C=A
- std::cout<<"vplane error: same points\n";return 1;
+ Message::SendFail ("Error: same points");
+ return 1;
}
if(Abs(aCartPointC->X()-aCartPointB->X())<=Precision::Confusion() &&
Abs(aCartPointC->Y()-aCartPointB->Y())<=Precision::Confusion() &&
Abs(aCartPointC->Z()-aCartPointB->Z())<=Precision::Confusion())
{
// C=B
- std::cout<<"vplane error: same points\n";return 1;
+ Message::SendFail ("Error: same points");
+ return 1;
}
gp_Pnt A = aCartPointA->Pnt();
Standard_Integer aType = Draw::Atoi (argv[5]);
if (aType != 0 && aType != 1)
{
- std::cout << "vplane error: wrong type of sensitivity!\n"
- << "Should be one of the following values:\n"
- << "0 - Interior\n"
- << "1 - Boundary"
- << std::endl;
+ Message::SendFail("Syntax error: wrong type of sensitivity.\n"
+ "Should be one of the following values:\n"
+ "0 - Interior\n"
+ "1 - Boundary");
return 1;
}
else
Handle(AIS_InteractiveObject) aShapeB;
if (argc!=4 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
{
- std::cout<<"vplane: error 2d name doesn't exist in the GetMapOfAIS()\n";
+ Message::SendFail ("Syntax error: 2d name is not displayed");
return 1;
}
// If B is not an AIS_Point
if (aShapeB.IsNull() ||
(!(aShapeB->Type()==AIS_KOI_Datum && aShapeB->Signature()==1)))
{
- std::cout<<"vplane: error 2d object is expected to be an AIS_Point\n";
+ Message::SendFail ("Syntax error: 2d object is expected to be an AIS_Point");
return 1;
}
Standard_Integer aType = Draw::Atoi (argv[4]);
if (aType != 0 && aType != 1)
{
- std::cout << "vplane error: wrong type of sensitivity!\n"
- << "Should be one of the following values:\n"
- << "0 - Interior\n"
- << "1 - Boundary"
- << std::endl;
+ Message::SendFail ("Syntax error: wrong type of sensitivity!\n"
+ "Should be one of the following values:\n"
+ "0 - Interior\n"
+ "1 - Boundary");
return 1;
}
else
Handle(AIS_InteractiveObject) aShapeB;
if (argc!=4 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
{
- std::cout<<"vplane: error 2d name doesn't exist in the GetMapOfAIS()\n";
+ Message::SendFail ("Syntax error: 2d name is not displayed");
return 1;
}
// B should be an AIS_Point
if (aShapeB.IsNull() ||
(!(aShapeB->Type()==AIS_KOI_Datum && aShapeB->Signature()==1)))
{
- std::cout<<"vplane: error 2d object is expected to be an AIS_Point\n";
+ Message::SendFail ("Syntax error: 2d object is expected to be an AIS_Point");
return 1;
}
Standard_Integer aType = Draw::Atoi (argv[4]);
if (aType != 0 && aType != 1)
{
- std::cout << "vplane error: wrong type of sensitivity!\n"
- << "Should be one of the following values:\n"
- << "0 - Interior\n"
- << "1 - Boundary"
- << std::endl;
+ Message::SendFail ("Syntax error: wrong type of sensitivity!\n"
+ "Should be one of the following values:\n"
+ "0 - Interior\n"
+ "1 - Boundary");
return 1;
}
else
// Error
else
{
- std::cout<<"vplane: error 1st object is not an AIS\n";
+ Message::SendFail ("Syntax error: 1st object is not an AIS");
return 1;
}
}
{
if (aShapes.Extent() < 1 || aShapes.Extent() > 3)
{
- std::cerr << "Error: Wront number of selected shapes.\n";
- std::cerr << "\tYou should one of variant: face, edge and vertex or three vertices.\n";
+ Message::SendFail() << "Error: Wront number of selected shapes.\n"
+ << "\tYou should one of variant: face, edge and vertex or three vertices.";
return 1;
}
const TopoDS_Shape& aShapeB = aShapes.Last();
if (aShapeB.ShapeType() != TopAbs_EDGE)
{
- std::cerr << "Syntax error: Together with vertex should be edge.\n";
+ Message::SendFail ("Syntax error: Together with vertex should be edge.");
return 1;
}
if (OrthoProj.SquareDistance(1)<Precision::Approximation())
{
// The vertex is on the edge
- std::cout<<" vplane: error point is on the edge\n";
+ Message::SendFail ("Error: point is on the edge");
return 1;
}
else
if (!(aShapeB.ShapeType() == TopAbs_VERTEX
&& aShapeC.ShapeType() == TopAbs_VERTEX))
{
- std::cerr << "Syntax error: You should one of variant: face, edge and vertex or three vertices.\n";
+ Message::SendFail ("Syntax error: You should one of variant: face, edge and vertex or three vertices.");
return 1;
}
}
else
{
- std::cerr << "Syntax error: You should one of variant: face, edge and vertex or three vertices.\n";
+ Message::SendFail ("Syntax error: You should one of variant: face, edge and vertex or three vertices.");
return 1;
}
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: wrong number of selected shapes.\n";
+ Message::SendFail ("Error: wrong number of selected shapes.");
return 1;
}
const TopoDS_Shape& aShapeB = aShapes.Last();
if (aShapeB.ShapeType() != TopAbs_VERTEX)
{
- std::cerr << "Syntax error: Together with edge should be vertex.\n";
+ Message::SendFail ("Syntax error: Together with edge should be vertex.");
return 1;
}
if (OrthoProj.SquareDistance(1)<Precision::Approximation())
{
// The vertex is on the edge
- std::cout<<" vplane: error point is on the edge\n";
+ Message::SendFail ("Error point is on the edge");
return 1;
}
}
else
{
- std::cout<<" vplane: error\n";
+ Message::SendFail ("Error: surface is not Plane");
return 1;
}
}
else
{
- std::cerr << "Syntax error: You should one of variant: face, edge and vertex or three vertices.\n";
+ Message::SendFail ("Syntax error: You should one of variant: face, edge and vertex or three vertices");
return 1;
}
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
if (!(aShapeA->ShapeType() == TopAbs_VERTEX
&& aShapeB->ShapeType() == TopAbs_FACE))
{
- std::cerr << "Syntax error: you should select face and vertex.\n";
+ Message::SendFail ("Syntax error: you should select face and vertex.");
return 1;
}
}
else
{
- std::cerr << "Error: Builded surface is not a plane.\n";
+ Message::SendFail ("Error: Builded surface is not a plane.");
return 1;
}
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: wrong number of selected shapes.\n";
+ Message::SendFail ("Error: wrong number of selected shapes.");
return 1;
}
if (!(aShapeA->ShapeType() == TopAbs_EDGE
&& aShapeB->ShapeType() == TopAbs_FACE))
{
- std::cerr << "Error: you should select edge and face.\n";
+ Message::SendFail ("Error: you should select edge and face.");
return 1;
}
>Precision::Confusion())
{
// the edge is not parallel to the face
- std::cout<<" vplaneortho error: the edge is not parallel to the face\n";
+ Message::SendFail ("Error: the edge is not parallel to the face");
return 1;
}
// the edge is OK
}
else
{
- std::cout<<" vplaneortho: error\n";
+ Message::SendFail ("Error: surface is not Plane");
return 1;
}
}
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
- std::cout << theArgVec[0] << "AIS context is not available.\n";
+ Message::SendFail ("Error: no active viewer.");
return 1;
}
if (theArgsNb < 3 || theArgsNb > 11)
{
- std::cerr << theArgVec[0]
- << ": incorrect number of command arguments.\n"
- << "Type help for more information.\n";
+ Message::SendFail ("Syntax error: wrong number of arguments.");
return 1;
}
if ( aPlane.IsNull() )
{
- std::cout << theArgVec[0]
- << ": there is no interactive plane with the given name."
- << "Type help for more information.\n";
+ Message::SendFail() << "Syntax error: there is no interactive plane with the given name '" << aName << "'.";
return 1;
}
ViewerTest::GetSelectedShapes (aShapes);
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: wrong number of selected shapes.\n";
+ Message::SendFail ("Error: wrong number of selected shapes.");
return 1;
}
if (!(aShapeA.ShapeType() == TopAbs_VERTEX
&& aShapeB.ShapeType() == TopAbs_VERTEX))
{
- std::cerr << "Error: you should select two different vertex.\n";
+ Message::SendFail ("Error: you should select two different vertex.");
return 1;
}
// Verification of the arguments
if (argc>6 || argc<2)
{
- std::cout << "vcircle error: expect 4 arguments.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Syntax error: wrong number of arguments");
+ return 1;
}
// There are all arguments
{
if (theShapeB->Type()!=AIS_KOI_Datum || theShapeB->Signature()!=1 )
{
- std::cout << "vcircle error: 2d argument is unexpected to be a point.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: 2d argument is unexpected to be a point");
+ return 1;
}
// The third object must be a point
Handle(AIS_InteractiveObject) theShapeC;
if (theShapeC.IsNull() ||
theShapeC->Type()!=AIS_KOI_Datum || theShapeC->Signature()!=1 )
{
- std::cout << "vcircle error: 3d argument is unexpected to be a point.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: 3d argument is unexpected to be a point");
+ return 1;
}
// tag
// Verify that the three points are different
Abs(myCartPointA->Y()-myCartPointB->Y()) <= Precision::Confusion() &&
Abs(myCartPointA->Z()-myCartPointB->Z()) <= Precision::Confusion() )
{
- std::cout << "vcircle error: Same points.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: Same points");
+ return 1;
}
// Test A=C
if (Abs(myCartPointA->X()-myCartPointC->X()) <= Precision::Confusion() &&
Abs(myCartPointA->Y()-myCartPointC->Y()) <= Precision::Confusion() &&
Abs(myCartPointA->Z()-myCartPointC->Z()) <= Precision::Confusion() )
{
- std::cout << "vcircle error: Same points.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: Same points");
+ return 1;
}
// Test B=C
if (Abs(myCartPointB->X()-myCartPointC->X()) <= Precision::Confusion() &&
Abs(myCartPointB->Y()-myCartPointC->Y()) <= Precision::Confusion() &&
Abs(myCartPointB->Z()-myCartPointC->Z()) <= Precision::Confusion() )
{
- std::cout << "vcircle error: Same points.\n";
- return 1;// TCL_ERROR
+ Message::SendFail ("Error: Same points");
+ return 1;
}
// Construction of the circle
GC_MakeCircle Cir = GC_MakeCircle (myCartPointA->Pnt(),
}
catch (StdFail_NotDone const&)
{
- std::cout << "vcircle error: can't create circle\n";
- return -1; // TCL_ERROR
+ Message::SendFail ("Error: can't create circle");
+ return -1;
}
-
+
DisplayCircle(theGeomCircle, aName, isFilled);
}
if (theShapeB->Type() != AIS_KOI_Datum ||
theShapeB->Signature() != 1 )
{
- std::cout << "vcircle error: 2d element is a unexpected to be a point.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: 2d element is a unexpected to be a point");
+ return 1;
}
// Check that the radius is >= 0
if (Draw::Atof(argv[4]) <= 0 )
{
- std::cout << "vcircle error: the radius must be >=0.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Syntax error: the radius must be >=0");
+ return 1;
}
// Recover the normal to the plane
}
catch (StdFail_NotDone const&)
{
- std::cout << "vcircle error: can't create circle\n";
- return -1; // TCL_ERROR
+ Message::SendFail ("Error: can't create circle");
+ return -1;
}
DisplayCircle(theGeomCircle, aName, isFilled);
// Error
else
{
- std::cout << "vcircle error: 1st argument is a unexpected type.\n";
- return 1; // TCL_ERROR
+ Message::SendFail ("Error: 1st argument has an unexpected type");
+ return 1;
}
}
ViewerTest::GetSelectedShapes (aShapes);
if (aShapes.Extent() != 3 && aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes.");
return 1;
}
{
if (aShapes.Extent() != 3)
{
- std::cerr << "Error: wrong number of selected shapes.\n";
+ Message::SendFail ("Error: wrong number of selected shapes.");
return 1;
}
}
catch (StdFail_NotDone const&)
{
- std::cout << "vcircle error: can't create circle\n";
- return -1; // TCL_ERROR
+ Message::SendFail ("Error: can't create circle");
+ return -1;
}
DisplayCircle(theGeomCircle, aName, isFilled);
}
catch (StdFail_NotDone const&)
{
- std::cout << "vcircle error: can't create circle\n";
- return -1; // TCL_ERROR
+ Message::SendFail ("Error: can't create circle");
+ return -1;
}
DisplayCircle(theGeomCircle, aName, isFilled);
}
else
{
- std::cerr << "Error: You should select face and vertex or three vertices.\n";
+ Message::SendFail ("Error: You should select face and vertex or three vertices.");
return 1;
}
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (theArgsNb < 3)
{
- std::cout << "Error: wrong number of arguments! See usage:\n";
+ Message::SendFail ("Syntax error: wrong number of arguments. See usage:");
theDI.PrintHelp (theArgVec[0]);
return 1;
}
else if (aContext.IsNull())
{
- std::cout << "Error: no active view!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (anArgIt + 3 >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
aColor);
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << aParam << "'\n";
+ Message::SendFail() << "Syntax error at '" << aParam << "'";
return 1;
}
anArgIt += aNbParsed;
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error at '" << aParam << "'";
return 1;
}
}
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error at '" << aParam << "'";
return 1;
}
}
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
Font_FontAspect aFontAspect = Font_FA_Undefined;
if (!parseFontStyle (anOption, aFontAspect))
{
- std::cout << "Error: unknown font aspect '" << anOption << "'.\n";
+ Message::SendFail() << "Syntax error: unknown font aspect '" << anOption << "'";
return 1;
}
aTextPrs->SetFontAspect (aFontAspect);
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (anArgIt + 6 >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgsNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
TCollection_AsciiString aType (theArgVec[anArgIt]);
aDisplayType = Aspect_TODT_SHADOW;
else
{
- std::cout << "Error: wrong display type '" << aType << "'.\n";
+ Message::SendFail() << "Syntax error: wrong display type '" << aType << "'";
return 1;
}
}
aColor);
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << aParam << "'\n";
+ Message::SendFail() << "Syntax error at '" << aParam << "'";
return 1;
}
anArgIt += aNbParsed;
{
if (anArgIt + 2 >= theArgsNb)
{
- std::cerr << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'.";
return 1;
}
if (!aX.IsIntegerValue()
|| !aY.IsIntegerValue())
{
- std::cerr << "Error: wrong syntax at '" << aParam << "'.\n";
+ Message::SendFail() << "Error: wrong syntax at '" << aParam << "'.";
return 1;
}
if (anArgIt + 1 < theArgsNb)
}
else
{
- std::cout << "Error: unknown argument '" << aParam << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << aParam << "'";
return 1;
}
}
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
- std::cout << "Call vinit before!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
else if (argc < 3)
{
- std::cout << "Use: " << argv[0]
- << " shapeName Fineness [X=0.0 Y=0.0 Z=0.0] [Radius=100.0] [ToShowEdges=0]\n";
+ Message::SendFail() << "Syntax error: wrong number of arguments.\n"
+ << "Use: " << argv[0] << " shapeName Fineness [X=0.0 Y=0.0 Z=0.0] [Radius=100.0] [ToShowEdges=0]";
return 1;
}
}
else
{
- std::cout << "Syntax error: unknown algo type '" << anArgNext << "'\n";
+ Message::SendFail() << "Syntax error: unknown algo type '" << anArgNext << "'";
return 1;
}
}
BRepTools::Read (aSh, theArgVec[anArgIter], aBrepBuilder);
if (aSh.IsNull())
{
- std::cout << "Syntax error: no shape with name " << theArgVec[anArgIter] << " found\n";
+ Message::SendFail() << "Syntax error: no shape with name " << theArgVec[anArgIter] << " found";
return 1;
}
}
}
else
{
- std::cout << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'";
return 1;
}
}
if (aHlrName.IsEmpty() || aSh.IsNull()
|| (ViewerTest::GetAISContext().IsNull() && hasViewDirArg))
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
|| !myPArray->Attributes()->IsMutable()
|| (!myPArray->Indices().IsNull() && !myPArray->Indices()->IsMutable()))
{
- std::cout << "Syntax error: array cannot be patched\n";
+ Message::SendFail ("Syntax error: array cannot be patched");
return Standard_False;
}
// unknown command
else
{
- std::cout << "Syntax error: unknown argument '" << theDesc->Value(anArgIndex) << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << theDesc->Value(anArgIndex) << "'";
return Standard_False;
}
}
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
- std::cout << "Error: no active Viewer\n";
+ Message::SendFail ("Error: no active Viewer");
return 1;
}
else if (argc < 3)
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
Handle(Graphic3d_ArrayOfPrimitives) aTris = StdPrs_ShadedShape::FillTriangles (aShape);
if (aShape.IsNull())
{
- std::cout << "Syntax error: shape '" << aShapeName << "' is not found\n";
+ Message::SendFail() << "Syntax error: shape '" << aShapeName << "' is not found";
return 1;
}
else if (aTris.IsNull())
{
- std::cout << "Syntax error: shape '" << aShapeName << "' is not triangulated\n";
+ Message::SendFail() << "Syntax error: shape '" << aShapeName << "' is not triangulated";
return 1;
}
}
if (aPObject.IsNull())
{
- std::cout << "Syntax error: object '" << aName << "' cannot be found\n";
+ Message::SendFail() << "Syntax error: object '" << aName << "' cannot be found";
return 1;
}
}
}
if (aPrimType == Graphic3d_TOPA_UNDEFINED)
{
- std::cout << "Syntax error: unexpected type of primitives array\n";
+ Message::SendFail ("Syntax error: unexpected type of primitives array");
return 1;
}
ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
if (aContext.IsNull())
{
- std::cout << "Error: no active view!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
GetMapOfAIS().Find2 (aName, anObj);
if (anObj.IsNull())
{
- std::cout << "Error: object '" << aName << "' is not displayed!\n";
+ Message::SendFail() << "Error: object '" << aName << "' is not displayed";
return 1;
}
}
{
if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
GetMapOfAIS().Find2 (aName2, anObj2);
if (anObj2.IsNull())
{
- std::cout << "Error: object '" << aName2 << "' is not displayed!\n";
+ Message::SendFail() << "Error: object '" << aName2 << "' is not displayed";
return 1;
}
toPrintInfo = Standard_False;
if (anArgIter + 7 >= theArgNb)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
{
if (anArg == "-setscale")
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
toPrintInfo = Standard_False;
if (anArgIter + 6 >= theArgNb)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
else if (anArg == "-setrotation")
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
}
else if (anArg == "-setlocation")
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
Standard_Integer aNbParsed = parseTranslationVec (theArgNb - anArgIter, theArgVec + anArgIter, aLocVec);
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
anArgIter = anArgIter + aNbParsed - 1;
}
else
{
- std::cout << "Error: unknown argument '" << anArg << "'\n";
+ Message::SendFail() << "Error: unknown argument '" << anArg << "'";
return 1;
}
}
if (anObj.IsNull())
{
- std::cout << "Syntax error - wrong number of arguments\n";
+ Message::SendFail ("Syntax error - wrong number of arguments");
return 1;
}
else if (!toPrintInfo)
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "Error: no active view.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (argc < 6)
{
- std::cout << "Syntax error: expect at least 5 arguments\n";
+ Message::SendFail ("Syntax error: expect at least 5 arguments");
return 1;
}
Handle(AIS_InteractiveObject) anObject;
if (aName.IsEqual (anOriginObjectName))
{
- std::cout << "Syntax error: equal names for connected objects\n";
+ Message::SendFail ("Syntax error: equal names for connected objects");
continue;
}
TopoDS_Shape aTDShape = DBRep::Get (anOriginObjectName);
if (aTDShape.IsNull())
{
- std::cout << "Syntax error: object " << anOriginObjectName << " doesn't exist\n";
+ Message::SendFail() << "Syntax error: object " << anOriginObjectName << " doesn't exist";
return 1;
}
Handle(AIS_Shape) aShapePrs = new AIS_Shape (aTDShape);
}
if (aMultiConObject.IsNull())
{
- std::cout << "Syntax error: can't connect input objects\n";
+ Message::SendFail ("Syntax error: can't connect input objects");
return 1;
}
ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
if (aContext.IsNull())
{
- std::cout << "Error: no active view.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (argc != 6 && argc != 7)
{
- std::cout << "Syntax error: expect at least 5 arguments\n";
+ Message::SendFail ("Syntax error: expect at least 5 arguments");
return 1;
}
TCollection_AsciiString anOriginObjectName(argv[5]);
if (aName.IsEqual (anOriginObjectName))
{
- std::cout << "Syntax error: equal names for connected objects\n";
+ Message::SendFail ("Syntax error: equal names for connected objects");
return 1;
}
anOriginObject = findConnectedObject (anOriginObjectName);
TopoDS_Shape aTDShape = DBRep::Get (anOriginObjectName);
if (aTDShape.IsNull())
{
- std::cout << "Syntax error: object " << anOriginObjectName << " doesn't exist\n";
+ Message::SendFail() << "Syntax error: object " << anOriginObjectName << " doesn't exist";
return 1;
}
if (!anUpdateTool.parseRedrawMode (anArg))
{
- std::cout << "Syntax error: unknown argument '" << anArg << "'.\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << anArg << "'";
return 1;
}
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << argv[0] << "ERROR : use 'vinit' command before \n";
+ Message::SendFail( "Error: no active viewer");
return 1;
}
if (argc != 3)
{
- std::cout << "ERROR : Usage : " << argv[0] << " name object\n";
+ Message::SendFail() << "Syntax error: wrong number of arguments.\nUsage: " << argv[0] << " name object";
return 1;
}
Handle(AIS_MultipleConnectedInteractive) anAssembly;
if (!aMap.IsBound2 (aName) )
{
- std::cout << "Use 'vdisplay' before\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
else
{
- std::cout << "Use 'vdisplay' before\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "Error: no active view\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (argc != 6)
{
- std::cout << "Syntax error: expect 5 arguments\n";
+ Message::SendFail ("Syntax error: expect 5 arguments");
return 1;
}
anAssembly = Handle(AIS_MultipleConnectedInteractive)::DownCast (aPrs);
if (anAssembly.IsNull())
{
- std::cout << "Syntax error: '" << aName << "' is not an assembly\n";
+ Message::SendFail() << "Syntax error: '" << aName << "' is not an assembly";
return 1;
}
}
Handle(AIS_InteractiveObject) anIObj = findConnectedObject (anObjectName);
if (anIObj.IsNull())
{
- std::cout << "Syntax error: '" << anObjectName << "' is not displayed\n";
+ Message::SendFail() << "Syntax error: '" << anObjectName << "' is not displayed";
return 1;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << argv[0] << "ERROR : use 'vinit' command before \n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (argc != 2)
{
- std::cout << "ERROR : Usage : " << argv[0] << " name\n";
+ Message::SendFail() << "Syntax error: wrong number of arguments.\nUsage: " << argv[0] << " name";
return 1;
}
Handle(AIS_MultipleConnectedInteractive) anAssembly;
if (!aMap.IsBound2 (aName) )
{
- std::cout << "Use 'vdisplay' before\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
anAssembly = Handle(AIS_MultipleConnectedInteractive)::DownCast (aMap.Find2 (aName));
if (anAssembly.IsNull())
{
- std::cout << "Not an assembly\n";
+ Message::SendFail ("Syntax error: Not an assembly");
return 1;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "Error: no active view\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
Handle(AIS_InteractiveObject) aChild;
if (!GetMapOfAIS().Find2 (theArgVec[anArgIter], aChild))
{
- std::cout << "Syntax error: object '" << theArgVec[anArgIter] << "' is not found\n";
+ Message::SendFail() << "Syntax error: object '" << theArgVec[anArgIter] << "' is not found";
return 1;
}
}
else if (toAdd == -1)
{
- std::cout << "Syntax error: no action specified\n";
+ Message::SendFail ("Syntax error: no action specified");
return 1;
}
else
}
if (!hasActions)
{
- std::cout << "Syntax error: not enough arguments\n";
+ Message::SendFail ("Syntax error: not enough arguments");
return 1;
}
return 0;
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "Error: no active view\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (theNbArgs < 2 )
{
- std::cout << theArgVec[0] << " error: expect at least 2 arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
Handle(AIS_InteractiveObject) aParent;
if (!GetMapOfAIS().Find2(theArgVec[1], aParent))
{
- std::cout << "Syntax error: object '" << theArgVec[1] << "' is not found\n";
+ Message::SendFail() << "Syntax error: object '" << theArgVec[1] << "' is not found";
return 1;
}
Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
if (anAISContext.IsNull())
{
- std::cout << "Error: no active Viewer\n";
+ Message::SendFail ("Error: no active Viewer");
return 1;
}
if (anObjNames.Size() < 2
|| !ViewerTest::ParseOnOff (anObjNames.Last().ToCString(), toTurnOn))
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
anObjNames.Remove (anObjNames.Upper());
}
else
{
- std::cout << "Syntax error: unknown selection mode '" << aSelModeString << "'\n";
+ Message::SendFail() << "Syntax error: unknown selection mode '" << aSelModeString << "'";
return 1;
}
}
GetMapOfAIS().Find2 (aNameIO, anIO);
if (anIO.IsNull())
{
- std::cout << "Syntax error: undefined presentable object " << aNameIO << "\n";
+ Message::SendFail() << "Syntax error: undefined presentable object " << aNameIO;
return 1;
}
aTargetIOs.Append (anIO);
if (anAISContext.IsNull())
{
- std::cerr << "Call vinit before!" << std::endl;
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (anAISContext.IsNull())
{
- std::cerr << "Call vinit before!" << std::endl;
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (argc != (2 + aPrims->VertexNumberAllocated()))
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
if (aShape.IsNull()
|| aShape.ShapeType() != TopAbs_VERTEX)
{
- std::cout << "Syntax error: argument " << aName << " must be a point\n";
+ Message::SendFail() << "Syntax error: argument " << aName << " must be a point";
return 1;
}
aPnts[aPntIter] = BRep_Tool::Pnt (TopoDS::Vertex (aShape));
{
if (aPnts[aPnt2Iter].IsEqual (aPnts[aPntIter], Precision::Confusion()))
{
- std::cout << "Syntax error: points should not be equal\n";
+ Message::SendFail ("Syntax error: points should not be equal");
return 1;
}
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- di << argv[0] << "Call 'vinit' before!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
GetMapOfAIS().Find2 (aName, anInterObj);
if (anInterObj.IsNull())
{
- std::cout << "Syntax error: object '" << aName << "' is not displayed\n";
+ Message::SendFail() << "Syntax error: object '" << aName << "' is not displayed";
return 1;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << argv[0] << " Call 'vinit' before!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (argc > 2 && argc != 5)
{
- std::cout << "Usage : " << argv[0] << " [object [mode factor units]] - sets/gets polygon offset parameters for an object,"
- "without arguments prints the default values" << std::endl;
+ Message::SendFail() << "Syntax error: wrong number of arguments.\n"
+ "Usage: " << argv[0] << " [object [mode factor units]] - sets/gets polygon offset parameters for an object,"
+ "without arguments prints the default values";
return 1;
}
if (!GetMapOfAIS().Find2 (aName, anInterObj)
|| anInterObj.IsNull())
{
- std::cout << "Syntax error: object '" << aName << "' is not displayed\n";
+ Message::SendFail() << "Syntax error: object '" << aName << "' is not displayed";
return 1;
}
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cerr << "Call 'vinit' before!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (theArgNb < 5)
{
- std::cerr << "Usage :\n " << theArgVec[0]
- << "name X Y Z [PointsOnSide=10] [MarkerType=0] [Scale=1.0] [FileName=ImageFile]\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
}
else
{
- std::cerr << "Wrong argument: " << anArg << "\n";
+ Message::SendFail() << "Syntax error: wrong argument '" << anArg << "'";
return 1;
}
}
anImage = new Image_AlienPixMap();
if (!anImage->Load (aFileName))
{
- std::cerr << "Could not load image from file '" << aFileName << "'!\n";
+ Message::SendFail() << "Error: could not load image from file '" << aFileName << "'!";
return 1;
}
if (anImage->Format() == Image_Format_Gray)
// Check arguments
if (theArgNb < 3)
{
- std::cerr << "Error: " << theArgVec[0] << " - invalid syntax\n";
+ Message::SendFail() << "Error: " << theArgVec[0] << " - invalid syntax";
return 1;
}
{
if (anArgIt + 3 >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong syntax at '" << aParam << "'";
return 1;
}
}
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong syntax at '" << aParam << "'";
return 1;
}
}
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
anOption.LowerCase();
if (!parseFontStyle (anOption, aFontAspect))
{
- std::cout << "Error: unknown font aspect '" << anOption << "'.\n";
+ Message::SendFail() << "Error: unknown font aspect '" << anOption << "'";
return 1;
}
}
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (++anArgIt >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
{
if (anArgIt + 6 >= theArgNb)
{
- std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ Message::SendFail() << "Error: wrong number of values for parameter '" << aParam << "'";
return 1;
}
}
else
{
- std::cerr << "Warning! Unknown argument '" << aParam << "'\n";
+ Message::SendFail() << "Warning! Unknown argument '" << aParam << "'";
}
}
aFont.SetCompositeCurveMode (anIsCompositeCurve);
if (!aFont.FindAndInit (aFontName.ToCString(), aFontAspect, aTextHeight, aStrictLevel))
{
- std::cout << "Error: unable to load Font\n";
+ Message::SendFail ("Error: unable to load Font");
return 1;
}
}
else
{
- std::cout << "Error: font '" << aFontName << "' is not found!\n";
+ Message::SendFail() << "Error: font '" << aFontName << "' is not found";
}
}
else if (anArgIter + 1 < theArgNb
Handle(Font_SystemFont) aFont = aMgr->CheckFont (aFontPath);
if (aFont.IsNull())
{
- std::cerr << "Error: font '" << aFontPath << "' is not found!\n";
+ Message::SendFail() << "Error: font '" << aFontPath << "' is not found!";
continue;
}
}
else
{
- std::cerr << "Warning! Unknown argument '" << anArg << "'\n";
+ Message::SendFail() << "Warning! Unknown argument '" << anArg << "'";
}
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "Error: no view available, call 'vinit' before!" << std::endl;
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (theArgNum == 2)
{
- std::cout << "Error: '-set' option not followed by the mode and optional object name(s)" << std::endl;
- std::cout << "Type 'help vvertexmode' for usage hints" << std::endl;
+ Message::SendFail ("Error: '-set' option not followed by the mode and optional object name(s)\n"
+ "Type 'help vvertexmode' for usage hints");
return 1;
}
if (theArgNum > 2
|| !GetMapOfAIS().Find2 (aParam, anObject))
{
- std::cout << "Error: invalid number of arguments" << std::endl;
+ Message::SendFail ("Syntax error: invalid number of arguments");
return 1;
}
Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
if (anAISContext.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
case 2 : aCmd = CloudForShape; break;
case 7 : aCmd = CloudSphere; break;
default :
- std::cout << "Error: wrong number of arguments! See usage:\n";
+ Message::SendFail ("Syntax error: wrong number of arguments! See usage:");
theDI.PrintHelp (theArgs[0]);
return 1;
}
{
if (isSetArgNorm && hasNormals)
{
- std::cout << "Error: wrong syntax - normals can not be enabled with colors at the same time\n";
+ Message::SendFail ("Syntax error: normals can not be enabled with colors at the same time");
return 1;
}
toRandColors = Standard_True;
{
if (toRandColors)
{
- std::cout << "Error: wrong syntax - normals can not be enabled with colors at the same time\n";
+ Message::SendFail ("Syntax error: normals can not be enabled with colors at the same time");
return 1;
}
isSetArgNorm = Standard_True;
if (aShape.IsNull())
{
- std::cout << "Error: no shape with name '" << aShapeName << "' found\n";
+ Message::SendFail() << "Error: no shape with name '" << aShapeName << "' found";
return 1;
}
}
if (aNbPoints < 3)
{
- std::cout << "Error: shape should be triangulated!\n";
+ Message::SendFail ("Error: shape should be triangulated");
return 1;
}
aDistribution.LowerCase();
if ( aDistribution != "surface" && aDistribution != "volume" )
{
- std::cout << "Error: wrong arguments! See usage:\n";
+ Message::SendFail ("Syntax error: wrong arguments. See usage:");
theDI.PrintHelp (theArgs[0]);
return 1;
}
ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
if (aContext.IsNull())
{
- std::cout << "Error: no view available, call 'vinit' before!" << std::endl;
+ Message::SendFail ("Error: no active viewer");
return 1;
}
--aNbArgs;
if (aPriority < 0 || aPriority > 10)
{
- std::cout << "Error: the specified display priority value '" << aLastArg
- << "' is outside the valid range [0..10]" << std::endl;
+ Message::SendFail() << "Syntax error: the specified display priority value '" << aLastArg
+ << "' is outside the valid range [0..10]";
return 1;
}
}
if (aNbArgs < 2)
{
- std::cout << "Error: wrong number of arguments! See usage:\n";
+ Message::SendFail ("Syntax error: wrong number of arguments! See usage:");
theDI.PrintHelp (theArgs[0]);
return 1;
}
GetMapOfAIS().Find2 (aName, anIObj);
if (anIObj.IsNull())
{
- std::cout << "Error: the object '" << theArgs[1] << "' is not displayed" << std::endl;
+ Message::SendFail() << "Error: the object '" << theArgs[1] << "' is not displayed";
return 1;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "Error: no view available, call 'vinit' before!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
else if (theArgNum < 2)
{
- std::cout << "Error: wrong number of arguments! See usage:\n";
+ Message::SendFail ("Syntax error: wrong number of arguments. See usage:");
theDI.PrintHelp (theArgs[0]);
return 1;
}
Standard_Boolean isOn = Standard_True;
if (aShape.IsNull())
{
- std::cout << "Error: shape with name '" << aShapeName << "' is not found\n";
+ Message::SendFail() << "Error: shape with name '" << aShapeName << "' is not found";
return 1;
}
aLength = anArgIter < theArgNum ? Draw::Atof (theArgs[anArgIter]) : 0.0;
if (Abs (aLength) <= gp::Resolution())
{
- std::cout << "Syntax error: length should not be zero\n";
+ Message::SendFail ("Syntax error: length should not be zero");
return 1;
}
}
aNbAlongU = anArgIter < theArgNum ? Draw::Atoi (theArgs[anArgIter]) : 0;
if (aNbAlongU < 1)
{
- std::cout << "Syntax error: NbAlongU should be >=1\n";
+ Message::SendFail ("Syntax error: NbAlongU should be >=1");
return 1;
}
}
aNbAlongV = anArgIter < theArgNum ? Draw::Atoi (theArgs[anArgIter]) : 0;
if (aNbAlongV < 1)
{
- std::cout << "Syntax error: NbAlongV should be >=1\n";
+ Message::SendFail ("Syntax error: NbAlongV should be >=1");
return 1;
}
}
aNbAlongV = aNbAlongU;
if (aNbAlongU < 1)
{
- std::cout << "Syntax error: NbAlong should be >=1\n";
+ Message::SendFail ("Syntax error: NbAlong should be >=1");
return 1;
}
}
else
{
- std::cout << "Syntax error: unknwon argument '" << aParam << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << aParam << "'";
return 1;
}
}
} // 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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
else
{
- std::cerr << "Unknown key '" << aName.ToCString() << "'\n";
+ Message::SendFail() << "Syntax error: unknown key '" << aName.ToCString() << "'";
return 1;
}
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;
}
}
if (aGlCtx.IsNull())
{
- std::cout << "Error: no OpenGl_Context\n";
+ Message::SendFail ("Error: no OpenGl_Context");
return 1;
}
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"))
}
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;
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;
}
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;
}
}
else
{
- std::cerr << "Syntax error at '" << aPrimTypeStr << "'\n";
+ Message::SendFail() << "Syntax error at '" << aPrimTypeStr << "'";
return 1;
}
}
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);
}
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;
}
}
else
{
- std::cerr << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
}
else
{
- std::cout << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'";
return 1;
}
}
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"))
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;
}
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"
}
else if (!aDumpFile.IsEmpty())
{
- std::cout << "Syntax error: unknown output file format\n";
+ Message::SendFail ("Syntax error: unknown output file format");
return 1;
}
}
else
{
- std::cout << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'";
return 1;
}
}
}
else if (!aDumpFile.IsEmpty())
{
- std::cout << "Syntax error: unknown output file format\n";
+ Message::SendFail ("Syntax error: unknown output file format");
return 1;
}
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"
{
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;
}
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;
}
}
{
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;
}
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;
}
}
if (!aFile.good())
{
- std::cerr << "Error: unable to write to " << aFilePath << "\n";
+ Message::SendFail() << "Error: unable to write to " << aFilePath;
return 1;
}
#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>
{
if (!theShapeList)
{
- std::cerr << "Error: unknown parameter '" << aParam << "'\n";
+ Message::SendFail() << "Error: unknown 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;
}
{
if (!theShapeList)
{
- std::cerr << "Error: unknown parameter '" << aParam << "'\n";
+ Message::SendFail() << "Error: unknown parameter '" << aParam << "'";
return 1;
}
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);
{
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;
}
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;
}
}
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()));
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()));
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()));
}
else
{
- std::cerr << "Error: wrong plane '" << aValue << "'.\n";
+ Message::SendFail() << "Error: wrong plane '" << aValue << "'";
return 1;
}
}
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;
}
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;
}
}
else
{
- std::cerr << "Error: unknown parameter '" << aParam << "'.\n";
+ Message::SendFail() << "Error: unknown parameter '" << aParam << "'";
return 1;
}
}
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;
}
}
else
{
- std::cerr << "Error: unknown parameter '" << aParam << "'.\n";
+ Message::SendFail() << "Error: unknown parameter '" << aParam << "'.";
return 1;
}
}
}
else
{
- std::cerr << "Error: wrong angle type.\n";
+ Message::SendFail() << "Error: wrong angle type.";
}
anAngleDim->SetType(anAngleType);
}
}
else
{
- std::cerr << "Error: wrong showarrow type.\n";
+ Message::SendFail() << "Error: wrong showarrow type.";
}
anAngleDim->SetArrowsVisibility(anArrowType);
}
{
if (theArgsNb < 2)
{
- std::cerr << "Error: wrong number of arguments.\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
}
else
{
- std::cerr << "Error: wrong type of dimension.\n";
+ Message::SendFail ("Error: wrong type of dimension");
return 1;
}
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;
}
if (aShape1.IsNull() || aShape2.IsNull())
{
- 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;
}
// Vertex-Vertex case
}
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;
}
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;
}
}
}
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;
}
}
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;
}
}
else
{
- std::cout << "Error: shape for radius has wrong type.\n";
+ Message::SendFail ("Error: shape for radius has wrong type");
return 1;
}
break;
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());
}
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;
}
}
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;
}
}
// 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;
}
{
if (theArgsNb < 2)
{
- std::cerr << "Error: wrong number of arguments.\n";
+ Message::SendFail ("Error: wrong number of arguments");
return 1;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
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;
}
{
if (aShapes.Extent() != 4)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
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;
}
{
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;
}
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;
}
{
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;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
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;
}
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;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: wrong number of selected shapes.\n";
+ Message::SendFail ("Error: wrong number of selected shapes");
return 1;
}
if (!aDeltaEdge.IsParallel())
{
- std::cerr << "Error: the edges are not parallel.\n";
+ Message::SendFail ("Error: the edges are not parallel");
return 1;
}
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;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
{
if (aShapes.Extent() != 2)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
{
if (aShapes.Extent() != 3)
{
- std::cerr << "Error: Wrong number of selected shapes.\n";
+ Message::SendFail ("Error: Wrong number of selected shapes");
return 1;
}
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;
}
}
case PrsDim_KOR_NONE:
{
- std::cerr << "Error: Unknown type of relation!\n";
+ Message::SendFail ("Error: Unknown type of relation!");
return 1;
}
}
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;
}
{
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;
}
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;
}
{
if (anArgumentIt + 1 >= theArgNum)
{
- std::cout << "Error: "<< aParam <<" direction should have value.\n";
+ Message::SendFail() << "Error: "<< aParam <<" direction should have value";
return 1;
}
anArgumentIt++;
{
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
// 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));
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;
}
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;
}
}
else
{
- std::cout << "Syntax error: unknown argument " << anArg << ".\n";
+ Message::SendFail() << "Syntax error: unknown argument " << anArg;
return 1;
}
}
}
else
{
- std::cout << "Syntax error: unknown argument " << anArg << ".\n";
+ Message::SendFail() << "Syntax error: unknown argument " << anArg;
return 1;
}
}
if (!aDisplayName.IsEmpty())
{
aDisplayName.Clear();
- std::cout << "Warning: display parameter will be ignored.\n";
+ Message::SendWarning() << "Warning: display parameter will be ignored.\n";
}
#endif
const Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
if (aView.IsNull())
{
- std::cerr << "Error: No opened viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << argv[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << argv[anArgIter] << "'";
return 1;
}
}
const Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
if (aView.IsNull())
{
- std::cerr << "Error: No opened viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
TCollection_AsciiString aName (argv[anArgIter]);
if (!aMap.IsBound2 (aName))
{
- std::cout << "Syntax error: Wrong shape name '" << aName << "'.\n";
+ Message::SendFail() << "Syntax error: Wrong shape name '" << aName << "'";
return 1;
}
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (aMap.Find2 (aName));
if (aShape.IsNull())
{
- std::cout << "Syntax error: '" << aName << "' is not a shape presentation.\n";
+ Message::SendFail() << "Syntax error: '" << aName << "' is not a shape presentation";
return 1;
}
aListOfShapes.Append (aShape);
}
if (aTypeOfHLR == Prs3d_TOH_NotSet)
{
- std::cout << "Syntax error: wrong number of arguments!\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
{
if (!ViewerTest_myViews.IsBound1(theViewName))
{
- std::cout << "Wrong view name\n";
+ Message::SendFail() << "Wrong view name";
return;
}
ViewerTest_myContexts.UnBind2(aCurrentContext);
}
}
- std::cout << "3D View - " << theViewName << " was deleted.\n";
+ Message::SendInfo() << "3D View - " << theViewName << " was deleted.\n";
if (ViewerTest_EventManager::ToExitOnCloseView())
{
Draw_Interprete ("exit");
ViewerTest_Names aViewName (theArgVec[1]);
if (!ViewerTest_myViews.IsBound1 (aViewName.GetViewName()))
{
- std::cerr << "The view with name '" << theArgVec[1] << "' does not exist\n";
+ Message::SendFail() << "Error: the view with name '" << theArgVec[1] << "' does not exist";
return 1;
}
aViewList.Append (aViewName.GetViewName());
// close active view
if (ViewerTest::CurrentView().IsNull())
{
- std::cerr << "No active view!\n";
+ Message::SendFail ("Error: no active view");
return 1;
}
aViewList.Append (ViewerTest_myViews.Find2 (ViewerTest::CurrentView()));
}
else
{
- std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1;
}
}
}
else if (aNameString.IsEmpty())
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
const Handle(V3d_View)& aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cout << "Error: no active view\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
gp_Dir aRight, anUp;
if (aFrameDef.Value (2) == aFrameDef.Value (4))
{
- std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1;
}
}
if (!isGeneralCmd
&& theNbArgs != 1)
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
return 0;
}
if (aDispConn.IsNull())
{
- std::cerr << "Error: ViewerTest is unable processing messages for unknown X Display\n";
+ Message::SendFail ("Error: ViewerTest is unable processing messages for unknown X Display");
return;
}
const Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cout << "Error: no active viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
}
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cerr << theArgVec[0] << "Error: No active view.\n";
+ Message::SendFail ("Error: No active viewer");
return 1;
}
}
else
{
- std::cerr << theArgVec[0] << "Error: Invalid number of arguments.\n";
+ Message::SendFail ("Syntax error: Invalid number of arguments");
theDI.PrintHelp(theArgVec[0]);
return 1;
}
if (aDiagonal < Precision::Confusion())
{
- std::cerr << theArgVec[0] << "Error: view area is too small.\n";
+ Message::SendFail ("Error: view area is too small");
return 1;
}
if (aCurrentView.IsNull())
{
- std::cout << theArgVec[0] << ": Call vinit before this command, please.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cout << "Error: no active viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
if (theNbArgs < 4)
{
- std::cout << "Syntax error: Invalid number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cout << "Error: no active viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
}
else
{
- std::cerr << "Error: wrong syntax at '" << anArg << "' - unknown position '" << aPosName << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "' - unknown position '" << aPosName << "'";
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
}
else
{
- std::cerr << "Error: wrong syntax at '" << anArg << "' - unknown type '" << aTypeName << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "' - unknown type '" << aTypeName << "'";
}
}
else if (aFlag == "-scale")
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
aLabelsColor);
if (aNbParsed == 0)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
anArrowColorX);
if (aNbParsed == 0)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
anArrowColorY);
if (aNbParsed == 0)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
anArrowColorZ);
if (aNbParsed == 0)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
}
else
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cout << "No active view!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
hasFlags = Standard_True;
if (anArgIter + 2 >= theArgNb)
{
- std::cout << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
hasFlags = Standard_True;
if (anArgIter + 2 >= theArgNb)
{
- std::cout << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
else if (theArgNb != 4
&& theArgNb != 7)
{
- std::cout << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
}
return 0;
}
- std::cout << "Error: Invalid number of arguments\n";
+ Message::SendFail ("Error: Invalid number of arguments");
return 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cerr << theArgs[0] << "Error: no active view." << std::endl;
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (theArgNb != 3)
{
- std::cerr << theArgs[0] << "Error: invalid number of arguments." << std::endl;
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aContext.IsNull())
{
- std::cout << "Error: no active view!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (theArgNb <= 1)
{
- std::cout << "Error: wrong syntax at command '" << theArgVec[0] << "'!\n";
+ Message::SendFail() << "Error: wrong syntax at command '" << theArgVec[0] << "'";
return 1;
}
aColorScale = Handle(AIS_ColorScale)::DownCast (GetMapOfAIS().Find2 (theArgVec[1]));
if (aColorScale.IsNull())
{
- std::cout << "Error: object '" << theArgVec[1] << "'is already defined and is not a color scale!\n";
+ Message::SendFail() << "Error: object '" << theArgVec[1] << "'is already defined and is not a color scale";
return 1;
}
}
{
if (aColorScale.IsNull())
{
- std::cout << "Syntax error: colorscale with a given name does not exist.\n";
+ Message::SendFail() << "Syntax error: colorscale with a given name does not exist";
return 1;
}
{
if (anArgIter + 3 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Error: wrong syntax at argument '" << anArg << "'";
return 1;
}
if (!aRangeMin.IsRealValue()
|| !aRangeMax.IsRealValue())
{
- std::cout << "Error: the range values should be real!\n";
+ Message::SendFail ("Syntax error: the range values should be real");
return 1;
}
else if (!aNbIntervals.IsIntegerValue())
{
- std::cout << "Error: the number of intervals should be integer!\n";
+ Message::SendFail ("Syntax error: the number of intervals should be integer");
return 1;
}
{
if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
TCollection_AsciiString aFontArg(theArgVec[anArgIter + 1]);
if (!aFontArg.IsIntegerValue())
{
- std::cout << "Error: HeightFont value should be integer!\n";
+ Message::SendFail ("Syntax error: HeightFont value should be integer");
return 1;
}
{
if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
}
else
{
- std::cout << "Error: unknown position '" << aTextPosArg << "'!\n";
+ Message::SendFail() << "Syntax error: unknown position '" << aTextPosArg << "'";
return 1;
}
aColorScale->SetLabelPosition (aLabPosition);
{
if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Synta error at argument '" << anArg << "'";
return 1;
}
Standard_Boolean IsLog;
if (!ViewerTest::ParseOnOff(theArgVec[++anArgIter], IsLog))
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
aColorScale->SetLogarithmic (IsLog);
{
if (anArgIter + 2 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
if (aNbParsed1 == 0
|| aNbParsed2 == 0)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
{
if (anArgIter + 2 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
if (!anX.IsIntegerValue()
|| !anY.IsIntegerValue())
{
- std::cout << "Error: coordinates should be integer values!\n";
+ Message::SendFail ("Syntax error: coordinates should be integer values");
return 1;
}
{
if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const TCollection_AsciiString aBreadth (theArgVec[++anArgIter]);
if (!aBreadth.IsIntegerValue())
{
- std::cout << "Error: a width should be an integer value!\n";
+ Message::SendFail ("Syntax error: a width should be an integer value");
return 1;
}
aColorScale->SetBreadth (aBreadth.IntegerValue());
{
if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const TCollection_AsciiString aHeight (theArgVec[++anArgIter]);
if (!aHeight.IsIntegerValue())
{
- std::cout << "Error: a width should be an integer value!\n";
+ Message::SendFail ("Syntax error: a width should be an integer value");
return 1;
}
aColorScale->SetHeight (aHeight.IntegerValue());
{
if (aColorScale->GetColorType() != Aspect_TOCSD_USER)
{
- std::cout << "Error: wrong color type! Call -colors before to set user-specified colors!\n";
+ Message::SendFail ("Syntax error: wrong color type. Call -colors before to set user-specified colors");
return 1;
}
else if (anArgIter + 2 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const TCollection_AsciiString anInd (theArgVec[++anArgIter]);
if (!anInd.IsIntegerValue())
{
- std::cout << "Error: Index value should be integer!\n";
+ Message::SendFail ("Syntax error: Index value should be integer");
return 1;
}
const Standard_Integer anIndex = anInd.IntegerValue();
if (anIndex <= 0 || anIndex > aColorScale->GetNumberOfIntervals())
{
- std::cout << "Error: Index value should be within range 1.." << aColorScale->GetNumberOfIntervals() <<"!\n";
+ Message::SendFail() << "Syntax error: Index value should be within range 1.." << aColorScale->GetNumberOfIntervals();
return 1;
}
aColor);
if (aNbParsed == 0)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
aColorScale->SetIntervalColor (aColor, anIndex);
{
if (aColorScale->GetColorType() != Aspect_TOCSD_USER)
{
- std::cout << "Error: wrong label type! Call -labels before to set user-specified labels!\n";
+ Message::SendFail ("Syntax error: wrong label type. Call -labels before to set user-specified labels");
return 1;
}
else if (anArgIter + 2 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
Standard_Integer anIndex = Draw::Atoi (theArgVec[anArgIter + 1]);
if (anIndex <= 0 || anIndex > aColorScale->GetNumberOfIntervals() + 1)
{
- std::cout << "Error: Index value should be within range 1.." << aColorScale->GetNumberOfIntervals() + 1 <<"!\n";
+ Message::SendFail() << "Syntax error: Index value should be within range 1.." << (aColorScale->GetNumberOfIntervals() + 1);
return 1;
}
}
if (aLabAtBorder == -1)
{
- std::cout << "Syntax error at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
toEnable = (aLabAtBorder == 1);
}
if (aSeq.Length() != aColorScale->GetNumberOfIntervals())
{
- std::cout << "Error: not enough arguments! You should provide color names or RGB color values for every interval of the "
- << aColorScale->GetNumberOfIntervals() << " intervals\n";
+ Message::SendFail() << "Error: not enough arguments! You should provide color names or RGB color values for every interval of the "
+ << aColorScale->GetNumberOfIntervals() << " intervals";
return 1;
}
{
if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Syntax error at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
}
if (anArgIter + aNbLabels >= theArgNb)
{
- std::cout << "Error: not enough arguments! " << aNbLabels << " text labels are expected.\n";
+ Message::SendFail() << "Syntax error: not enough arguments. " << aNbLabels << " text labels are expected";
return 1;
}
{
if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
{
if (anArgIter + 1 >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
if (!anArg1.IsRealValue())
{
- std::cout << "Error: the value should be real!\n";
+ Message::SendFail ("Syntax error: the value should be real");
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at " << anArg << " - unknown argument!\n";
+ Message::SendFail() << "Syntax error at " << anArg << " - unknown argument";
return 1;
}
}
{
if (theArgNum < 2)
{
- std::cout << theArgs[0] << " error: wrong number of parameters. Type 'help"
- << theArgs[0] <<"' for more information.\n";
- return 1; //TCL_ERROR
+ Message::SendFail() << "Syntax error: wrong number of parameters. Type 'help"
+ << theArgs[0] <<"' for more information";
+ return 1;
}
NCollection_DataMap<TCollection_AsciiString, Handle(TColStd_HSequenceOfAsciiString)> aMapOfArgs;
aLowerKey = "-";
aLowerKey += aKey;
aLowerKey.LowerCase();
- std::cout << theArgs[0] << ": " << aLowerKey << " is unknown option, or the arguments are unacceptable.\n";
- std::cout << "Type help for more information.\n";
+ Message::SendFail() << "Syntax error: " << aLowerKey << " is unknown option, or the arguments are unacceptable.\n"
+ << "Type help for more information";
return 1;
}
Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
if (anAISContext.IsNull())
{
- std::cout << theArgs[0] << ": please use 'vinit' command to initialize view.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (!GetColor (aValues->Value(1), aColor))
{
- std::cout << theArgs[0] << "error: -xnamecolor wrong color name.\n";
+ Message::SendFail ("Syntax error: -xnamecolor wrong color name");
return 1;
}
aTrihedronData.ChangeXAxisAspect().SetNameColor (aColor);
{
if (!GetColor (aValues->Value(1), aColor))
{
- std::cout << theArgs[0] << "error: -ynamecolor wrong color name.\n";
+ Message::SendFail ("Syntax error: -ynamecolor wrong color name");
return 1;
}
aTrihedronData.ChangeYAxisAspect().SetNameColor (aColor);
{
if (!GetColor (aValues->Value(1), aColor))
{
- std::cout << theArgs[0] << "error: -znamecolor wrong color name.\n";
+ Message::SendFail ("Syntax error: -znamecolor wrong color name");
return 1;
}
aTrihedronData.ChangeZAxisAspect().SetNameColor (aColor);
{
if (!GetColor (aValues->Value(1), aColor))
{
- std::cout << theArgs[0] << "error: -xcolor wrong color name.\n";
+ Message::SendFail ("Syntax error: -xcolor wrong color name");
return 1;
}
aTrihedronData.ChangeXAxisAspect().SetColor (aColor);
{
if (!GetColor (aValues->Value(1), aColor))
{
- std::cout << theArgs[0] << "error: -ycolor wrong color name.\n";
+ Message::SendFail ("Syntax error: -ycolor wrong color name");
return 1;
}
aTrihedronData.ChangeYAxisAspect().SetColor (aColor);
{
if (!GetColor (aValues->Value(1), aColor))
{
- std::cout << theArgs[0] << "error: -zcolor wrong color name.\n";
+ Message::SendFail ("Syntax error: -zcolor wrong color name");
return 1;
}
aTrihedronData.ChangeZAxisAspect().SetColor (aColor);
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cerr << "Error: no active viewer.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (anArgIter + 3 < theArgNb)
{
- std::cerr << "Syntax error at '" << theArgVec[anArgIter] << "'.\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1;
}
aTile.IsTopDown = (anArg == "-upperleft") == Standard_True;
{
if (anArgIter + 3 < theArgNb)
{
- std::cerr << "Syntax error at '" << theArgVec[anArgIter] << "'.\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1;
}
aTile.TotalSize.x() = Draw::Atoi (theArgVec[anArgIter + 1]);
if (aTile.TotalSize.x() < 1
|| aTile.TotalSize.y() < 1)
{
- std::cerr << "Error: total size is incorrect.\n";
+ Message::SendFail ("Error: total size is incorrect");
return 1;
}
}
{
if (anArgIter + 3 < theArgNb)
{
- std::cerr << "Syntax error at '" << theArgVec[anArgIter] << "'.\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1;
}
if (aTile.TileSize.x() < 1
|| aTile.TileSize.y() < 1)
{
- std::cerr << "Error: tile size is incorrect.\n";
+ Message::SendFail ("Error: tile size is incorrect");
return 1;
}
}
if (aTile.TileSize.x() < 1
|| aTile.TileSize.y() < 1)
{
- std::cerr << "Error: tile size is undefined.\n";
+ Message::SendFail ("Error: tile size is undefined");
return 1;
}
else if (aTile.TotalSize.x() < 1
|| aTile.TotalSize.y() < 1)
{
- std::cerr << "Error: total size is undefined.\n";
+ Message::SendFail ("Error: total size is undefined");
return 1;
}
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
- std::cout << "No active viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
aLayerId = Graphic3d_ZLayerId_UNKNOWN;
if (!aViewer->AddZLayer (aLayerId))
{
- std::cout << "Error: can not add a new z layer!\n";
+ Message::SendFail ("Error: can not add a new z layer");
return 0;
}
aLayerId = Graphic3d_ZLayerId_UNKNOWN;
if (!aViewer->InsertLayerBefore (aLayerId, Graphic3d_ZLayerSettings(), anOtherLayerId))
{
- std::cout << "Error: can not add a new z layer!\n";
+ Message::SendFail ("Error: can not add a new z layer");
return 0;
}
aLayerId = Graphic3d_ZLayerId_UNKNOWN;
if (!aViewer->InsertLayerAfter (aLayerId, Graphic3d_ZLayerSettings(), anOtherLayerId))
{
- std::cout << "Error: can not add a new z layer!\n";
+ Message::SendFail ("Error: can not add a new z layer");
return 0;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error: id of z layer to remove is missing\n";
+ Message::SendFail ("Syntax error: id of z layer to remove is missing");
return 1;
}
|| aLayerId == Graphic3d_ZLayerId_TopOSD
|| aLayerId == Graphic3d_ZLayerId_BotOSD)
{
- std::cout << "Syntax error: standard Z layer can not be removed\n";
+ Message::SendFail ("Syntax error: standard Z layer can not be removed");
return 1;
}
if (!aViewer->RemoveZLayer (aLayerId))
{
- std::cout << "Z layer can not be removed!\n";
+ Message::SendFail ("Z layer can not be removed");
}
else
{
{
if (aLayerId == Graphic3d_ZLayerId_UNKNOWN)
{
- std::cout << "Syntax error: id of Z layer is missing\n";
+ Message::SendFail ("Syntax error: id of Z layer is missing");
return 1;
}
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error: name is missing\n";
+ Message::SendFail ("Syntax error: name is missing");
return 1;
}
{
if (aLayerId == Graphic3d_ZLayerId_UNKNOWN)
{
- std::cout << "Syntax error: id of Z layer is missing\n";
+ Message::SendFail ("Syntax error: id of Z layer is missing");
return 1;
}
if (anArgIter + 2 >= theArgNb)
{
- std::cout << "Syntax error: origin coordinates are missing\n";
+ Message::SendFail ("Syntax error: origin coordinates are missing");
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error: id of Z layer is missing\n";
+ Message::SendFail ("Syntax error: id of Z layer is missing");
return 1;
}
|| anArg == "enable";
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error: option name is missing\n";
+ Message::SendFail ("Syntax error: option name is missing");
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error: id of Z layer is missing\n";
+ Message::SendFail ("Syntax error: id of Z layer is missing");
return 1;
}
{
if (anArgIter + 2 >= theArgNb)
{
- std::cout << "Syntax error: factor and units values for depth offset are missing\n";
+ Message::SendFail ("Syntax error: factor and units values for depth offset are missing");
return 1;
}
}
else
{
- std::cout << "Syntax error: unknown option " << theArgVec[anArgIter] << "\n";
+ Message::SendFail() << "Syntax error: unknown option " << theArgVec[anArgIter];
return 1;
}
}
if (argc > 6
&& !ViewerTest::ParseLineType (argv[6], aLineType))
{
- std::cout << "Syntax error: unknown line type '" << argv[6] << "'\n";
+ Message::SendFail() << "Syntax error: unknown line type '" << argv[6] << "'";
return 1;
}
Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
if (aView.IsNull() || aViewer.IsNull())
{
- std::cerr << "Error: no active view\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << anArgNext << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArgNext << "'";
return 1;
}
}
}
else
{
- std::cout << "Syntax error at '" << anArgNext << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArgNext << "'";
return 1;
}
}
if (aNewStepXY.x() <= 0.0
|| aNewStepXY.y() <= 0.0)
{
- std::cout << "Syntax error: wrong step '" << theArgVec[anArgIter + 1] << " " << theArgVec[anArgIter + 2] << "'\n";
+ Message::SendFail() << "Syntax error: wrong step '" << theArgVec[anArgIter + 1] << " " << theArgVec[anArgIter + 2] << "'";
return 1;
}
anArgIter += 2;
aNewSizeXY.SetValues (Draw::Atof (theArgVec[anArgIter]), 0.0);
if (aNewStepXY.x() <= 0.0)
{
- std::cout << "Syntax error: wrong size '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: wrong size '" << theArgVec[anArgIter] << "'";
return 1;
}
}
if (aNewStepXY.x() <= 0.0
|| aNewStepXY.y() <= 0.0)
{
- std::cout << "Syntax error: wrong size '" << theArgVec[anArgIter + 1] << " " << theArgVec[anArgIter + 2] << "'\n";
+ Message::SendFail() << "Syntax error: wrong size '" << theArgVec[anArgIter + 1] << " " << theArgVec[anArgIter + 2] << "'";
return 1;
}
anArgIter += 2;
}
else
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
aDivisionNumber = (int )aNewStepXY[1];
if (aDivisionNumber < 1)
{
- std::cout << "Syntax error: invalid division number '" << aNewStepXY[1] << "'\n";
+ Message::SendFail() << "Syntax error: invalid division number '" << aNewStepXY[1] << "'";
return 1;
}
}
aRadius = aNewSizeXY.x();
if (aNewSizeXY.y() != 0.0)
{
- std::cout << "Syntax error: circular size should be specified as radius\n";
+ Message::SendFail ("Syntax error: circular size should be specified as radius");
return 1;
}
}
{
if (theArgNb != 1 && theArgNb != 7 && theArgNb != 10)
{
- std::cerr << "Error: wrong number of arguments! See usage:\n";
+ Message::SendFail ("Error: wrong number of arguments! See usage:");
theDI.PrintHelp (theArgVec[0]);
return 1;
}
Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
if (aViewer.IsNull())
{
- std::cerr << "Error: no active viewer. Please call vinit.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cerr << "Error: no active view. Please call vinit.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
// non-numeric argument too early
if (aCoord.IsEmpty())
{
- std::cerr << "Error: wrong number of arguments! See usage:\n";
+ Message::SendFail ("Error: wrong number of arguments! See usage:");
theDI.PrintHelp (theArgVec[0]);
return 1;
}
else if (anArg == "ray") aMode = Ray;
else
{
- std::cerr << "Error: wrong argument " << anArg << "! See usage:\n";
+ Message::SendFail() << "Error: wrong argument " << anArg << "! See usage:";
theDI.PrintHelp (theArgVec[0]);
return 1;
}
(aCoord.Length() == 2 && theArgNb > 4) ||
(aCoord.Length() == 3 && theArgNb > 5))
{
- std::cerr << "Error: wrong number of arguments! See usage:\n";
+ Message::SendFail ("Error: wrong number of arguments! See usage:");
theDI.PrintHelp (theArgVec[0]);
return 1;
}
case View : theDI << "View Vv: " << aView->Convert ((Standard_Integer)aCoord (1)); return 0;
case Window : theDI << "Window Vp: " << aView->Convert (aCoord (1)); return 0;
default:
- std::cerr << "Error: wrong arguments! See usage:\n";
+ Message::SendFail ("Error: wrong arguments! See usage:");
theDI.PrintHelp (theArgVec[0]);
return 1;
}
return 0;
default:
- std::cerr << "Error: wrong arguments! See usage:\n";
+ Message::SendFail ("Error: wrong arguments! See usage:");
theDI.PrintHelp (theArgVec[0]);
return 1;
}
return 0;
default:
- std::cerr << "Error: wrong arguments! See usage:\n";
+ Message::SendFail ("Error: wrong arguments! See usage:");
theDI.PrintHelp (theArgVec[0]);
return 1;
}
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;
}
aFramesNb = anArg.IntegerValue();
if (aFramesNb <= 0)
{
- std::cerr << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
else
{
- std::cerr << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
}
else
{
- std::cout << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
{
if (!toSet)
{
- std::cerr << "No active view!\n";
+ Message::SendFail ("Error: no active viewer");
}
return 1;
}
if (aVer[0] < -1
|| aVer[1] < -1)
{
- std::cout << "Syntax error at '" << anArgCase << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArgCase << "'";
return 1;
}
aCaps->contextMajorVersionUpper = aVer[0];
}
else
{
- std::cout << "Error: unknown argument '" << anArg << "'\n";
+ Message::SendFail() << "Error: unknown argument '" << anArg << "'";
return 1;
}
}
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;
}
TCollection_AsciiString anInfo;
if (!aDriver->MemoryInfo (aFreeBytes, anInfo))
{
- std::cerr << "Information not available.\n";
+ Message::SendFail ("Error: information not available");
return 1;
}
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;
}
else if (theArgNb < 3)
{
- std::cerr << "Usage : " << theArgVec[0] << " xPixel yPixel [{rgb|rgba|depth|hls|rgbf|rgbaf}=rgba] [name]\n";
+ Message::SendFail() << "Syntax error: wrong number of arguments.\n"
+ << "Usage: " << theArgVec[0] << " xPixel yPixel [{rgb|rgba|depth|hls|rgbf|rgbaf}=rgba] [name]";
return 1;
}
const Standard_Integer anY = Draw::Atoi (theArgVec[2]);
if (anX < 0 || anX >= aWidth || anY < 0 || anY > aHeight)
{
- std::cerr << "Pixel coordinates (" << anX << "; " << anY << ") are out of view (" << aWidth << " x " << aHeight << ")\n";
+ Message::SendFail() << "Error: pixel coordinates (" << anX << "; " << anY << ") are out of view (" << aWidth << " x " << aHeight << ")";
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << aParam << "'\n";
+ Message::SendFail() << "Syntax error at '" << aParam << "'";
return 1;
}
}
Image_PixMap anImage;
if (!anImage.InitTrash (aFormat, aWidth, aHeight))
{
- std::cerr << "Image allocation failed\n";
+ Message::SendFail ("Error: image allocation failed");
return 1;
}
else if (!aView->ToPixMap (anImage, aWidth, aHeight, aBufferType))
{
- std::cerr << "Image dump failed\n";
+ Message::SendFail ("Error: image dump failed");
return 1;
}
{
if (theArgNb < 3)
{
- std::cout << "Syntax error: not enough arguments.\n";
+ Message::SendFail ("Syntax error: not enough arguments");
return 1;
}
aTolColor = Atof (theArgVec[++anArgIter]);
if (aTolColor < 0.0 || aTolColor > 1.0)
{
- std::cout << "Syntax error at '" << anArg << " " << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << " " << theArgVec[anArgIter] << "'";
return 1;
}
}
aTolColor = anArg.RealValue();
if (aTolColor < 0.0 || aTolColor > 1.0)
{
- std::cout << "Syntax error at '" << anArg << " " << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << " " << theArgVec[anArgIter] << "'";
return 1;
}
}
}
else
{
- std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1;
}
}
Handle(Image_AlienPixMap) anImgNew = new Image_AlienPixMap();
if (!anImgRef->Load (anImgPathRef))
{
- std::cout << "Error: image file '" << anImgPathRef << "' cannot be read\n";
+ Message::SendFail() << "Error: image file '" << anImgPathRef << "' cannot be read";
return 1;
}
if (!anImgNew->Load (anImgPathNew))
{
- std::cout << "Error: image file '" << anImgPathNew << "' cannot be read\n";
+ Message::SendFail() << "Error: image file '" << anImgPathNew << "' cannot be read";
return 1;
}
aDiff = new Image_AlienPixMap();
if (!aDiff->InitTrash (Image_Format_Gray, anImgRef->SizeX(), anImgRef->SizeY()))
{
- std::cout << "Error: cannot allocate memory for diff image " << anImgRef->SizeX() << "x" << anImgRef->SizeY() << "\n";
+ Message::SendFail() << "Error: cannot allocate memory for diff image " << anImgRef->SizeX() << "x" << anImgRef->SizeY();
return 1;
}
aComparer.SaveDiffImage (*aDiff);
if (!aDiffImagePath.IsEmpty()
&& !aDiff->Save (aDiffImagePath))
{
- std::cout << "Error: diff image file '" << aDiffImagePath << "' cannot be written\n";
+ Message::SendFail() << "Error: diff image file '" << aDiffImagePath << "' cannot be written";
return 1;
}
}
const 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
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
const Handle(V3d_View)& aView = ViewerTest::CurrentView();
if (aContext.IsNull())
{
- std::cout << "Error: no active View\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (anArgIter + 1 < theNbArgs)
{
- std::cout << "Syntax error at '" << theArgVec[anArgIter + 1] << "'\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter + 1] << "'";
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1;
}
}
if (aMousePos.x() == IntegerLast()
|| aMousePos.y() == IntegerLast())
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cout << theArgVec[0] << ": please initialize or activate view.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
Handle(ViewerTest_V3dView) aV3dView = Handle(ViewerTest_V3dView)::DownCast (ViewerTest::CurrentView());
if (aV3dView.IsNull())
{
- std::cout << "Error: no active view.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
for (Standard_Integer anArgIt = 1; anArgIt < theArgsNb; ++anArgIt)
TCollection_AsciiString aViewName = aViewNames.GetViewName();
if (!ViewerTest_myViews.IsBound1 (aViewName))
{
- std::cout << "Syntax error: unknown view '" << theArgVec[anArgIt - 1] << "'.\n";
+ Message::SendFail() << "Syntax error: unknown view '" << theArgVec[anArgIt - 1] << "'";
return 1;
}
aV3dView = Handle(ViewerTest_V3dView)::DownCast (ViewerTest_myViews.Find1 (aViewName));
}
else
{
- std::cout << "Syntax error: unknown argument " << anArg << ".\n";
+ Message::SendFail() << "Syntax error: unknown argument " << anArg;
return 1;
}
}
}
if (aCtx.IsNull())
{
- std::cout << "Error: no active view\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
TCollection_AsciiString aNameArg (theArgVec[anArgIter++]);
if (aNameArg.IsEmpty())
{
- std::cout << "Syntax error: animation name is not defined.\n";
+ Message::SendFail ("Syntax error: animation name is not defined");
return 1;
}
}
else if (aNameArg.Value (1) == '-')
{
- std::cout << "Syntax error: invalid animation name '" << aNameArg << "'.\n";
+ Message::SendFail() << "Syntax error: invalid animation name '" << aNameArg << "'";
return 1;
}
{
if (aSplitPos == aNameArg.Length())
{
- std::cout << "Syntax error: animation name is not defined.\n";
+ Message::SendFail ("Syntax error: animation name is not defined");
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg << "";
return 1;
}
aPlaySpeed = Draw::Atof (theArgVec[anArgIter]);
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
aRecParams.FpsDen = aDenStr.IntegerValue();
if (aRecParams.FpsDen < 1)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
aRecParams.Format = theArgVec[anArgIter];
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
aRecParams.PixelFormat = theArgVec[anArgIter];
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
aRecParams.VideoCodec = theArgVec[anArgIter];
const TCollection_AsciiString aParamName = anArg.SubString (2, anArg.Length());
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
Handle(AIS_InteractiveObject) anObject;
if (!aMapOfAIS.Find2 (anObjName, anObject))
{
- std::cout << "Syntax error: wrong object name at " << anArg << "\n";
+ Message::SendFail() << "Syntax error: wrong object name at " << anArg;
return 1;
}
if (aTrsfArgIter + 4 >= theArgNb
|| !parseQuaternion (theArgVec + aTrsfArgIter + 1, aRotQuats[anIndex]))
{
- std::cout << "Syntax error at " << aTrsfArg << ".\n";
+ Message::SendFail() << "Syntax error at " << aTrsfArg;
return 1;
}
aTrsfArgIter += 4;
if (aTrsfArgIter + 3 >= theArgNb
|| !parseXYZ (theArgVec + aTrsfArgIter + 1, aLocPnts[anIndex]))
{
- std::cout << "Syntax error at " << aTrsfArg << ".\n";
+ Message::SendFail() << "Syntax error at " << aTrsfArg;
return 1;
}
aTrsfArgIter += 3;
isTrsfSet = Standard_True;
if (++aTrsfArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << aTrsfArg << ".\n";
+ Message::SendFail() << "Syntax error at " << aTrsfArg;
return 1;
}
const TCollection_AsciiString aScaleStr (theArgVec[aTrsfArgIter]);
if (!aScaleStr.IsRealValue())
{
- std::cout << "Syntax error at " << aTrsfArg << ".\n";
+ Message::SendFail() << "Syntax error at " << aTrsfArg;
return 1;
}
aScales[anIndex] = aScaleStr.RealValue();
}
if (!isTrsfSet)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
else if (aTrsfArgIter >= theArgNb)
isTrsfSet = Standard_True;
if (++aViewArgIter >= theArgNb)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
const TCollection_AsciiString aScaleStr (theArgVec[aViewArgIter]);
if (!aScaleStr.IsRealValue())
{
- std::cout << "Syntax error at " << aViewArg << ".\n";
+ Message::SendFail() << "Syntax error at " << aViewArg;
return 1;
}
Standard_Real aScale = aScaleStr.RealValue();
if (aViewArgIter + 3 >= theArgNb
|| !parseXYZ (theArgVec + aViewArgIter + 1, anXYZ))
{
- std::cout << "Syntax error at " << aViewArg << ".\n";
+ Message::SendFail() << "Syntax error at " << aViewArg;
return 1;
}
aViewArgIter += 3;
}
if (!isTrsfSet)
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
else if (aViewArgIter >= theArgNb)
}
else
{
- std::cout << "Syntax error at " << anArg << ".\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
}
aRecorder = new Image_VideoRecorder();
if (!aRecorder->Open (aRecFile.ToCString(), aRecParams))
{
- std::cout << "Error: failed to open video file for recording\n";
+ Message::SendFail ("Error: failed to open video file for recording");
return 0;
}
aDumpParams.ToAdjustAspect = Standard_True;
if (!aView->ToPixMap (aRecorder->ChangeFrame(), aDumpParams))
{
- std::cout << "Error: view dump is failed!\n";
+ Message::SendFail ("Error: view dump is failed");
return 0;
}
aFlipper.FlipY (aRecorder->ChangeFrame());
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;
}
if (!isOk)
{
- std::cerr << "Usage :" << std::endl;
- std::cerr << theArgVec[0] << " off" << std::endl;
- std::cerr << theArgVec[0] << " on {index_of_std_texture(0..7)|texture_file_name} [{clamp|repeat} {decal|modulate} {nearest|bilinear|trilinear} scale_s scale_t translation_s translation_t rotation_degrees]" << std::endl;
+ Message::SendFail() << "Usage:\n"
+ << theArgVec[0] << " off\n"
+ << theArgVec[0] << " on {index_of_std_texture(0..7)|texture_file_name} [{clamp|repeat} {decal|modulate} {nearest|bilinear|trilinear} scale_s scale_t translation_s translation_t rotation_degrees]";
return 1;
}
Handle(Graphic3d_ClipPlane) aClipPlane;
if (!theRegPlanes.Find (theName, aClipPlane))
{
- std::cout << "Warning: no such plane.\n";
+ Message::SendWarning ("Warning: no such plane");
return;
}
const Handle(V3d_View)& anActiveView = ViewerTest::CurrentView();
if (anActiveView.IsNull())
{
- std::cout << "Error: no active view.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (theArgsNb < 3)
{
- std::cout << "Syntax error: plane name is required.\n";
+ Message::SendFail ("Syntax error: plane name is required");
return 1;
}
{
if (!aRegPlanes.IsBound (aPlane))
{
- std::cout << "Error: no such plane.\n";
+ Message::SendFail ("Error: no such plane");
return 1;
}
else if (theArgsNb < 4)
{
- std::cout << "Syntax error: enter name for new plane.\n";
+ Message::SendFail ("Syntax error: enter name for new plane");
return 1;
}
TCollection_AsciiString aClone (theArgVec[3]);
if (aRegPlanes.IsBound (aClone))
{
- std::cout << "Error: plane name is in use.\n";
+ Message::SendFail ("Error: plane name is in use");
return 1;
}
{
if (theArgsNb < 5)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
// old syntax support
if (theArgsNb < 3)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
aPlaneName = theArgVec[2];
if (!aRegPlanes.Find (aPlaneName, aClipPlane))
{
- std::cout << "Error: no such plane '" << aPlaneName << "'.\n";
+ Message::SendFail() << "Error: no such plane '" << aPlaneName << "'";
return 1;
}
}
if (theArgsNb - anArgIter < 1)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
{
if (aNbChangeArgs < 5)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
if (!aSubStr.IsIntegerValue()
|| aSubStr.IntegerValue() <= 0)
{
- std::cout << "Syntax error: unknown argument '" << aChangeArg << "'.\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << aChangeArg << "'";
return 1;
}
aSubIndex = aSubStr.IntegerValue();
{
if (aNbChangeArgs < 2)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
{
if (aNbChangeArgs < 2)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
{
if (aNbChangeArgs < 2)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
{
if (aNbChangeArgs < 2)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
aColor);
if (aNbParsed == 0)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
aClipPlane->SetCappingColor (aColor);
Graphic3d_NameOfMaterial aMatName;
if (!Graphic3d_MaterialAspect::MaterialFromName (aChangeArgs[1], aMatName))
{
- std::cout << "Syntax error: unknown material '" << aChangeArgs[1] << "'.\n";
+ Message::SendFail() << "Syntax error: unknown material '" << aChangeArgs[1] << "'";
return 1;
}
aClipPlane->SetCappingMaterial (aMatName);
}
else
{
- std::cout << "Syntax error at '" << aValStr << "'\n";
+ Message::SendFail() << "Syntax error at '" << aValStr << "'";
return 1;
}
anAspect->SetAlphaMode (aMode);
{
if (aNbChangeArgs < 2)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
{
if (aClipPlane->CappingTexture().IsNull())
{
- std::cout << "Error: no texture is set.\n";
+ Message::SendFail ("Error: no texture is set");
return 1;
}
if (aNbChangeArgs < 3)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
{
if (aClipPlane->CappingTexture().IsNull())
{
- std::cout << "Error: no texture is set.\n";
+ Message::SendFail ("Error: no texture is set");
return 1;
}
if (aNbChangeArgs < 3)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
{
if (aClipPlane->CappingTexture().IsNull())
{
- std::cout << "Error: no texture is set.\n";
+ Message::SendFail ("Error: no texture is set");
return 1;
}
if (aNbChangeArgs < 2)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
{
if (aNbChangeArgs < 2)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
}
else
{
- std::cout << "Error: object/view '" << anEntityName << "' is not found!\n";
+ Message::SendFail() << "Error: object/view '" << anEntityName << "' is not found";
return 1;
}
}
}
else
{
- std::cout << "Syntax error: unknown argument '" << aChangeArg << "'.\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << aChangeArg << "'";
return 1;
}
}
if (aCurrentView.IsNull())
{
- std::cout << theArgVec[0] << ": Call vinit before this command, please.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (aNewZNear >= aNewZFar)
{
- std::cout << theArgVec[0] << ": invalid arguments: znear should be less than zfar.\n";
+ Message::SendFail ("Syntax error: invalid arguments: znear should be less than zfar");
return 1;
}
if (!aCamera->IsOrthographic() && (aNewZNear <= 0.0 || aNewZFar <= 0.0))
{
- std::cout << theArgVec[0] << ": invalid arguments: ";
- std::cout << "znear, zfar should be positive for perspective camera.\n";
+ Message::SendFail ("Syntax error: invalid arguments: znear, zfar should be positive for perspective camera");
return 1;
}
}
else
{
- std::cout << theArgVec[0] << ": wrong command arguments. Type help for more information.\n";
+ Message::SendFail ("Syntax error: wrong command arguments");
return 1;
}
if (aCurrentView.IsNull())
{
- std::cout << theArgVec[0] << ": Call vinit before this command, please.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (theArgsNb > 3)
{
- std::cout << theArgVec[0] << ": wrong command arguments. Type help for more information.\n";
+ Message::SendFail ("Syntax error: wrong command arguments");
return 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cout << "Error: no active view.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
else if (*anArgValue != '-')
{
- std::cout << "Error: unknown IOD type '" << anArgValue << "'\n";
+ Message::SendFail() << "Error: unknown IOD type '" << anArgValue << "'";
return 1;
}
switch (aCamera->GetIODType())
}
else if (*anArgValue != '-')
{
- std::cout << "Error: unknown ZFocus type '" << anArgValue << "'\n";
+ Message::SendFail() << "Error: unknown ZFocus type '" << anArgValue << "'";
return 1;
}
switch (aCamera->ZFocusType())
}
else
{
- std::cout << "Error: unknown argument '" << anArg << "'\n";
+ Message::SendFail() << "Error: unknown argument '" << anArg << "'";
return 1;
}
}
aCameraFrustum = Handle(AIS_CameraFrustum)::DownCast (GetMapOfAIS().Find2 (theArgVec[1]));
if (aCameraFrustum.IsNull())
{
- std::cout << "Error: object '" << aPrsName << "'is already defined and is not a camera frustum!\n";
+ Message::SendFail() << "Error: object '" << aPrsName << "'is already defined and is not a camera frustum";
return 1;
}
}
{
if (aView.IsNull())
{
- std::cout << "Error: no active viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 0;
}
{
if (++anArgIter < theArgNb)
{
- std::cout << "Error: wrong number of arguments!\n";
+ Message::SendFail ("Error: wrong number of arguments");
return 1;
}
{
if (++anArgIter < theArgNb)
{
- std::cout << "Error: wrong number of arguments!\n";
+ Message::SendFail ("Error: wrong number of arguments");
return 1;
}
if (++anArgIter >= theArgNb
|| !parseStereoMode (theArgVec[anArgIter], aMode))
{
- std::cout << "Error: syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
if (++anArgIter >= theArgNb
|| !parseAnaglyphFilter (theArgVec[anArgIter], aFilter))
{
- std::cout << "Error: syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
else
{
- std::cout << "Error: syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
}
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
- std::cout << "Error: no active viewer\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (++anArgIter >= theArgsNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
aDefParams->SetTypeOfDeflection (Aspect_TOD_ABSOLUTE);
{
if (++anArgIter >= theArgsNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
aDefParams->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
{
if (++anArgIter >= theArgsNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Syntax error at " << anArg;
return 1;
}
aDefParams->SetDeviationAngle (M_PI * Draw::Atof (theArgVec[anArgIter]) / 180.0);
if (anArgIter >= theArgsNb
|| !ViewerTest::ParseOnOff (theArgVec[anArgIter], toTurnOn))
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
aDefParams->SetAutoTriangulation (toTurnOn);
}
else
{
- std::cout << "Syntax error: unknown argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << anArg << "'";
return 1;
}
}
if (aView.IsNull()
|| aViewer.IsNull())
{
- std::cerr << "No active viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (++anArgIt >= theArgsNb)
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
}
else
{
- std::cout << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
}
{
if (!toCreate)
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
{
if (!toCreate)
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
{
if (!toCreate)
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
{
if (!toCreate)
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
{
if (++anArgIt >= theArgsNb)
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
if (aLightOld.IsNull())
{
- std::cerr << "Light " << theArgVec[anArgIt] << " is undefined!\n";
+ Message::SendFail() << "Error: Light " << theArgVec[anArgIt] << " is undefined";
return 1;
}
}
Handle(V3d_Light) aLightDel;
if (++anArgIt >= theArgsNb)
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
if (++anArgIt >= theArgsNb
|| aLightCurr.IsNull())
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
|| (aLightCurr->Type() != Graphic3d_TOLS_POSITIONAL
&& aLightCurr->Type() != Graphic3d_TOLS_SPOT))
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
|| (aLightCurr->Type() != Graphic3d_TOLS_DIRECTIONAL
&& aLightCurr->Type() != Graphic3d_TOLS_SPOT))
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
if (++anArgIt >= theArgsNb
|| aLightCurr.IsNull())
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
if (++anArgIt >= theArgsNb
|| aLightCurr.IsNull())
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
|| aLightCurr.IsNull()
|| aLightCurr->Type() != Graphic3d_TOLS_SPOT)
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
|| (aLightCurr->Type() != Graphic3d_TOLS_POSITIONAL
&& aLightCurr->Type() != Graphic3d_TOLS_SPOT))
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
|| (aLightCurr->Type() != Graphic3d_TOLS_POSITIONAL
&& aLightCurr->Type() != Graphic3d_TOLS_SPOT))
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
|| aLightCurr.IsNull()
|| aLightCurr->Type() != Graphic3d_TOLS_SPOT)
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
|| aLightCurr->Type() == Graphic3d_TOLS_AMBIENT
|| aLightCurr->Type() == Graphic3d_TOLS_DIRECTIONAL)
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
if (aLightCurr.IsNull()
|| aLightCurr->Type() == Graphic3d_TOLS_AMBIENT)
{
- std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
}
else
{
- std::cerr << "Warning: unknown argument '" << anArg << "'\n";
+ Message::SendFail() << "Warning: unknown argument '" << anArg << "'";
}
}
{
if (theArgsNb > 2)
{
- std::cerr << "Error: 'vpbrenv' command has only one argument\n";
+ Message::SendFail ("Syntax error: 'vpbrenv' command has only one argument");
return 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cerr << "Error: no active viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
else
{
- std::cerr << "Error: unknown argument [" << theArgVec[1] << "] for 'vpbrenv' command\n";
+ Message::SendFail() << "Syntax error: unknown argument [" << theArgVec[1] << "] for 'vpbrenv' command";
return 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cerr << "Error: no active viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
}
else
{
- std::cout << "Error: unknown argument '" << theArgVec[1] << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << theArgVec[1] << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
}
}
else
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
}
}
else if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_Integer aNbSamples = Draw::Atoi (theArgVec[anArgIter]);
if (aNbSamples < 0)
{
- std::cerr << "Error: invalid number of MSAA samples " << aNbSamples << ".\n";
+ Message::SendFail() << "Syntax error: invalid number of MSAA samples " << aNbSamples << "";
return 1;
}
else
}
else if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_ShortReal aFeather = (Standard_ShortReal) Draw::Atof (theArgVec[anArgIter]);
if (aFeather <= 0.0f)
{
- std::cerr << "Error: invalid value of line width feather " << aFeather << ". Should be > 0\n";
+ Message::SendFail() << "Syntax error: invalid value of line width feather " << aFeather << ". Should be > 0";
return 1;
}
aParams.LineFeather = aFeather;
}
else if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_ShortReal aWeight = (Standard_ShortReal) Draw::Atof (theArgVec[anArgIter]);
if (aWeight < 0.f || aWeight > 1.f)
{
- std::cerr << "Error: invalid value of Weighted Order-Independent Transparency depth weight factor " << aWeight << ". Should be within range [0.0; 1.0]\n";
+ Message::SendFail() << "Syntax error: invalid value of Weighted Order-Independent Transparency depth weight factor " << aWeight << ". Should be within range [0.0; 1.0]";
return 1;
}
}
else
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
}
}
else if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_Real aScale = Draw::Atof (theArgVec[anArgIter]);
if (aScale < 0.01)
{
- std::cerr << "Error: invalid rendering resolution scale " << aScale << ".\n";
+ Message::SendFail() << "Syntax error: invalid rendering resolution scale " << aScale << "";
return 1;
}
else
}
else if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
// We allow RaytracingDepth be more than 10 in case of GI enabled
if (aDepth < 1 || (aDepth > 10 && !aParams.IsGlobalIlluminationEnabled))
{
- std::cerr << "Error: invalid ray-tracing depth " << aDepth << ". Should be within range [1; 10]\n";
+ Message::SendFail() << "Syntax error: invalid ray-tracing depth " << aDepth << ". Should be within range [1; 10]";
return 1;
}
else
}
else if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const TCollection_AsciiString aMaxRadStr = theArgVec[anArgIter];
if (!aMaxRadStr.IsRealValue())
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_Real aMaxRadiance = aMaxRadStr.RealValue();
if (aMaxRadiance <= 0.0)
{
- std::cerr << "Error: invalid radiance clamping value " << aMaxRadiance << ".\n";
+ Message::SendFail() << "Syntax error: invalid radiance clamping value " << aMaxRadiance;
return 1;
}
else
}
else if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_Integer aTileSize = Draw::Atoi (theArgVec[anArgIter]);
if (aTileSize < 1)
{
- std::cerr << "Error: invalid size of ISS tile " << aTileSize << ".\n";
+ Message::SendFail() << "Syntax error: invalid size of ISS tile " << aTileSize;
return 1;
}
aParams.RayTracingTileSize = aTileSize;
}
else if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_Integer aNbTiles = Draw::Atoi (theArgVec[anArgIter]);
if (aNbTiles < -1)
{
- std::cerr << "Error: invalid number of ISS tiles " << aNbTiles << ".\n";
+ Message::SendFail() << "Syntax error: invalid number of ISS tiles " << aNbTiles;
return 1;
}
else if (aNbTiles > 0
&& (aNbTiles < 64
|| aNbTiles > 1024))
{
- std::cerr << "Warning: suboptimal number of ISS tiles " << aNbTiles << ". Recommended range: [64, 1024].\n";
+ Message::SendWarning() << "Warning: suboptimal number of ISS tiles " << aNbTiles << ". Recommended range: [64, 1024].";
}
aParams.NbRayTracingTiles = aNbTiles;
}
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
}
Graphic3d_TypeOfShadingModel aModel = Graphic3d_TOSM_DEFAULT;
}
else
{
- std::cout << "Error: unknown shading model '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: unknown shading model '" << theArgVec[anArgIter] << "'";
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_Integer aPbrEnvPow2Size = Draw::Atoi (theArgVec[anArgIter]);
if (aPbrEnvPow2Size < 1)
{
- std::cout << "Error: 'Pow2Size' of PBR Environment has to be greater or equal 1\n";
+ Message::SendFail ("Syntax error: 'Pow2Size' of PBR Environment has to be greater or equal 1");
return 1;
}
aParams.PbrEnvPow2Size = aPbrEnvPow2Size;
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_Integer aPbrEnvSpecMapNbLevels = Draw::Atoi (theArgVec[anArgIter]);
if (aPbrEnvSpecMapNbLevels < 2)
{
- std::cout << "Error: 'SpecMapLevelsNumber' of PBR Environment has to be greater or equal 2\n";
+ Message::SendFail ("Syntax error: 'SpecMapLevelsNumber' of PBR Environment has to be greater or equal 2");
return 1;
}
aParams.PbrEnvSpecMapNbLevels = aPbrEnvSpecMapNbLevels;
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_Integer aPbrEnvBakingDiffNbSamples = Draw::Atoi (theArgVec[anArgIter]);
if (aPbrEnvBakingDiffNbSamples < 1)
{
- std::cout << "Error: 'BakingDiffSamplesNumber' of PBR Environtment has to be greater or equal 1\n";
+ Message::SendFail ("Syntax error: 'BakingDiffSamplesNumber' of PBR Environtment has to be greater or equal 1");
return 1;
}
aParams.PbrEnvBakingDiffNbSamples = aPbrEnvBakingDiffNbSamples;
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_Integer aPbrEnvBakingSpecNbSamples = Draw::Atoi(theArgVec[anArgIter]);
if (aPbrEnvBakingSpecNbSamples < 1)
{
- std::cout << "Error: 'BakingSpecSamplesNumber' of PBR Environtment has to be greater or equal 1\n";
+ Message::SendFail ("Syntax error: 'BakingSpecSamplesNumber' of PBR Environtment has to be greater or equal 1");
return 1;
}
aParams.PbrEnvBakingSpecNbSamples = aPbrEnvBakingSpecNbSamples;
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
const Standard_ShortReal aPbrEnvBakingProbability = static_cast<Standard_ShortReal>(Draw::Atof (theArgVec[anArgIter]));
if (aPbrEnvBakingProbability < 0.f
|| aPbrEnvBakingProbability > 1.f)
{
- std::cout << "Error: 'BakingProbability' of PBR Environtment has to be in range of [0, 1]\n";
+ Message::SendFail ("Syntax error: 'BakingProbability' of PBR Environtment has to be in range of [0, 1]");
return 1;
}
aParams.PbrEnvBakingProbability = aPbrEnvBakingProbability;
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+ Message::SendFail() << "Syntax error: wrong syntax at argument'" << anArg << "'";
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
float aFocalDist = static_cast<float> (aParam.RealValue());
if (aFocalDist < 0)
{
- std::cout << "Error: parameter can't be negative at argument '" << anArg << "'.\n";
+ Message::SendFail() << "Error: parameter can't be negative at argument '" << anArg << "'";
return 1;
}
aView->ChangeRenderingParams().CameraFocalPlaneDist = aFocalDist;
}
else
{
- std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+ Message::SendFail() << "Syntax error at argument'" << anArg << "'";
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
float aApertureSize = static_cast<float> (aParam.RealValue());
if (aApertureSize < 0)
{
- std::cout << "Error: parameter can't be negative at argument '" << anArg << "'.\n";
+ Message::SendFail() << "Error: parameter can't be negative at argument '" << anArg << "'";
return 1;
}
aView->ChangeRenderingParams().CameraApertureRadius = aApertureSize;
}
else
{
- std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+ Message::SendFail() << "Syntax error at argument'" << anArg << "'";
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+ Message::SendFail() << "Syntax error at argument'" << anArg << "'";
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+ Message::SendFail() << "Syntax error at argument'" << anArg << "'";
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
}
else
{
- std::cout << "Error: wrong syntax at argument'" << anArg << "'.\n";
+ Message::SendFail() << "Syntax error at argument'" << anArg << "'";
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
Graphic3d_RenderingParams::PerfCounters aFlags = aView->ChangeRenderingParams().CollectedStats;
if (!convertToPerfStatsFlags (aFlagsStr, aFlags))
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
aView->ChangeRenderingParams().CollectedStats = aFlags;
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
aView->ChangeRenderingParams().StatsUpdateInterval = (Standard_ShortReal )Draw::Atof (theArgVec[anArgIter]);
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
aView->ChangeRenderingParams().StatsNbFrames = Draw::Atoi (theArgVec[anArgIter]);
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at argument '" << anArg << "'";
return 1;
}
aView->ChangeRenderingParams().StatsMaxChartTime = (Standard_ShortReal )Draw::Atof (theArgVec[anArgIter]);
}
else
{
- std::cout << "Error: wrong syntax, unknown flag '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error: unknown flag '" << anArg << "'";
return 1;
}
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
- std::cerr << "Error: no active viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
|| aFlag == "cpudynmax") aParam = Graphic3d_RenderingParams::PerfCounters_FrameTime;
else
{
- std::cerr << "Unknown argument '" << theArgVec[anArgIter] << "'!\n";
+ Message::SendFail() << "Error: unknown argument '" << theArgVec[anArgIter] << "'";
continue;
}
if (aCurrentView.IsNull()
|| aViewer.IsNull())
{
- std::cerr << "No active viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
if (aName.IsEmpty())
{
- std::cerr << theArgVec[0] << " error: please specify AIS manipulator's name as the first argument.\n";
+ Message::SendFail ("Syntax error: please specify AIS manipulator's name as the first argument");
return 1;
}
{
if (!aMapAIS.IsBound2 (aName))
{
- std::cerr << theArgVec[0] << " error: could not find \"" << aName << "\" AIS object.\n";
+ Message::SendFail() << "Syntax error: could not find \"" << aName << "\" AIS object";
return 1;
}
Handle(AIS_Manipulator) aManipulator = Handle(AIS_Manipulator)::DownCast (aMapAIS.Find2 (aName));
if (aManipulator.IsNull())
{
- std::cerr << theArgVec[0] << " error: \"" << aName << "\" is not an AIS manipulator.\n";
+ Message::SendFail() << "Syntax error: \"" << aName << "\" is not an AIS manipulator";
return 1;
}
aManipulator = Handle(AIS_Manipulator)::DownCast (aMapAIS.Find2 (aName));
if (aManipulator.IsNull())
{
- std::cerr << theArgVec[0] << " error: \"" << aName << "\" is not an AIS manipulator.\n";
+ Message::SendFail() << "Syntax error: \"" << aName << "\" is not an AIS manipulator";
return 1;
}
}
Standard_Boolean aOnOff = aCmd.ArgBool ("part", 2);
if (aMode < 1 || aMode > 4)
{
- std::cerr << theArgVec[0] << " error: mode value should be in range [1, 4].\n";
+ Message::SendFail ("Syntax error: mode value should be in range [1, 4]");
return 1;
}
Standard_Boolean aOnOff = aCmd.ArgBool("parts", 1);
if (aMode < 1 || aMode > 4)
{
- std::cerr << theArgVec[0] << " error: mode value should be in range [1, 4].\n";
+ Message::SendFail ("Syntax error: mode value should be in range [1, 4]");
return 1;
}
Handle(AIS_InteractiveObject) anObject;
if (!aMapAIS.Find2 (anObjName, anObject))
{
- std::cerr << theArgVec[0] << " error: AIS object \"" << anObjName << "\" does not exist.\n";
+ Message::SendFail() << "Syntax error: AIS object \"" << anObjName << "\" does not exist";
return 1;
}
&& aManip->IsAttached()
&& aManip->Object() == anObject)
{
- std::cerr << theArgVec[0] << " error: AIS object \"" << anObjName << "\" already has manipulator.\n";
+ Message::SendFail() << "Syntax error: AIS object \"" << anObjName << "\" already has manipulator";
return 1;
}
}
ViewerTest_Names aViewNames (aViewString);
if (!ViewerTest_myViews.IsBound1 (aViewNames.GetViewName()))
{
- std::cerr << theArgVec[0] << " error: wrong view name '" << aViewString << "'\n";
+ Message::SendFail() << "Syntax error: wrong view name '" << aViewString << "'";
return 1;
}
aView = ViewerTest_myViews.Find1 (aViewNames.GetViewName());
if (aView.IsNull())
{
- std::cerr << theArgVec[0] << " error: cannot find view with name '" << aViewString << "'\n";
+ Message::SendFail() << "Syntax error: cannot find view with name '" << aViewString << "'";
return 1;
}
}
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
- std::cerr << "No active viewer!\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
else if (theArgsNb != 2
|| !ViewerTest::ParseOnOff (theArgVec[1], toEnable))
{
- std::cout << "Syntax error: wrong number of parameters.";
+ Message::SendFail ("Syntax error: wrong number of parameters");
return 1;
}
if (toEnable != aCtx->ToHilightSelected())
{
if (++anArgIter >= theArgsNb)
{
- std::cout << "Syntax error: type of highlighting is undefined\n";
+ Message::SendFail ("Syntax error: type of highlighting is undefined");
return 1;
}
}
else
{
- std::cout << "Syntax error: unknwon picking strategy '" << aVal << "'\n";
+ Message::SendFail() << "Syntax error: unknown picking strategy '" << aVal << "'";
return 1;
}
{
if (aType == Prs3d_TypeOfHighlight_None)
{
- std::cout << "Syntax error: type of highlighting is undefined\n";
+ Message::SendFail ("Syntax error: type of highlighting is undefined");
return 1;
}
{
if (aType == Prs3d_TypeOfHighlight_None)
{
- std::cout << "Syntax error: type of highlighting is undefined\n";
+ Message::SendFail ("Syntax error: type of highlighting is undefined");
return 1;
}
Graphic3d_ZLayerId aNewLayer = Graphic3d_ZLayerId_UNKNOWN;
if (!ViewerTest::ParseZLayer (theArgVec[anArgIter], aNewLayer))
{
- std::cerr << "Error: wrong syntax at " << theArgVec[anArgIter] << ".\n";
+ Message::SendFail() << "Syntax error at " << theArgVec[anArgIter];
return 1;
}
}
else if (aType == Prs3d_TypeOfHighlight_None)
{
- std::cout << "Syntax error: type of highlighting is undefined\n";
+ Message::SendFail ("Syntax error: type of highlighting is undefined");
return 1;
}
aColor);
if (aNbParsed == 0)
{
- std::cout << "Syntax error: need more arguments.\n";
+ Message::SendFail ("Syntax error: need more arguments");
return 1;
}
anArgIter += aNbParsed;
}
else if (aType == Prs3d_TypeOfHighlight_None)
{
- std::cout << "Syntax error: type of highlighting is undefined\n";
+ Message::SendFail ("Syntax error: type of highlighting is undefined");
return 1;
}
{
if (aType == Prs3d_TypeOfHighlight_None)
{
- std::cout << "Syntax error: type of highlighting is undefined\n";
+ Message::SendFail ("Syntax error: type of highlighting is undefined");
return 1;
}
}
else
{
- std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
}
}
{
if (theArgsNb < 2)
{
- std::cout << "Syntax error: wrong number arguments for '" << theArgVec[0] << "'\n";
+ Message::SendFail() << "Syntax error: wrong number arguments for '" << theArgVec[0] << "'";
return 1;
}
const Handle(AIS_InteractiveContext)& aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "Error: no active view.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (++anArgIter >= theArgsNb)
{
- std::cout << "Syntax error: wrong number parameters of flag '-depth'.\n";
+ Message::SendFail ("Syntax error: wrong number parameters of flag '-depth'");
return 1;
}
{
if (++anArgIter >= theArgsNb)
{
- std::cout << "Syntax error: wrong number parameters at '" << aParam << "'.\n";
+ Message::SendFail() << "Syntax error: wrong number parameters at '" << aParam << "'";
return 1;
}
}
else
{
- std::cout << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'.\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'";
return 1;
}
}
if (aFile.IsEmpty())
{
- std::cout << "Syntax error: image file name is missing.\n";
+ Message::SendFail ("Syntax error: image file name is missing");
return 1;
}
Image_AlienPixMap aPixMap;
if (!aPixMap.InitZero (anImgFormat, aWidth, aHeight))
{
- std::cout << "Error: can't allocate image.\n";
+ Message::SendFail ("Error: can't allocate image");
return 1;
}
if (!aContext->MainSelector()->ToPixMap (aPixMap, aView, aType, aPickedIndex))
{
- std::cout << "Error: can't generate selection image.\n";
+ Message::SendFail ("Error: can't generate selection image");
return 1;
}
if (!aPixMap.Save (aFile))
{
- std::cout << "Error: can't save selection image.\n";
+ Message::SendFail ("Error: can't save selection image");
return 0;
}
return 0;
const Handle(V3d_View)& aView = ViewerTest::CurrentView();
if (aContext.IsNull() || aView.IsNull())
{
- std::cout << "Error: no active view.\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
else if (theNbArgs < 2)
{
- std::cout << "Syntax error: wrong number arguments\n";
+ Message::SendFail ("Syntax error: wrong number arguments");
return 1;
}
aName = theArgVec[anArgIter];
if (aName.StartsWith ("-"))
{
- std::cout << "Syntax error: object name should be specified.\n";
+ Message::SendFail ("Syntax error: object name should be specified");
return 1;
}
Handle(AIS_InteractiveObject) aPrs;
aColorRgb);
if (aNbParsed == 0)
{
- std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
const Standard_Real aValue = Draw::Atof (theArgVec[++anArgIter]);
if (aValue < 0.0 || aValue > 1.0)
{
- std::cout << "Syntax error: invalid transparency value " << theArgVec[anArgIter] << "\n";
+ Message::SendFail() << "Syntax error: invalid transparency value " << theArgVec[anArgIter];
return 1;
}
}
else
{
- std::cout << "Syntax error: unknown argument '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << anArg << "'";
return 1;
}
}
if (aViewCube.IsNull())
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail ("Syntax error: wrong number of arguments");
return 1;
}
//! "NullAngle".
Standard_EXPORT gce_MakeCone(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3, const gp_Pnt& P4);
- //! Makes a Cone by its axis <Axis> and and two points.
+ //! Makes a Cone by its axis <Axis> and two points.
//! The distance between <P1> and the axis is the radius
//! of the section passing through <P1>.
//! The distance between <P2> and the axis is the radius
//! "ConfusedPoints"
Standard_EXPORT gce_MakeCone(const gp_Ax1& Axis, const gp_Pnt& P1, const gp_Pnt& P2);
- //! Makes a Cone by its axis <Axis> and and two points.
+ //! Makes a Cone by its axis <Axis> and two points.
//! The distance between <P1> and the axis is the radius
//! of the section passing through <P1>
//! The distance between <P2> and the axis is the radius
--- /dev/null
+puts "# ============"
+puts "# 0031189: Draw Harness, ViewerTest - send messages to Message::DefaultMessenger()"
+puts "# ============"
+puts ""
+puts "# Test consistency of messages output using stream buffer interface"
+
+pload QAcommands
+set out [OCC31189]
+
+set expected {
+ {Direct message 1}
+ {Sender message 1: start ...... end}
+ {Direct message 2}
+ {}
+ {Sender message 2}
+}
+
+if { [string compare [string trim $out] [join $expected "\n"]] } {
+ puts "Error: output (see above) does not match expected one:"
+ puts "[join $expected "\n"]"
+ puts ""
+}
\ No newline at end of file
#######################################################################
# Exception when trying to draw dimension between face and point
#######################################################################
+puts "REQUIRED All: Error: dimension geometry is invalid, -length dimension can't be built on input shapes"
vfont add [locate_data_file DejaVuSans.ttf] SansFont