1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0031501: Foundation Classes, Message_Printer - remove theToPutEndl argument -- use shortcuts

Message::DefaultMessenger()->Send() have been replaced by shortcuts Message::Send().
This commit is contained in:
kgv 2020-05-08 14:40:39 +03:00 committed by bugmaster
parent fa8a462827
commit a87b1b3738
33 changed files with 241 additions and 290 deletions

View File

@ -1942,7 +1942,8 @@ a stream-like interface, have been removed.
This functionality is provided now by separate class *Message_Messenger::StreamBuffer*.
That class contains a stringstream buffer which can be filled using standard stream
operators. The string is sent to a messenger on destruction of the buffer object,
call of its method Flush(), or using operator << with one of ostream manipulators (*std::endl, std::flush, std::ends*). Manipulator *Message_EndLine* has been removed,
call of its method Flush(), or using operator << with one of ostream manipulators
(*std::endl, std::flush, std::ends*). Manipulator *Message_EndLine* has been removed,
*std::endl* should be used instead.
New methods *SendFail(), SendAlarm(), SendWarning(), SendInfo()*, and *SendTrace()* are
@ -1955,21 +1956,21 @@ The code that used operator << for messenger, should be ported as follows.
Before the change:
~~~~~
Handle(Message_Messenger) theMessenger = ...;
theMessenger << "Sample string " << anInteger << ", " << Message_EndLine;
theMessenger << "Value = " << anInteger << Message_EndLine;
~~~~~
After the change, single-line variant:
~~~~~
Handle(Message_Messenger) theMessenger = ...;
theMessenger->SendInfo() << "Value = " << anInteger << ", ";
theMessenger->SendInfo() << "Value = " << anInteger << std::endl;
~~~~~
After the change, extended variant:
~~~~~
Handle(Message_Messenger) theMessenger = ...;
Message_Messenger::StreamBuffer aSender = theMessenger->SendInfo();
aSender << "Array: [";
for (int i = 0; i < aNb; ++i) { aSender << anArray[i]; }
aSender << "Array: [ ";
for (int i = 0; i < aNb; ++i) { aSender << anArray[i] << " "; }
aSender << "]" << std::endl; // aSender can be used further for other messages
~~~~~

View File

@ -153,9 +153,8 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
}
catch (Standard_Failure const& anException)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::Compute() wireframe presentation builder has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::Compute() wireframe presentation builder has failed (")
+ anException.GetMessageString() + ")");
}
break;
}
@ -184,9 +183,8 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
}
catch (Standard_Failure const& anException)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::Compute() shaded presentation builder has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::Compute() shaded presentation builder has failed (")
+ anException.GetMessageString() + ")");
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
}
}
@ -295,9 +293,8 @@ void AIS_Shape::computeHlrPresentation (const Handle(Graphic3d_Camera)& theProje
}
catch (Standard_Failure const& anException)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::Compute() HLR Algorithm has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::Compute() HLR Algorithm has failed (")
+ anException.GetMessageString() + ")");
StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
}
}
@ -339,9 +336,8 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
}
catch (Standard_Failure const& anException)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::ComputeSelection(" + aMode + ") has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::ComputeSelection(") + aMode + ") has failed ("
+ anException.GetMessageString() + ")");
if (aMode == 0)
{
aSelection->Clear();

View File

@ -76,8 +76,8 @@ void AIS_TexturedShape::SetTextureFileName (const TCollection_AsciiString& theTe
}
else
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: texture with ID ") + theTextureFileName
+ " is undefined! Texture 0 will be used instead.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: texture with ID ") + theTextureFileName
+ " is undefined. Texture 0 will be used instead.");
myPredefTexture = Graphic3d_NameOfTexture2D (0);
}
myTextureFile = "";
@ -311,7 +311,7 @@ void AIS_TexturedShape::updateAttributes (const Handle(Prs3d_Presentation)& theP
}
else
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: texture can not be loaded ") + aTextureDesc, Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: texture can not be loaded ") + aTextureDesc);
}
}

View File

@ -2441,8 +2441,8 @@ void AIS_ViewController::handleSelectionPoly (const Handle(AIS_InteractiveContex
}
catch (const Standard_Failure& theEx)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Internal error while displaying rubber-band: ")
+ theEx.DynamicType()->Name() + ", " + theEx.GetMessageString(), Message_Warning);
Message::SendWarning (TCollection_AsciiString ("Internal error while displaying rubber-band: ")
+ theEx.DynamicType()->Name() + ", " + theEx.GetMessageString());
myRubberBand->ClearPoints();
}
if (!theView->Viewer()->ZLayerSettings (myRubberBand->ZLayer()).IsImmediate())

View File

@ -227,7 +227,7 @@ public:
if (aVrError != vr::VRRenderModelError_None
|| aVrTexture == NULL)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("OpenVR, Unable to load render model texture: ") + theVrModelName + " - " + int(aVrError), Message_Fail);
Message::SendFail (TCollection_AsciiString ("OpenVR, Unable to load render model texture: ") + theVrModelName + " - " + int(aVrError));
return false;
}
@ -472,8 +472,7 @@ bool Aspect_OpenVRSession::Open()
if (aVrError != vr::VRInitError_None)
{
myContext->System = NULL;
Message::DefaultMessenger()->Send (TCollection_AsciiString ("OpenVR, Unable to init VR runtime: ") + vr::VR_GetVRInitErrorAsEnglishDescription (aVrError),
Message_Fail);
Message::SendFail (TCollection_AsciiString ("OpenVR, Unable to init VR runtime: ") + vr::VR_GetVRInitErrorAsEnglishDescription (aVrError));
Close();
return false;
}
@ -481,8 +480,7 @@ bool Aspect_OpenVRSession::Open()
/*vr::IVRRenderModels* aRenderModels = (vr::IVRRenderModels* )vr::VR_GetGenericInterface (vr::IVRRenderModels_Version, &aVrError);
if (aRenderModels == NULL)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Unable to get render model interface: ") + vr::VR_GetVRInitErrorAsEnglishDescription (aVrError),
Message_Fail);;
Message::SendFail (TCollection_AsciiString ("Unable to get render model interface: ") + vr::VR_GetVRInitErrorAsEnglishDescription (aVrError));;
}*/
NCollection_Vec2<uint32_t> aRenderSize;
@ -499,7 +497,7 @@ bool Aspect_OpenVRSession::Open()
initInput();
return true;
#else
Message::DefaultMessenger()->Send ("Open CASCADE has been built without OpenVR support", Message_Fail);
Message::SendFail ("Open CASCADE has been built without OpenVR support");
return false;
#endif
}
@ -518,15 +516,15 @@ bool Aspect_OpenVRSession::initInput()
if (!OSD_File (myActionsManifest).Exists())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("OpenVR, Unable to open actions manifest '") + myActionsManifest + "'", Message_Fail);
Message::SendFail (TCollection_AsciiString ("OpenVR, Unable to open actions manifest '") + myActionsManifest + "'");
return false;
}
vr::EVRInputError aVrError = vr::VRInput()->SetActionManifestPath (myActionsManifest.ToCString());
if (aVrError != vr::VRInputError_None)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("OpenVR, Unable to load actions manifest '") + myActionsManifest
+ "': " + getVRInputError (aVrError), Message_Fail);
Message::SendFail (TCollection_AsciiString ("OpenVR, Unable to load actions manifest '") + myActionsManifest
+ "': " + getVRInputError (aVrError));
return false;
}
@ -546,8 +544,8 @@ bool Aspect_OpenVRSession::initInput()
else
{
hasErrors = true;
Message::DefaultMessenger()->Send (TCollection_AsciiString ("OpenVR, Unable to load action '") + anAction->Id() + "' from '" + myActionsManifest
+ "': " + getVRInputError (aVrError), Message_Fail);
Message::SendFail (TCollection_AsciiString ("OpenVR, Unable to load action '") + anAction->Id() + "' from '" + myActionsManifest
+ "': " + getVRInputError (aVrError));
}
}
@ -560,8 +558,8 @@ bool Aspect_OpenVRSession::initInput()
else
{
hasErrors = true;
Message::DefaultMessenger()->Send (TCollection_AsciiString ("OpenVR, Unable to load action set '") + anActionSet->Id() + "' from '" + myActionsManifest
+ "': " + getVRInputError (aVrError), Message_Fail);
Message::SendFail (TCollection_AsciiString ("OpenVR, Unable to load action set '") + anActionSet->Id() + "' from '" + myActionsManifest
+ "': " + getVRInputError (aVrError));
}
}
return !hasErrors;
@ -660,7 +658,7 @@ Handle(Graphic3d_ArrayOfTriangles) Aspect_OpenVRSession::loadRenderModel (Standa
}
if (aVrError != vr::VRRenderModelError_None)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("OpenVR, Unable to load render model: ") + aRenderModelName + " - " + int(aVrError), Message_Fail);
Message::SendFail (TCollection_AsciiString ("OpenVR, Unable to load render model: ") + aRenderModelName + " - " + int(aVrError));
return Handle(Graphic3d_ArrayOfTriangles)();
}
@ -819,7 +817,7 @@ bool Aspect_OpenVRSession::WaitPoses()
const vr::EVRCompositorError aVRError = vr::VRCompositor()->WaitGetPoses (myContext->TrackedPoses, vr::k_unMaxTrackedDeviceCount, NULL, 0);
if (aVRError != vr::VRCompositorError_None)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Compositor wait poses error: ") + getVRCompositorError (aVRError), Message_Trace);
Message::SendTrace (TCollection_AsciiString ("Compositor wait poses error: ") + getVRCompositorError (aVRError));
}
for (Standard_Integer aPoseIter = myTrackedPoses.Lower(); aPoseIter <= myTrackedPoses.Upper(); ++aPoseIter)
@ -860,7 +858,7 @@ Aspect_XRDigitalActionData Aspect_OpenVRSession::GetDigitalActionData (const Han
vr::EVRInputError anInErr = vr::VRInput()->GetDigitalActionData (theAction->RawHandle(), &aNewData, sizeof(aNewData), vr::k_ulInvalidInputValueHandle);
if (anInErr != vr::VRInputError_None)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Input Error on '") + theAction->Id() + "': " + getVRInputError (anInErr), Message_Fail);
Message::SendFail (TCollection_AsciiString ("Input Error on '") + theAction->Id() + "': " + getVRInputError (anInErr));
return anActionData;
}
@ -895,7 +893,7 @@ Aspect_XRAnalogActionData Aspect_OpenVRSession::GetAnalogActionData (const Handl
vr::EVRInputError anInErr = vr::VRInput()->GetAnalogActionData (theAction->RawHandle(), &aNewData, sizeof(aNewData), vr::k_ulInvalidInputValueHandle);
if (anInErr != vr::VRInputError_None)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Input Error on '") + theAction->Id() + "': " + getVRInputError (anInErr), Message_Fail);
Message::SendFail (TCollection_AsciiString ("Input Error on '") + theAction->Id() + "': " + getVRInputError (anInErr));
return anActionData;
}
@ -936,7 +934,7 @@ Aspect_XRPoseActionData Aspect_OpenVRSession::GetPoseActionDataForNextFrame (con
vr::EVRInputError anInErr = vr::VRInput()->GetPoseActionDataForNextFrame (theAction->RawHandle(), anOrigin, &aNewData, sizeof(aNewData), vr::k_ulInvalidInputValueHandle);
if (anInErr != vr::VRInputError_None)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Input Error on '") + theAction->Id() + "': " + getVRInputError (anInErr), Message_Fail);
Message::SendFail (TCollection_AsciiString ("Input Error on '") + theAction->Id() + "': " + getVRInputError (anInErr));
return anActionData;
}
@ -978,7 +976,7 @@ void Aspect_OpenVRSession::triggerHapticVibrationAction (const Handle(Aspect_XRA
vr::k_ulInvalidInputValueHandle);
if (anInErr != vr::VRInputError_None)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Output Error on '") + theAction->Id() + "': " + getVRInputError (anInErr), Message_Fail);
Message::SendFail (TCollection_AsciiString ("Output Error on '") + theAction->Id() + "': " + getVRInputError (anInErr));
}
}
#else
@ -1072,7 +1070,7 @@ void Aspect_OpenVRSession::ProcessEvents()
// =======================================================================
void Aspect_OpenVRSession::onTrackedDeviceActivated (Standard_Integer theDeviceIndex)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("OpenVR, Device ") + theDeviceIndex + " attached", Message_Trace);
Message::SendTrace (TCollection_AsciiString ("OpenVR, Device ") + theDeviceIndex + " attached");
}
// =======================================================================
@ -1081,7 +1079,7 @@ void Aspect_OpenVRSession::onTrackedDeviceActivated (Standard_Integer theDeviceI
// =======================================================================
void Aspect_OpenVRSession::onTrackedDeviceDeactivated (Standard_Integer theDeviceIndex)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("OpenVR, Device ") + theDeviceIndex + " detached", Message_Trace);
Message::SendTrace (TCollection_AsciiString ("OpenVR, Device ") + theDeviceIndex + " detached");
}
// =======================================================================
@ -1090,7 +1088,7 @@ void Aspect_OpenVRSession::onTrackedDeviceDeactivated (Standard_Integer theDevic
// =======================================================================
void Aspect_OpenVRSession::onTrackedDeviceUpdated (Standard_Integer theDeviceIndex)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("OpenVR, Device ") + theDeviceIndex + " updated", Message_Trace);
Message::SendTrace (TCollection_AsciiString ("OpenVR, Device ") + theDeviceIndex + " updated");
}
// =======================================================================
@ -1119,7 +1117,7 @@ bool Aspect_OpenVRSession::SubmitEye (void* theTexture,
aVRTexture.eType = vr::TextureType_OpenGL;
break;
default:
Message::DefaultMessenger()->Send ("Compositor error: unsupported Graphics API", Message_Fail);
Message::SendFail ("Compositor error: unsupported Graphics API");
return false;
}
switch (theColorSpace)
@ -1133,11 +1131,11 @@ bool Aspect_OpenVRSession::SubmitEye (void* theTexture,
{
if (aVRError != vr::VRCompositorError_AlreadySubmitted)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Compositor Error: ") + getVRCompositorError (aVRError), Message_Fail);
Message::SendFail (TCollection_AsciiString ("Compositor Error: ") + getVRCompositorError (aVRError));
}
else
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Compositor Error: ") + getVRCompositorError (aVRError), Message_Trace);
Message::SendTrace (TCollection_AsciiString ("Compositor Error: ") + getVRCompositorError (aVRError));
}
return false;
}

View File

@ -40,7 +40,7 @@ Handle(NCollection_Buffer) FSD_Base64Decoder::Decode (const Standard_Byte* theSt
Handle(NCollection_Buffer) aData = new NCollection_Buffer (NCollection_BaseAllocator::CommonBaseAllocator());
if (!aData->Allocate (3 * theLen / 4))
{
Message::DefaultMessenger()->Send ("Fail to allocate memory.", Message_Fail);
Message::SendFail ("Fail to allocate memory.");
return Handle(NCollection_Buffer)();
}

View File

@ -90,7 +90,7 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
myFontParams = theParams;
if (!myFTLib->IsValid())
{
Message::DefaultMessenger()->Send ("FreeType library is unavailable", Message_Trace);
Message::SendTrace ("FreeType library is unavailable");
Release();
return false;
}
@ -99,7 +99,7 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
{
if (FT_New_Memory_Face (myFTLib->Instance(), theData->Data(), (FT_Long )theData->Size(), (FT_Long )theFaceId, &myFTFace) != 0)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Font '") + myFontPath + "' failed to load from memory", Message_Trace);
Message::SendTrace (TCollection_AsciiString("Font '") + myFontPath + "' failed to load from memory");
Release();
return false;
}
@ -108,7 +108,7 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
{
if (FT_New_Face (myFTLib->Instance(), myFontPath.ToCString(), (FT_Long )theFaceId, &myFTFace) != 0)
{
//Message::DefaultMessenger()->Send (TCollection_AsciiString("Font '") + myFontPath + "' failed to load from file", Message_Trace);
//Message::SendTrace (TCollection_AsciiString("Font '") + myFontPath + "' failed to load from file");
Release();
return false;
}
@ -116,13 +116,13 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
if (FT_Select_Charmap (myFTFace, ft_encoding_unicode) != 0)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Font '") + myFontPath + "' doesn't contains Unicode charmap", Message_Trace);
Message::SendTrace (TCollection_AsciiString("Font '") + myFontPath + "' doesn't contains Unicode charmap");
Release();
return false;
}
else if (FT_Set_Char_Size (myFTFace, 0L, toFTPoints (theParams.PointSize), theParams.Resolution, theParams.Resolution) != 0)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Font '") + myFontPath + "' doesn't contains Unicode charmap of requested size", Message_Trace);
Message::SendTrace (TCollection_AsciiString("Font '") + myFontPath + "' doesn't contains Unicode charmap of requested size");
Release();
return false;
}
@ -259,8 +259,8 @@ bool Font_FTFont::findAndInitFallback (Font_UnicodeSubset theSubset)
const TCollection_AsciiString& aPath = aRequestedFont->FontPathAny (myFontAspect, aParams.ToSynthesizeItalic, aFaceId);
if (myFallbackFaces[theSubset]->Init (aPath, aParams, aFaceId))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Font_FTFont, using fallback font '") + aRequestedFont->FontName() + "'"
+ " for symbols unsupported by '" + myFTFace->family_name + "'", Message_Trace);
Message::SendTrace (TCollection_AsciiString ("Font_FTFont, using fallback font '") + aRequestedFont->FontName() + "'"
+ " for symbols unsupported by '" + myFTFace->family_name + "'");
}
}
return myFallbackFaces[theSubset]->IsValid();

View File

@ -628,7 +628,7 @@ void Font_FontMgr::InitFontDataBase()
const OSD_Protection aProtectRead (OSD_R, OSD_R, OSD_R, OSD_R);
if (aMapOfFontsDirs.IsEmpty())
{
Message::DefaultMessenger()->Send ("Font_FontMgr, fontconfig library returns an empty folder list", Message_Alarm);
Message::SendAlarm ("Font_FontMgr, fontconfig library returns an empty folder list");
// read fonts directories from font service config file (obsolete)
for (Standard_Integer anIter = 0; myFontServiceConf[anIter] != NULL; ++anIter)
@ -892,7 +892,7 @@ Handle(Font_SystemFont) Font_FontMgr::FindFallbackFont (Font_UnicodeSubset theSu
case Font_UnicodeSubset_CJK: aRange = "CJK"; break;
case Font_UnicodeSubset_Arabic: aRange = "Arabic"; break;
}
Message::DefaultMessenger()->Send (TCollection_AsciiString("Font_FontMgr, error: unable to find ") + aRange + " fallback font!", Message_Fail);
Message::SendFail (TCollection_AsciiString("Font_FontMgr, error: unable to find ") + aRange + " fallback font!");
}
return aFont;
}
@ -968,8 +968,8 @@ Handle(Font_SystemFont) Font_FontMgr::FindFont (const TCollection_AsciiString& t
{
if (isAliasUsed && myToTraceAliases)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Font_FontMgr, using font alias '") + aFont->FontName() + "'"
" instead of requested '" + theFontName +"'", Message_Trace);
Message::SendTrace (TCollection_AsciiString("Font_FontMgr, using font alias '") + aFont->FontName() + "'"
" instead of requested '" + theFontName + "'");
}
if (isBestAlias)
{
@ -992,7 +992,7 @@ Handle(Font_SystemFont) Font_FontMgr::FindFont (const TCollection_AsciiString& t
{
if (theDoFailMsg)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Font_FontMgr, error: unable to find any font!"), Message_Fail);
Message::SendFail ("Font_FontMgr, error: unable to find any font!");
}
return Handle(Font_SystemFont)();
}
@ -1004,8 +1004,8 @@ Handle(Font_SystemFont) Font_FontMgr::FindFont (const TCollection_AsciiString& t
{
TCollection_AsciiString aDesc = TCollection_AsciiString() + "'" + theFontName + "'"
+ TCollection_AsciiString() + " [" + Font_FontMgr::FontAspectToString (theFontAspect) + "]";
Message::DefaultMessenger()->Send (TCollection_AsciiString("Font_FontMgr, warning: unable to find font ")
+ aDesc + "; " + aFont->ToString() + " is used instead");
Message::SendWarning (TCollection_AsciiString("Font_FontMgr, warning: unable to find font ")
+ aDesc + "; " + aFont->ToString() + " is used instead");
}
return aFont;
}

View File

@ -127,22 +127,19 @@ Handle(Image_PixMap) Graphic3d_CubeMapSeparate::Value()
}
else
{
Message::DefaultMessenger()->Send(TCollection_AsciiString() +
"'" + aFilePath + "' inconsistent image format or dimension in Graphic3d_CubeMapSeparate");
Message::SendWarning (TCollection_AsciiString() + "'" + aFilePath + "' inconsistent image format or dimension in Graphic3d_CubeMapSeparate");
}
}
}
}
else
{
Message::DefaultMessenger()->Send(TCollection_AsciiString() +
"Unable to load '" + aFilePath + "' image of Graphic3d_CubeMapSeparate");
Message::SendWarning (TCollection_AsciiString() + "Unable to load '" + aFilePath + "' image of Graphic3d_CubeMapSeparate");
}
}
else
{
Message::DefaultMessenger()->Send(TCollection_AsciiString() +
"[" + myCurrentSide + "] path of Graphic3d_CubeMapSeparate is invalid");
Message::SendWarning (TCollection_AsciiString() + "[" + myCurrentSide + "] path of Graphic3d_CubeMapSeparate is invalid");
}
}

View File

@ -548,8 +548,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
}
if ((aFIF == FIF_UNKNOWN) || !FreeImage_FIFSupportsReading (aFIF))
{
::Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: image '") + theImagePath + "' has unsupported file format.",
Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image '") + theImagePath + "' has unsupported file format");
if (aFiMem != NULL)
{
FreeImage_CloseMemory (aFiMem);
@ -586,10 +585,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
}
if (anImage == NULL)
{
TCollection_AsciiString aMessage = "Error: image file '";
aMessage.AssignCat (theImagePath);
aMessage.AssignCat ("' is missing or invalid.");
::Message::DefaultMessenger()->Send (aMessage, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image file '") + theImagePath + "' is missing or invalid");
return false;
}
@ -620,8 +616,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
}
if (aFormat == Image_Format_UNKNOWN)
{
::Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: image '") + theImagePath + "' has unsupported pixel format.",
Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image '") + theImagePath + "' has unsupported pixel format");
return false;
}
@ -650,8 +645,7 @@ bool Image_AlienPixMap::Load (std::istream& theStream,
}
if ((aFIF == FIF_UNKNOWN) || !FreeImage_FIFSupportsReading (aFIF))
{
::Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: image stream '") + theFileName + "' has unsupported file format.",
Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image stream '") + theFileName + "' has unsupported file format");
return false;
}
@ -670,8 +664,7 @@ bool Image_AlienPixMap::Load (std::istream& theStream,
FIBITMAP* anImage = FreeImage_LoadFromHandle (aFIF, &aFiIO, &aStream, aLoadFlags);
if (anImage == NULL)
{
::Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: image stream '") + theFileName + "' is missing or invalid.",
Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image stream '") + theFileName + "' is missing or invalid");
return false;
}
@ -680,8 +673,7 @@ bool Image_AlienPixMap::Load (std::istream& theStream,
FreeImage_GetBPP (anImage));
if (aFormat == Image_Format_UNKNOWN)
{
::Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: image stream '") + theFileName + "' has unsupported pixel format.",
Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image stream '") + theFileName + "' has unsupported pixel format");
return false;
}
@ -705,7 +697,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
CoInitializeEx (NULL, COINIT_MULTITHREADED);
if (CoCreateInstance (CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&aWicImgFactory.ChangePtr())) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot initialize WIC Imaging Factory", Message_Fail);
Message::SendFail ("Error: cannot initialize WIC Imaging Factory");
return false;
}
@ -716,12 +708,12 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
if (aWicImgFactory->CreateStream (&aWicStream.ChangePtr()) != S_OK
|| aWicStream->InitializeFromMemory ((BYTE* )theData, (DWORD )theLength) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot initialize WIC Stream", Message_Fail);
Message::SendFail ("Error: cannot initialize WIC Stream");
return false;
}
if (aWicImgFactory->CreateDecoderFromStream (aWicStream.get(), NULL, WICDecodeMetadataCacheOnDemand, &aWicDecoder.ChangePtr()) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot create WIC Image Decoder", Message_Fail);
Message::SendFail ("Error: cannot create WIC Image Decoder");
return false;
}
}
@ -730,7 +722,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
const TCollection_ExtendedString aFileNameW (theFileName);
if (aWicImgFactory->CreateDecoderFromFilename (aFileNameW.ToWideString(), NULL, GENERIC_READ, WICDecodeMetadataCacheOnDemand, &aWicDecoder.ChangePtr()) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot create WIC Image Decoder", Message_Fail);
Message::SendFail ("Error: cannot create WIC Image Decoder");
return false;
}
}
@ -744,7 +736,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
|| aWicFrameDecode->GetSize (&aFrameSizeX, &aFrameSizeY) != S_OK
|| aWicFrameDecode->GetPixelFormat (&aWicPixelFormat))
{
Message::DefaultMessenger()->Send ("Error: cannot get WIC Image Frame", Message_Fail);
Message::SendFail ("Error: cannot get WIC Image Frame");
return false;
}
@ -756,7 +748,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
if (aWicImgFactory->CreateFormatConverter (&aWicConvertedFrame.ChangePtr()) != S_OK
|| aWicConvertedFrame->Initialize (aWicFrameDecode.get(), convertToWicFormat (aPixelFormat), WICBitmapDitherTypeNone, NULL, 0.0f, WICBitmapPaletteTypeCustom) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot convert WIC Image Frame to RGB format", Message_Fail);
Message::SendFail ("Error: cannot convert WIC Image Frame to RGB format");
return false;
}
aWicFrameDecode.Nullify();
@ -764,7 +756,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
if (!Image_PixMap::InitTrash (aPixelFormat, aFrameSizeX, aFrameSizeY))
{
Message::DefaultMessenger()->Send ("Error: cannot initialize memory for image", Message_Fail);
Message::SendFail ("Error: cannot initialize memory for image");
return false;
}
@ -775,7 +767,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
}
if (aWicSrc->CopyPixels (NULL, (UINT )SizeRowBytes(), (UINT )SizeBytes(), ChangeData()) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot copy pixels from WIC Image", Message_Fail);
Message::SendFail ("Error: cannot copy pixels from WIC Image");
return false;
}
SetTopDown (true);
@ -793,14 +785,14 @@ bool Image_AlienPixMap::Load (std::istream& theStream,
theStream.seekg (aStart);
if (aLen <= 0)
{
Message::DefaultMessenger()->Send ("Error: empty stream", Message_Fail);
Message::SendFail ("Error: empty stream");
return false;
}
NCollection_Array1<Standard_Byte> aBuff (1, aLen);
if (!theStream.read ((char* )&aBuff.ChangeFirst(), aBuff.Size()))
{
Message::DefaultMessenger()->Send ("Error: unable to read stream", Message_Fail);
Message::SendFail ("Error: unable to read stream");
return false;
}
@ -811,7 +803,7 @@ bool Image_AlienPixMap::Load (std::istream& ,
const TCollection_AsciiString& )
{
Clear();
Message::DefaultMessenger()->Send ("Error: no image library available", Message_Fail);
Message::SendFail ("Error: no image library available");
return false;
}
bool Image_AlienPixMap::Load (const Standard_Byte* ,
@ -819,7 +811,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* ,
const TCollection_AsciiString& )
{
Clear();
Message::DefaultMessenger()->Send ("Error: no image library available", Message_Fail);
Message::SendFail ("Error: no image library available");
return false;
}
#endif
@ -1059,7 +1051,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
if (aFileFormat == getNullGuid())
{
Message::DefaultMessenger()->Send ("Error: unsupported image format", Message_Fail);
Message::SendFail ("Error: unsupported image format");
return false;
}
@ -1067,7 +1059,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
CoInitializeEx (NULL, COINIT_MULTITHREADED);
if (CoCreateInstance (CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&aWicImgFactory.ChangePtr())) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot initialize WIC Imaging Factory", Message_Fail);
Message::SendFail ("Error: cannot initialize WIC Imaging Factory");
return false;
}
@ -1077,20 +1069,20 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
if (aWicImgFactory->CreateStream (&aWicFileStream.ChangePtr()) != S_OK
|| aWicFileStream->InitializeFromFilename (aFileNameW.ToWideString(), GENERIC_WRITE) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot create WIC File Stream", Message_Fail);
Message::SendFail ("Error: cannot create WIC File Stream");
return false;
}
if (aWicImgFactory->CreateEncoder (aFileFormat, NULL, &aWicEncoder.ChangePtr()) != S_OK
|| aWicEncoder->Initialize (aWicFileStream.get(), WICBitmapEncoderNoCache) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot create WIC Encoder", Message_Fail);
Message::SendFail ("Error: cannot create WIC Encoder");
return false;
}
const WICPixelFormatGUID aWicPixelFormat = convertToWicFormat (myImgFormat);
if (aWicPixelFormat == getNullGuid())
{
Message::DefaultMessenger()->Send ("Error: unsupported pixel format", Message_Fail);
Message::SendFail ("Error: unsupported pixel format");
return false;
}
@ -1101,13 +1093,13 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
|| aWicFrameEncode->SetSize ((UINT )SizeX(), (UINT )SizeY()) != S_OK
|| aWicFrameEncode->SetPixelFormat (&aWicPixelFormatRes) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot create WIC Frame", Message_Fail);
Message::SendFail ("Error: cannot create WIC Frame");
return false;
}
if (aWicPixelFormatRes != aWicPixelFormat)
{
Message::DefaultMessenger()->Send ("Error: pixel format is unsupported by image format", Message_Fail);
Message::SendFail ("Error: pixel format is unsupported by image format");
return false;
}
@ -1115,7 +1107,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
{
if (aWicFrameEncode->WritePixels ((UINT )SizeY(), (UINT )SizeRowBytes(), (UINT )SizeBytes(), (BYTE* )Data()) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot write pixels to WIC Frame", Message_Fail);
Message::SendFail ("Error: cannot write pixels to WIC Frame");
return false;
}
}
@ -1125,7 +1117,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
{
if (aWicFrameEncode->WritePixels (1, (UINT )SizeRowBytes(), (UINT )SizeRowBytes(), (BYTE* )Row (aRow)) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot write pixels to WIC Frame", Message_Fail);
Message::SendFail ("Error: cannot write pixels to WIC Frame");
return false;
}
}
@ -1134,12 +1126,12 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
if (aWicFrameEncode->Commit() != S_OK
|| aWicEncoder->Commit() != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot commit data to WIC Frame", Message_Fail);
Message::SendFail ("Error: cannot commit data to WIC Frame");
return false;
}
if (aWicFileStream->Commit (STGC_DEFAULT) != S_OK)
{
//Message::DefaultMessenger()->Send ("Error: cannot commit data to WIC File Stream", Message_Fail);
//Message::Send ("Error: cannot commit data to WIC File Stream", Message_Fail);
//return false;
}
return true;
@ -1150,9 +1142,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
{
return savePPM (theFileName);
}
#ifdef OCCT_DEBUG
std::cerr << "Image_PixMap, no image library available! Image saved in PPM format.\n";
#endif
Message::SendTrace ("Image_PixMap, no image library available! Image saved in PPM format");
return savePPM (theFileName);
#endif
}

View File

@ -111,13 +111,13 @@ Standard_Boolean Image_Diff::Init (const Handle(Image_PixMap)& theImageRef,
|| theImageRef->SizeY() != theImageNew->SizeY()
|| theImageRef->Format() != theImageNew->Format())
{
Message::DefaultMessenger()->Send ("Error: Images have different format or dimensions", Message_Fail);
Message::SendFail ("Error: Images have different format or dimensions");
return Standard_False;
}
else if (theImageRef->SizeX() >= 0xFFFF
|| theImageRef->SizeY() >= 0xFFFF)
{
Message::DefaultMessenger()->Send ("Error: Images are too large", Message_Fail);
Message::SendFail ("Error: Images are too large");
return Standard_False;
}
@ -144,7 +144,7 @@ Standard_Boolean Image_Diff::Init (const TCollection_AsciiString& theImgPathRef,
if (!anImgRef->Load (theImgPathRef)
|| !anImgNew->Load (theImgPathNew))
{
Message::DefaultMessenger()->Send ("Error: Failed to load image(s) file(s)", Message_Fail);
Message::SendFail ("Error: Failed to load image(s) file(s)");
return Standard_False;
}
return Init (anImgRef, anImgNew, theToBlackWhite);

View File

@ -127,7 +127,7 @@ Handle(Image_PixMap) Image_Texture::loadImageBuffer (const Handle(NCollection_Bu
}
else if (theBuffer->Size() > (Standard_Size )IntegerLast())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image file size is too big '") + theId + "'.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image file size is too big '") + theId + "'");
return Handle(Image_PixMap)();
}
@ -149,7 +149,7 @@ Handle(Image_PixMap) Image_Texture::loadImageOffset (const TCollection_AsciiStri
{
if (theLength > IntegerLast())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image file size is too big '") + thePath + "'.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image file size is too big '") + thePath + "'");
return Handle(Image_PixMap)();
}
@ -157,13 +157,13 @@ Handle(Image_PixMap) Image_Texture::loadImageOffset (const TCollection_AsciiStri
OSD_OpenStream (aFile, thePath.ToCString(), std::ios::in | std::ios::binary);
if (!aFile)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image file '") + thePath + "' cannot be opened.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image file '") + thePath + "' cannot be opened");
return Handle(Image_PixMap)();
}
aFile.seekg ((std::streamoff )theOffset, std::ios_base::beg);
if (!aFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + thePath + "'.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + thePath + "'");
return Handle(Image_PixMap)();
}
@ -193,7 +193,7 @@ TCollection_AsciiString Image_Texture::ProbeImageFileFormat() const
OSD_OpenStream (aFileIn, myImagePath.ToCString(), std::ios::in | std::ios::binary);
if (!aFileIn)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Unable to open file ") + myImagePath + "!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Unable to open file '") + myImagePath + "'");
return false;
}
if (myOffset >= 0)
@ -201,14 +201,14 @@ TCollection_AsciiString Image_Texture::ProbeImageFileFormat() const
aFileIn.seekg ((std::streamoff )myOffset, std::ios_base::beg);
if (!aFileIn.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + myImagePath + "'.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + myImagePath + "'");
return false;
}
}
if (!aFileIn.read (aBuffer, THE_PROBE_SIZE))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: unable to read image file '") + myImagePath + "'", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: unable to read image file '") + myImagePath + "'");
return false;
}
}
@ -256,7 +256,7 @@ Standard_Boolean Image_Texture::WriteImage (const TCollection_AsciiString& theFi
OSD_OpenStream (aFileIn, myImagePath.ToCString(), std::ios::in | std::ios::binary);
if (!aFileIn)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Unable to open file ") + myImagePath + "!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Unable to open file ") + myImagePath + "!");
return Standard_False;
}
@ -266,7 +266,7 @@ Standard_Boolean Image_Texture::WriteImage (const TCollection_AsciiString& theFi
aFileIn.seekg ((std::streamoff )myOffset, std::ios_base::beg);
if (!aFileIn.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + myImagePath + "'.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + myImagePath + "'");
return Standard_False;
}
}
@ -280,7 +280,7 @@ Standard_Boolean Image_Texture::WriteImage (const TCollection_AsciiString& theFi
aBuffer = new NCollection_Buffer (NCollection_BaseAllocator::CommonBaseAllocator(), aLen);
if (!aFileIn.read ((char* )aBuffer->ChangeData(), aBuffer->Size()))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: unable to read image file '") + myImagePath + "'", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: unable to read image file '") + myImagePath + "'");
return Standard_False;
}
}
@ -289,7 +289,7 @@ Standard_Boolean Image_Texture::WriteImage (const TCollection_AsciiString& theFi
OSD_OpenStream (aFileOut, theFile.ToCString(), std::ios::out | std::ios::binary | std::ios::trunc);
if (!aFileOut)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Unable to create file ") + theFile + "!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Unable to create file '") + theFile + "'");
return Standard_False;
}
@ -297,7 +297,7 @@ Standard_Boolean Image_Texture::WriteImage (const TCollection_AsciiString& theFi
aFileOut.close();
if (!aFileOut.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Unable to write file ") + theFile + "!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Unable to write file '") + theFile + "'");
return Standard_False;
}
return Standard_True;

View File

@ -178,7 +178,7 @@ Standard_Boolean Image_VideoRecorder::Open (const char* theFileName,
avformat_alloc_output_context2 (&myAVContext, NULL, theParams.Format.IsEmpty() ? NULL : theParams.Format.ToCString(), theFileName);
if (myAVContext == NULL)
{
::Message::DefaultMessenger()->Send ("ViewerTest_VideoRecorder, could not deduce output format from file extension", Message_Fail);
::Message::SendFail ("ViewerTest_VideoRecorder, could not deduce output format from file extension");
return Standard_False;
}
@ -206,8 +206,7 @@ Standard_Boolean Image_VideoRecorder::Open (const char* theFileName,
const int aResAv = avio_open (&myAVContext->pb, theFileName, AVIO_FLAG_WRITE);
if (aResAv < 0)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: could not open '") + theFileName + "', " + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: could not open '") + theFileName + "', " + formatAvError (aResAv));
Close();
return Standard_False;
}
@ -217,8 +216,7 @@ Standard_Boolean Image_VideoRecorder::Open (const char* theFileName,
const int aResAv = avformat_write_header (myAVContext, NULL);
if (aResAv < 0)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not open output file '") + theFileName + "', " + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not open output file '") + theFileName + "', " + formatAvError (aResAv));
Close();
return Standard_False;
}
@ -254,8 +252,7 @@ Standard_Boolean Image_VideoRecorder::addVideoStream (const Image_VideoParams& t
}
if (myVideoCodec == NULL)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not find encoder for ") + aCodecName;
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not find encoder for ") + aCodecName);
return Standard_False;
}
@ -263,8 +260,7 @@ Standard_Boolean Image_VideoRecorder::addVideoStream (const Image_VideoParams& t
myVideoStream = avformat_new_stream (myAVContext, myVideoCodec);
if (myVideoStream == NULL)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not allocate stream!");
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail ("Error: can not allocate stream");
return Standard_False;
}
myVideoStream->id = myAVContext->nb_streams - 1;
@ -357,8 +353,7 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
const AVPixelFormat aPixFormat = av_get_pix_fmt (theParams.PixelFormat.ToCString());
if (aPixFormat == AV_PIX_FMT_NONE)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: unknown pixel format has been specified '") + theParams.PixelFormat + "'";
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: unknown pixel format has been specified '") + theParams.PixelFormat + "'");
return Standard_False;
}
@ -378,8 +373,7 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
}
if (aResAv < 0)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not open video codec, ") + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not open video codec, ") + formatAvError (aResAv));
return Standard_False;
}
@ -387,8 +381,7 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
myFrame = av_frame_alloc();
if (myFrame == NULL)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not allocate video frame!");
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail ("Error: can not allocate video frame");
return Standard_False;
}
@ -399,9 +392,8 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
{
memset (myFrame->data, 0, sizeof(myFrame->data));
memset (myFrame->linesize, 0, sizeof(myFrame->linesize));
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not allocate picture ")
+ aCodecCtx->width+ "x" + aCodecCtx->height + ", " + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not allocate picture ")
+ aCodecCtx->width+ "x" + aCodecCtx->height + ", " + formatAvError (aResAv));
return Standard_False;
}
// copy data and linesize picture pointers to frame
@ -412,9 +404,8 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
const Standard_Size aStride = aCodecCtx->width + 16 - (aCodecCtx->width % 16);
if (!myImgSrcRgba.InitZero (Image_PixMap::ImgRGBA, aCodecCtx->width, aCodecCtx->height, aStride))
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not allocate RGBA32 picture ")
+ aCodecCtx->width+ "x" + aCodecCtx->height;
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not allocate RGBA32 picture ")
+ aCodecCtx->width+ "x" + aCodecCtx->height);
return Standard_False;
}
@ -423,8 +414,7 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
SWS_BICUBIC, NULL, NULL, NULL);
if (myScaleCtx == NULL)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not initialize the conversion context!");
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail ("Error: can not initialize the conversion context");
return Standard_False;
}
return Standard_True;
@ -463,8 +453,7 @@ Standard_Boolean Image_VideoRecorder::writeVideoFrame (const Standard_Boolean th
aResAv = avcodec_encode_video2 (aCodecCtx, &aPacket, theToFlush ? NULL : myFrame, &isGotPacket);
if (aResAv < 0)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not encode video frame, ") + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not encode video frame, ") + formatAvError (aResAv));
return Standard_False;
}
@ -490,8 +479,7 @@ Standard_Boolean Image_VideoRecorder::writeVideoFrame (const Standard_Boolean th
if (aResAv < 0)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not write video frame, ") + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not write video frame, ") + formatAvError (aResAv));
return Standard_False;
}

View File

@ -92,7 +92,7 @@ bool Media_CodecContext::Init (const AVStream& theStream,
myStreamIndex = theStream.index;
if (avcodec_parameters_to_context (myCodecCtx, theStream.codecpar) < 0)
{
Message::DefaultMessenger()->Send ("Internal error: unable to copy codec parameters", Message_Fail);
Message::SendFail ("Internal error: unable to copy codec parameters");
Close();
return false;
}
@ -105,7 +105,7 @@ bool Media_CodecContext::Init (const AVStream& theStream,
myCodec = avcodec_find_decoder (aCodecId);
if (myCodec == NULL)
{
Message::DefaultMessenger()->Send ("FFmpeg: unable to find decoder", Message_Fail);
Message::Send ("FFmpeg: unable to find decoder", Message_Fail);
Close();
return false;
}
@ -120,7 +120,7 @@ bool Media_CodecContext::Init (const AVStream& theStream,
if (avcodec_open2 (myCodecCtx, myCodec, &anOpts) < 0)
{
Message::DefaultMessenger()->Send ("FFmpeg: unable to open decoder", Message_Fail);
Message::SendFail ("FFmpeg: unable to open decoder");
Close();
return false;
}
@ -147,7 +147,7 @@ bool Media_CodecContext::Init (const AVStream& theStream,
&& (myCodecCtx->width <= 0
|| myCodecCtx->height <= 0))
{
Message::DefaultMessenger()->Send ("FFmpeg: video stream has invalid dimensions", Message_Fail);
Message::SendFail ("FFmpeg: video stream has invalid dimensions");
Close();
return false;
}

View File

@ -257,8 +257,8 @@ bool Media_FormatContext::OpenInput (const TCollection_AsciiString& theInput)
const int avErrCode = avformat_open_input (&myFormatCtx, theInput.ToCString(), NULL, NULL);
if (avErrCode != 0)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("FFmpeg: Couldn't open video file '") + theInput
+ "'\nError: " + FormatAVErrorDescription (avErrCode), Message_Fail);
Message::SendFail (TCollection_AsciiString ("FFmpeg: Couldn't open video file '") + theInput
+ "'\nError: " + FormatAVErrorDescription (avErrCode));
Close();
return false;
}
@ -266,7 +266,7 @@ bool Media_FormatContext::OpenInput (const TCollection_AsciiString& theInput)
// retrieve stream information
if (avformat_find_stream_info (myFormatCtx, NULL) < 0)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("FFmpeg: Couldn't find stream information in '") + theInput + "'", Message_Fail);
Message::SendFail (TCollection_AsciiString ("FFmpeg: Couldn't find stream information in '") + theInput + "'");
Close();
return false;
}
@ -306,7 +306,7 @@ bool Media_FormatContext::OpenInput (const TCollection_AsciiString& theInput)
return true;
#else
Message::DefaultMessenger()->Send ("Error: FFmpeg library is unavailable", Message_Fail);
Message::SendFail ("Error: FFmpeg library is unavailable");
(void )theInput;
return false;
#endif
@ -514,9 +514,8 @@ bool Media_FormatContext::SeekStream (unsigned int theStreamId,
: (aStream.codecpar->codec_type == AVMEDIA_TYPE_AUDIO
? "Audio"
: "");
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error while seeking ") + aStreamType + " stream to "
+ theSeekPts + " sec (" + (theSeekPts + StreamUnitsToSeconds (aStream, aStream.start_time)) + " sec)",
Message_Warning);
Message::SendWarning (TCollection_AsciiString ("Error while seeking ") + aStreamType + " stream to "
+ theSeekPts + " sec (" + (theSeekPts + StreamUnitsToSeconds (aStream, aStream.start_time)) + " sec)");
return false;
#else
(void )theStreamId;
@ -548,7 +547,7 @@ bool Media_FormatContext::Seek (double theSeekPts,
myFormatCtx->filename;
#endif
Message::DefaultMessenger()->Send (TCollection_AsciiString("Disaster! Seeking to ") + theSeekPts + " [" + aFileName + "] has failed.", Message_Warning);
Message::SendWarning (TCollection_AsciiString("Disaster! Seeking to ") + theSeekPts + " [" + aFileName + "] has failed.");
return false;
#else
(void )theSeekPts;

View File

@ -139,7 +139,7 @@ Handle(Media_Frame) Media_PlayerContext::DumpFirstFrame (const TCollection_Ascii
#endif
if (aVideoCtx.IsNull())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("FFmpeg: no video stream in '") + theSrcVideo + "'", Message_Fail);
Message::SendFail (TCollection_AsciiString ("FFmpeg: no video stream in '") + theSrcVideo + "'");
return Handle(Media_Frame)();
}
@ -149,7 +149,7 @@ Handle(Media_Frame) Media_PlayerContext::DumpFirstFrame (const TCollection_Ascii
{
if (!aFormatCtx->ReadPacket (aPacket))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("FFmpeg: unable to read from '") + theSrcVideo + "'", Message_Fail);
Message::SendFail (TCollection_AsciiString ("FFmpeg: unable to read from '") + theSrcVideo + "'");
return Handle(Media_Frame)();
}
if (!aVideoCtx->CanProcessPacket (aPacket))
@ -167,7 +167,7 @@ Handle(Media_Frame) Media_PlayerContext::DumpFirstFrame (const TCollection_Ascii
|| aFrame->SizeX() < 1
|| aFrame->SizeY() < 1)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("FFmpeg: unable to decode first video frame from '") + theSrcVideo + "'", Message_Fail);
Message::SendFail (TCollection_AsciiString ("FFmpeg: unable to decode first video frame from '") + theSrcVideo + "'");
return Handle(Media_Frame)();
}
return aFrame;
@ -205,7 +205,7 @@ bool Media_PlayerContext::DumpFirstFrame (const TCollection_AsciiString& theSrcV
}
if (!aPixMap->InitZero (Image_Format_RGB, aResSizeX, aResSizeY))
{
Message::DefaultMessenger()->Send ("FFmpeg: Failed allocation of RGB frame (out of memory)", Message_Fail);
Message::SendFail ("FFmpeg: Failed allocation of RGB frame (out of memory)");
return false;
}
@ -218,7 +218,7 @@ bool Media_PlayerContext::DumpFirstFrame (const TCollection_AsciiString& theSrcV
Media_Scaler aScaler;
if (!aScaler.Convert (aFrame, anRgbFrame))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("FFmpeg: unable to convert frame into RGB '") + theSrcVideo + "'", Message_Fail);
Message::SendFail (TCollection_AsciiString ("FFmpeg: unable to convert frame into RGB '") + theSrcVideo + "'");
return false;
}
}
@ -421,7 +421,7 @@ bool Media_PlayerContext::receiveFrame (const Handle(Media_Frame)& theFrame,
const int aBufSize = aLineSize * aSize.y();
if (!myBufferPools[0]->Init (aBufSize))
{
Message::DefaultMessenger()->Send ("FFmpeg: unable to allocate RGB24 frame buffer", Message_Fail);
Message::SendFail ("FFmpeg: unable to allocate RGB24 frame buffer");
return false;
}
@ -430,7 +430,7 @@ bool Media_PlayerContext::receiveFrame (const Handle(Media_Frame)& theFrame,
if (aFrame->buf[0] == NULL)
{
theFrame->Unref();
Message::DefaultMessenger()->Send ("FFmpeg: unable to allocate RGB24 frame buffer", Message_Fail);
Message::SendFail ("FFmpeg: unable to allocate RGB24 frame buffer");
return false;
}
@ -461,7 +461,7 @@ bool Media_PlayerContext::receiveFrame (const Handle(Media_Frame)& theFrame,
|| !myBufferPools[1]->Init (aBufSizeUV)
|| !myBufferPools[2]->Init (aBufSizeUV))
{
Message::DefaultMessenger()->Send ("FFmpeg: unable to allocate YUV420P frame buffers", Message_Fail);
Message::SendFail ("FFmpeg: unable to allocate YUV420P frame buffers");
return false;
}
@ -474,7 +474,7 @@ bool Media_PlayerContext::receiveFrame (const Handle(Media_Frame)& theFrame,
|| aFrame->buf[2] == NULL)
{
theFrame->Unref();
Message::DefaultMessenger()->Send ("FFmpeg: unable to allocate YUV420P frame buffers", Message_Fail);
Message::SendFail ("FFmpeg: unable to allocate YUV420P frame buffers");
return false;
}
@ -567,7 +567,7 @@ void Media_PlayerContext::doThreadLoop()
#endif
if (aVideoCtx.IsNull())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("FFmpeg: no video stream in '") + anInput + "'", Message_Fail);
Message::SendFail (TCollection_AsciiString ("FFmpeg: no video stream in '") + anInput + "'");
continue;
}

View File

@ -2970,8 +2970,8 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
#endif
if (!myIsSRgbWindow)
{
Message::DefaultMessenger()->Send ("OpenGl_Context, warning: window buffer is not sRGB-ready.\n"
"Check OpenGL window creation parameters for optimal performance.", Message_Trace);
Message::SendTrace ("OpenGl_Context, warning: window buffer is not sRGB-ready.\n"
"Check OpenGL window creation parameters for optimal performance.");
}
}

View File

@ -146,7 +146,7 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnectio
int aDummy;
if (!XQueryExtension (aDisplay, "GLX", &aDummy, &aDummy, &aDummy))
{
::Message::DefaultMessenger()->Send ("OpenGl_GraphicDriver, this system doesn't appear to support OpenGL!", Message_Warning);
::Message::SendWarning ("OpenGl_GraphicDriver, this system doesn't appear to support OpenGL");
}
#endif
#endif
@ -235,7 +235,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
{
if (eglMakeCurrent ((EGLDisplay )myEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) != EGL_TRUE)
{
::Message::DefaultMessenger()->Send ("OpenGl_GraphicDriver, FAILED to release OpenGL context!", Message_Warning);
::Message::SendWarning ("OpenGl_GraphicDriver, FAILED to release OpenGL context");
}
eglDestroyContext ((EGLDisplay )myEglDisplay, (EGLContext )myEglContext);
}
@ -244,7 +244,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
{
if (eglTerminate ((EGLDisplay )myEglDisplay) != EGL_TRUE)
{
::Message::DefaultMessenger()->Send ("OpenGl_GraphicDriver, EGL, eglTerminate FAILED!", Message_Warning);
::Message::SendWarning ("OpenGl_GraphicDriver, EGL, eglTerminate FAILED");
}
}
}
@ -277,21 +277,21 @@ Standard_Boolean OpenGl_GraphicDriver::InitContext()
#endif
if ((EGLDisplay )myEglDisplay == EGL_NO_DISPLAY)
{
::Message::DefaultMessenger()->Send ("Error: no EGL display!", Message_Fail);
::Message::SendFail ("Error: no EGL display");
return Standard_False;
}
EGLint aVerMajor = 0; EGLint aVerMinor = 0;
if (eglInitialize ((EGLDisplay )myEglDisplay, &aVerMajor, &aVerMinor) != EGL_TRUE)
{
::Message::DefaultMessenger()->Send ("Error: EGL display is unavailable!", Message_Fail);
::Message::SendFail ("Error: EGL display is unavailable");
return Standard_False;
}
myEglConfig = chooseEglSurfConfig ((EGLDisplay )myEglDisplay);
if (myEglConfig == NULL)
{
::Message::DefaultMessenger()->Send ("Error: EGL does not provide compatible configurations!", Message_Fail);
::Message::SendFail ("Error: EGL does not provide compatible configurations");
return Standard_False;
}
@ -300,7 +300,7 @@ Standard_Boolean OpenGl_GraphicDriver::InitContext()
EGLint anEglCtxAttribs2[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE };
if (eglBindAPI (EGL_OPENGL_ES_API) != EGL_TRUE)
{
::Message::DefaultMessenger()->Send ("Error: EGL does not provide OpenGL ES client!", Message_Fail);
::Message::SendFail ("Error: EGL does not provide OpenGL ES client");
return Standard_False;
}
if (myCaps->contextMajorVersionUpper != 2)
@ -315,7 +315,7 @@ Standard_Boolean OpenGl_GraphicDriver::InitContext()
EGLint* anEglCtxAttribs = NULL;
if (eglBindAPI (EGL_OPENGL_API) != EGL_TRUE)
{
::Message::DefaultMessenger()->Send ("Error: EGL does not provide OpenGL client!", Message_Fail);
::Message::SendFail ("Error: EGL does not provide OpenGL client");
return Standard_False;
}
myEglContext = (Aspect_RenderingContext )eglCreateContext ((EGLDisplay )myEglDisplay, myEglConfig, EGL_NO_CONTEXT, anEglCtxAttribs);
@ -323,13 +323,13 @@ Standard_Boolean OpenGl_GraphicDriver::InitContext()
if ((EGLContext )myEglContext == EGL_NO_CONTEXT)
{
::Message::DefaultMessenger()->Send ("Error: EGL is unable to create OpenGL context!", Message_Fail);
::Message::SendFail ("Error: EGL is unable to create OpenGL context");
return Standard_False;
}
// eglMakeCurrent() fails or even crash with EGL_NO_SURFACE on some implementations
//if (eglMakeCurrent ((EGLDisplay )myEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, (EGLContext )myEglContext) != EGL_TRUE)
//{
// ::Message::DefaultMessenger()->Send ("Error: EGL is unable bind OpenGL context!", Message_Fail);
// ::Message::SendFail ("Error: EGL is unable bind OpenGL context");
// return Standard_False;
//}
#endif
@ -367,7 +367,7 @@ Standard_Boolean OpenGl_GraphicDriver::InitEglContext (Aspect_Display t
myEglConfig = chooseEglSurfConfig ((EGLDisplay )myEglDisplay);
if (myEglConfig == NULL)
{
::Message::DefaultMessenger()->Send ("Error: EGL does not provide compatible configurations!", Message_Fail);
::Message::SendFail ("Error: EGL does not provide compatible configurations");
return Standard_False;
}
}

View File

@ -455,9 +455,9 @@ void OpenGl_PBREnvironment::bake (const Handle(OpenGl_Context)& theCtx,
if (processSpecIBLMap (theCtx, true, theEnvMap->SizeX(), theSpecNbSamples, theProbability)
&& processDiffIBLMap (theCtx, true, theDiffNbSamples))
{
Message::DefaultMessenger()->Send(TCollection_AsciiString()
Message::SendTrace(TCollection_AsciiString()
+ "IBL " + myIBLMaps[OpenGl_TypeOfIBLMap_Specular].SizeX() + "x" + myIBLMaps[OpenGl_TypeOfIBLMap_Specular].SizeY()
+ " is baked in " + aTimer.ElapsedTime() + " s", Message_Trace);
+ " is baked in " + aTimer.ElapsedTime() + " s");
}
else
{

View File

@ -438,7 +438,7 @@ static bool dumpShaderSource (const TCollection_AsciiString& theFileName,
}
if (!aFile.IsOpen())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Error: File '") + theFileName + "' cannot be opened to save shader", Message_Fail);
Message::SendFail (TCollection_AsciiString("Error: File '") + theFileName + "' cannot be opened to save shader");
return false;
}
@ -447,7 +447,7 @@ static bool dumpShaderSource (const TCollection_AsciiString& theFileName,
aFile.Write (aSource.ToCString(), aSource.Length());
}
aFile.Close();
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Shader source dumped into '") + theFileName + "'", Message_Warning);
Message::SendWarning (TCollection_AsciiString ("Shader source dumped into '") + theFileName + "'");
return true;
}
@ -459,7 +459,7 @@ static bool restoreShaderSource (TCollection_AsciiString& theSource,
aFile.Open (OSD_ReadOnly, OSD_Protection());
if (!aFile.IsOpen())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + theFileName + "' cannot be opened to load shader", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + theFileName + "' cannot be opened to load shader");
return false;
}
@ -470,7 +470,7 @@ static bool restoreShaderSource (TCollection_AsciiString& theSource,
aFile.Read (theSource, aSize);
}
aFile.Close();
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Restored shader dump from '") + theFileName + "'", Message_Warning);
Message::SendWarning (TCollection_AsciiString ("Restored shader dump from '") + theFileName + "'");
return true;
}

View File

@ -124,7 +124,7 @@ Standard_Boolean RWGltf_CafReader::performMesh (const TCollection_AsciiString& t
if (!aFile.is_open()
|| !aFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + theFile + "' is not found!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + theFile + "' is not found");
return false;
}
@ -144,7 +144,7 @@ Standard_Boolean RWGltf_CafReader::performMesh (const TCollection_AsciiString& t
{
if (*aLen < 20)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + theFile + "' has broken glTF format!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + theFile + "' has broken glTF format");
return false;
}
@ -160,7 +160,7 @@ Standard_Boolean RWGltf_CafReader::performMesh (const TCollection_AsciiString& t
aBinBodyLen = int64_t(*aLen) - aBinBodyOffset;
if (*aSceneFormat != 0)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + theFile + "' is written using unsupported Scene format!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + theFile + "' is written using unsupported Scene format");
return false;
}
}
@ -168,7 +168,7 @@ Standard_Boolean RWGltf_CafReader::performMesh (const TCollection_AsciiString& t
{
if (*aVer != 2)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + theFile + "' is written using unknown version " + int(*aVer) + "!", Message_Warning);
Message::SendWarning (TCollection_AsciiString ("File '") + theFile + "' is written using unknown version " + int(*aVer));
}
for (int aChunkIter = 0; !aFile.eof() && aChunkIter < 2; ++aChunkIter)
@ -182,7 +182,7 @@ Standard_Boolean RWGltf_CafReader::performMesh (const TCollection_AsciiString& t
aFile.read (aChunkHeader2, sizeof(aChunkHeader2));
if (!aFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + theFile + "' is written using unsupported format!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + theFile + "' is written using unsupported format");
return false;
}
@ -246,12 +246,12 @@ Standard_Boolean RWGltf_CafReader::performMesh (const TCollection_AsciiString& t
{
if (aRes.Code() == rapidjson::kParseErrorDocumentEmpty)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + theFile + "' is empty!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + theFile + "' is empty");
return false;
}
TCollection_AsciiString anErrDesc (RWGltf_GltfJsonParser::FormatParseError (aRes.Code()));
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + theFile + "' defines invalid JSON document!\n"
+ anErrDesc + " [at offset " + (int )aRes.Offset() + "].", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + theFile + "' defines invalid JSON document!\n"
+ anErrDesc + " [at offset " + (int )aRes.Offset() + "].");
return false;
}
#endif

View File

@ -351,7 +351,7 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
if (!aBinFile.is_open()
|| !aBinFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be created!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be created");
return false;
}
@ -385,7 +385,7 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
if (!aBinFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be written!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be written");
return false;
}
@ -427,7 +427,7 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
if (!aBinFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be written!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be written");
return false;
}
}
@ -468,7 +468,7 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
if (!aBinFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be written!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be written");
return false;
}
}
@ -509,7 +509,7 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
if (!aBinFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be written!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be written");
return false;
}
}
@ -538,7 +538,7 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
aBinFile.close();
if (!aBinFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be written!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + myBinFileNameFull + "' can not be written");
return false;
}
return true;
@ -570,7 +570,7 @@ bool RWGltf_CafWriter::writeJson (const Handle(TDocStd_Document)& theDocument,
if (!aGltfContentFile.is_open()
|| !aGltfContentFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + aFileNameGltf + "' can not be created!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + aFileNameGltf + "' can not be created");
return false;
}
if (myIsBinary)
@ -643,7 +643,7 @@ bool RWGltf_CafWriter::writeJson (const Handle(TDocStd_Document)& theDocument,
aGltfContentFile.close();
if (!aGltfContentFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + aFileNameGltf + "' can not be written!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + aFileNameGltf + "' can not be written");
return false;
}
return true;
@ -670,7 +670,7 @@ bool RWGltf_CafWriter::writeJson (const Handle(TDocStd_Document)& theDocument,
if (!aBinFile.is_open()
|| !aBinFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + myBinFileNameFull + "' cannot be opened!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + myBinFileNameFull + "' cannot be opened");
return false;
}
char aBuffer[4096];
@ -689,13 +689,12 @@ bool RWGltf_CafWriter::writeJson (const Handle(TDocStd_Document)& theDocument,
OSD_File (aBinFilePath).Remove();
if (OSD_File (aBinFilePath).Exists())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Unable to remove temporary glTF content file '")
+ myBinFileNameFull + "'!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Unable to remove temporary glTF content file '") + myBinFileNameFull + "'");
}
}
else
{
Message::DefaultMessenger()->Send ("glTF file content is too big for binary format!", Message_Fail);
Message::SendFail ("glTF file content is too big for binary format");
return false;
}
@ -708,7 +707,7 @@ bool RWGltf_CafWriter::writeJson (const Handle(TDocStd_Document)& theDocument,
aGltfContentFile.close();
if (!aGltfContentFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("File '") + aFileNameGltf + "' can not be written!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("File '") + aFileNameGltf + "' can not be written");
return false;
}
@ -720,7 +719,7 @@ bool RWGltf_CafWriter::writeJson (const Handle(TDocStd_Document)& theDocument,
(void )theLabelFilter;
(void )theFileInfo;
(void )theProgress;
Message::DefaultMessenger()->Send ("Error: glTF writer is unavailable - OCCT has been built without RapidJSON support [HAVE_RAPIDJSON undefined].", Message_Fail);
Message::SendFail ("Error: glTF writer is unavailable - OCCT has been built without RapidJSON support [HAVE_RAPIDJSON undefined]");
return false;
#endif
}

View File

@ -141,8 +141,7 @@ void RWGltf_GltfJsonParser::GltfElementMap::Init (const TCollection_AsciiString&
const TCollection_AsciiString aKey (aChildIter->name.GetString());
if (!myChildren.Bind (aKey, &aChildIter->value))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Invalid glTF syntax - key '")
+ aKey + "' is already defined in '" + theRootName + "'.", Message_Warning);
Message::SendWarning (TCollection_AsciiString ("Invalid glTF syntax - key '") + aKey + "' is already defined in '" + theRootName + "'.");
}
}
}
@ -169,7 +168,7 @@ void RWGltf_GltfJsonParser::GltfElementMap::Init (const TCollection_AsciiString&
void RWGltf_GltfJsonParser::reportGltfSyntaxProblem (const TCollection_AsciiString& theMsg,
Message_Gravity theGravity)
{
Message::DefaultMessenger()->Send (myErrorPrefix + theMsg, theGravity);
Message::Send (myErrorPrefix + theMsg, theGravity);
}
// =======================================================================
@ -422,7 +421,7 @@ void RWGltf_GltfJsonParser::gltfBindMaterial (const Handle(RWGltf_MaterialMetall
anAlphaMode = Graphic3d_AlphaMode_Opaque;
if (aMatXde.BaseColor.Alpha() < 1.0f)
{
Message::DefaultMessenger()->Send ("glTF reader - material with non-zero Transparency specifies Opaque AlphaMode", Message_Warning);
Message::SendWarning ("glTF reader - material with non-zero Transparency specifies Opaque AlphaMode");
}
break;
}
@ -810,7 +809,7 @@ bool RWGltf_GltfJsonParser::gltfParseTexture (Handle(Image_Texture)& theTexture,
return true;
}
}
Message::DefaultMessenger()->Send ("glTF reader - embedded image has been skipped", Message_Warning);
Message::SendWarning ("glTF reader - embedded image has been skipped");
return false;
}
@ -1205,9 +1204,8 @@ bool RWGltf_GltfJsonParser::gltfParseSceneNode (TopoDS_Shape& theNodeShape,
aMat4.GetValue (1, 0), aMat4.GetValue (1, 1), aMat4.GetValue (1, 2), aMat4.GetValue (1, 3),
aMat4.GetValue (2, 0), aMat4.GetValue (2, 1), aMat4.GetValue (2, 2), aMat4.GetValue (2, 3));
Message::DefaultMessenger()->Send (TCollection_AsciiString ("glTF reader, scene node '")
+ theSceneNodeId + "' defines unsupported scaling "
+ aScaleVec.x() + " " + aScaleVec.y() + " " + aScaleVec.z(), Message_Warning);
Message::SendWarning (TCollection_AsciiString ("glTF reader, scene node '")
+ theSceneNodeId + "' defines unsupported scaling " + aScaleVec.x() + " " + aScaleVec.y() + " " + aScaleVec.z());
}
else if (Abs (aScaleVec.x() - 1.0) > Precision::Confusion())
{
@ -1428,8 +1426,7 @@ bool RWGltf_GltfJsonParser::gltfParsePrimArray (const Handle(RWGltf_GltfLatePrim
}
if (aMode != RWGltf_GltfPrimitiveMode_Triangles)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "Primitive array within Mesh '"
+ theMeshId + "' skipped due to unsupported mode.", Message_Warning);
Message::SendWarning (TCollection_AsciiString() + "Primitive array within Mesh '" + theMeshId + "' skipped due to unsupported mode");
return true;
}
theMeshData->SetPrimitiveMode (aMode);
@ -1935,7 +1932,7 @@ bool RWGltf_GltfJsonParser::Parse (const Handle(Message_ProgressIndicator)& theP
}
return true;
#else
Message::DefaultMessenger()->Send ("Error: glTF reader is unavailable - OCCT has been built without RapidJSON support [HAVE_RAPIDJSON undefined].", Message_Fail);
Message::SendFail ("Error: glTF reader is unavailable - OCCT has been built without RapidJSON support [HAVE_RAPIDJSON undefined]");
return false;
#endif
}

View File

@ -32,7 +32,7 @@ IMPLEMENT_STANDARD_RTTIEXT(RWGltf_PrimitiveArrayReader, Standard_Transient)
// =======================================================================
void RWGltf_PrimitiveArrayReader::reportError (const TCollection_AsciiString& theText)
{
Message::DefaultMessenger()->Send (myErrorPrefix + theText, Message_Fail);
Message::SendFail (myErrorPrefix + theText);
}
// =======================================================================

View File

@ -111,7 +111,7 @@ bool RWGltf_TriangulationReader::readBuffer (std::istream& theStream,
{
if (theMode != RWGltf_GltfPrimitiveMode_Triangles)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Buffer '") + theName + "' skipped unsupported primitive array.", Message_Warning);
Message::SendWarning (TCollection_AsciiString("Buffer '") + theName + "' skipped unsupported primitive array");
return true;
}

View File

@ -141,9 +141,9 @@ Standard_Boolean RWMesh_CafReader::perform (const TCollection_AsciiString& theFi
aLoadingTimer.Stop();
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Mesh ") + theFile
+ "\n[" + aNbNodes + " nodes] [" + aNbElems + " 2d elements]"
+ "\n[" + (!isDone ? "PARTIALLY " : "") + "read in " + aLoadingTimer.ElapsedTime() + " s]", Message_Info);
Message::SendInfo (TCollection_AsciiString ("Mesh ") + theFile
+ "\n[" + aNbNodes + " nodes] [" + aNbElems + " 2d elements]"
+ "\n[" + (!isDone ? "PARTIALLY " : "") + "read in " + aLoadingTimer.ElapsedTime() + " s]");
return Standard_True;
}
@ -249,7 +249,7 @@ void RWMesh_CafReader::setShapeNamedData (const CafDocumentTools& ,
{
if (anOtherNamedData->Label() != aNameDataLabel)
{
Message::DefaultMessenger()->Send ("Error! Different NamedData is already set to shape", Message_Alarm);
Message::SendAlarm ("Error! Different NamedData is already set to shape");
}
}
else
@ -260,7 +260,7 @@ void RWMesh_CafReader::setShapeNamedData (const CafDocumentTools& ,
}
else
{
Message::DefaultMessenger()->Send ("Error! Skipped NamedData instance shared across shapes", Message_Alarm);
Message::SendAlarm ("Error! Skipped NamedData instance shared across shapes");
}
}
}

View File

@ -142,8 +142,7 @@ bool RWMesh_MaterialMap::copyFileTo (const TCollection_AsciiString& theFileSrc,
OSD_File aFileSrc (aSrcPath);
if (!aFileSrc.Exists())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Failed to copy file - source file '")
+ theFileSrc + "' does not exist\n", Message_Fail);
Message::SendFail (TCollection_AsciiString("Failed to copy file - source file '") + theFileSrc + "' does not exist");
return false;
}
aFileSrc.Copy (aDstPath);
@ -151,8 +150,7 @@ bool RWMesh_MaterialMap::copyFileTo (const TCollection_AsciiString& theFileSrc,
}
catch (Standard_Failure const& theException)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Failed to copy file\n") +
theException.GetMessageString(), Message_Fail);
Message::SendFail (TCollection_AsciiString("Failed to copy file\n") + theException.GetMessageString());
return false;
}
}

View File

@ -114,7 +114,7 @@ bool RWObj_MtlReader::Read (const TCollection_AsciiString& theFolder,
myFile = OSD_OpenFile (myPath.ToCString(), "rb");
if (myFile == NULL)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("OBJ material file '") + myPath + "' is not found!", Message_Warning);
Message::Send (TCollection_AsciiString ("OBJ material file '") + myPath + "' is not found!", Message_Warning);
return Standard_False;
}
@ -164,7 +164,7 @@ bool RWObj_MtlReader::Read (const TCollection_AsciiString& theFolder,
aMat = RWObj_Material();
if (!RWObj_Tools::ReadName (aPos, aMatName))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Empty OBJ material at line ") + myNbLines + " in file " + myPath, Message_Warning);
Message::SendWarning (TCollection_AsciiString("Empty OBJ material at line ") + myNbLines + " in file " + myPath);
}
}
else if (::memcmp (aPos, "Ka", 2) == 0
@ -319,8 +319,8 @@ void RWObj_MtlReader::processTexturePath (TCollection_AsciiString& theTexturePat
{
if (OSD_Path::IsAbsolutePath (theTexturePath.ToCString()))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("OBJ file specifies absolute path to the texture image file which may be inaccessible on another device\n")
+ theTexturePath, Message_Warning);
Message::SendWarning (TCollection_AsciiString("OBJ file specifies absolute path to the texture image file which may be inaccessible on another device\n")
+ theTexturePath);
if (!OSD_File (theTexturePath).Exists())
{
// workaround absolute filenames - try to find the same file at the OBJ file location
@ -346,7 +346,7 @@ bool RWObj_MtlReader::validateScalar (const Standard_Real theValue)
if (theValue < 0.0
|| theValue > 1.0)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Invalid scalar in OBJ material at line ") + myNbLines + " in file " + myPath, Message_Warning);
Message::SendWarning (TCollection_AsciiString("Invalid scalar in OBJ material at line ") + myNbLines + " in file " + myPath);
return false;
}
return true;
@ -362,7 +362,7 @@ bool RWObj_MtlReader::validateColor (const Graphic3d_Vec3& theVec)
|| theVec.g() < 0.0f || theVec.g() > 1.0f
|| theVec.b() < 0.0f || theVec.b() > 1.0f)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Invalid color in OBJ material at line ") + myNbLines + " in file " + myPath, Message_Warning);
Message::SendWarning (TCollection_AsciiString("Invalid color in OBJ material at line ") + myNbLines + " in file " + myPath);
return false;
}
return true;

View File

@ -144,7 +144,7 @@ Standard_Boolean RWObj_Reader::read (const TCollection_AsciiString& theFile,
RWObj_ReaderFile aFile (theFile);
if (aFile.File == NULL)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: file '") + theFile + "' is not found!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: file '") + theFile + "' is not found");
return Standard_False;
}
@ -152,7 +152,7 @@ Standard_Boolean RWObj_Reader::read (const TCollection_AsciiString& theFile,
const int64_t aFileLen = aFile.FileLen;
if (aFileLen <= 0L)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: file '") + theFile + "' is empty!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: file '") + theFile + "' is empty");
return Standard_False;
}
@ -310,8 +310,7 @@ Standard_Boolean RWObj_Reader::read (const TCollection_AsciiString& theFile,
}
if (myNbElemsBig != 0)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Warning: OBJ reader, ") + myNbElemsBig
+ " polygon(s) have been split into triangles.", Message_Warning);
Message::SendWarning (TCollection_AsciiString("Warning: OBJ reader, ") + myNbElemsBig + " polygon(s) have been split into triangles");
}
for (; aNbMiBPassed < aNbMiBTotal; ++aNbMiBPassed) { aPSentry.Next(); }
@ -386,8 +385,7 @@ void RWObj_Reader::pushIndices (const char* thePos)
if (a3Indices[0] < myObjVerts.Lower() || a3Indices[0] > myObjVerts.Upper())
{
myToAbort = true;
Message::DefaultMessenger()->Send (TCollection_AsciiString("Error: invalid OBJ syntax at line ") + myNbLines
+ ": vertex index is out of range.", Message_Fail);
Message::SendFail (TCollection_AsciiString("Error: invalid OBJ syntax at line ") + myNbLines + ": vertex index is out of range");
return;
}
@ -397,13 +395,13 @@ void RWObj_Reader::pushIndices (const char* thePos)
{
if (myObjVertsUV.IsEmpty())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Warning: invalid OBJ syntax at line ") + myNbLines
+ ": UV index is specified but no UV nodes are defined.", Message_Warning);
Message::SendWarning (TCollection_AsciiString("Warning: invalid OBJ syntax at line ") + myNbLines
+ ": UV index is specified but no UV nodes are defined");
}
else if (a3Indices[1] < myObjVertsUV.Lower() || a3Indices[1] > myObjVertsUV.Upper())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Warning: invalid OBJ syntax at line ") + myNbLines
+ ": UV index is out of range.", Message_Warning);
Message::SendWarning (TCollection_AsciiString("Warning: invalid OBJ syntax at line ") + myNbLines
+ ": UV index is out of range");
setNodeUV (anIndex,Graphic3d_Vec2 (0.0f, 0.0f));
}
else
@ -415,13 +413,13 @@ void RWObj_Reader::pushIndices (const char* thePos)
{
if (myObjNorms.IsEmpty())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Warning: invalid OBJ syntax at line ") + myNbLines
+ ": Normal index is specified but no Normals nodes are defined.", Message_Warning);
Message::SendWarning (TCollection_AsciiString("Warning: invalid OBJ syntax at line ") + myNbLines
+ ": Normal index is specified but no Normals nodes are defined");
}
else if (a3Indices[2] < myObjNorms.Lower() || a3Indices[2] > myObjNorms.Upper())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Warning: invalid OBJ syntax at line ") + myNbLines
+ ": Normal index is out of range.", Message_Warning);
Message::SendWarning (TCollection_AsciiString("Warning: invalid OBJ syntax at line ") + myNbLines
+ ": Normal index is out of range");
setNodeNormal (anIndex, Graphic3d_Vec3 (0.0f, 0.0f, 1.0f));
}
else
@ -649,8 +647,7 @@ Standard_Integer RWObj_Reader::triangulatePolygon (const NCollection_Array1<Stan
}
catch (Standard_Failure const& theFailure)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: exception raised during polygon split\n[")
+ theFailure.GetMessageString() + "]", Message_Warning);
Message::SendWarning (TCollection_AsciiString ("Error: exception raised during polygon split\n[") + theFailure.GetMessageString() + "]");
}
return triangulatePolygonFan (theIndices);
}
@ -732,8 +729,7 @@ void RWObj_Reader::pushMaterial (const char* theMaterialName)
}
else if (!myMaterials.IsBound (aNewMat))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Warning: use of undefined OBJ material at line ")
+ myNbLines, Message_Warning);
Message::SendWarning (TCollection_AsciiString("Warning: use of undefined OBJ material at line ") + myNbLines);
return;
}
if (myActiveSubMesh.Material.IsEqual (aNewMat))
@ -758,8 +754,7 @@ void RWObj_Reader::readMaterialLib (const char* theFileName)
TCollection_AsciiString aMatPath;
if (!RWObj_Tools::ReadName (theFileName, aMatPath))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString("Warning: invalid OBJ syntax at line ")
+ myNbLines, Message_Warning);
Message::SendWarning (TCollection_AsciiString("Warning: invalid OBJ syntax at line ") + myNbLines);
return;
}
@ -782,9 +777,9 @@ bool RWObj_Reader::checkMemory()
return true;
}
Message::DefaultMessenger()->Send (TCollection_AsciiString("Error: OBJ file content does not fit into ")
+ Standard_Integer(myMemLimitBytes / (1024 * 1024)) + " MiB limit."
+ "\nMesh data will be truncated.", Message_Fail);
Message::SendFail (TCollection_AsciiString("Error: OBJ file content does not fit into ")
+ Standard_Integer(myMemLimitBytes / (1024 * 1024)) + " MiB limit."
+ "\nMesh data will be truncated.");
myToAbort = true;
return false;
}

View File

@ -186,7 +186,7 @@ Standard_Boolean RWStl_Reader::IsAscii (Standard_IStream& theStream)
std::streamsize aNbRead = theStream.read (aBuffer, THE_STL_MIN_FILE_SIZE).gcount();
if (! theStream)
{
Message::DefaultMessenger()->Send ("Error: Cannot read file", Message_Fail);
Message::SendFail ("Error: Cannot read file");
return true;
}
@ -287,7 +287,7 @@ Standard_Boolean RWStl_Reader::ReadAscii (Standard_IStream& theStream,
aLine = theBuffer.ReadLine (theStream, aLineLen);
if (aLine == NULL)
{
Message::DefaultMessenger()->Send ("Error: premature end of file", Message_Fail);
Message::SendFail ("Error: premature end of file");
return false;
}
@ -314,7 +314,7 @@ Standard_Boolean RWStl_Reader::ReadAscii (Standard_IStream& theStream,
aLine = theBuffer.ReadLine (theStream, aLineLen); // "facet normal nx ny nz"
if (aLine == NULL)
{
Message::DefaultMessenger()->Send ("Error: premature end of file", Message_Fail);
Message::SendFail ("Error: premature end of file");
return false;
}
if (str_starts_with (aLine, "endsolid", 8))
@ -324,18 +324,14 @@ Standard_Boolean RWStl_Reader::ReadAscii (Standard_IStream& theStream,
}
if (!str_starts_with (aLine, "facet", 5))
{
TCollection_AsciiString aStr ("Error: unexpected format of facet at line ");
aStr += aNbLine + 1;
Message::DefaultMessenger()->Send (aStr, Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: unexpected format of facet at line ") + (aNbLine + 1));
return false;
}
aLine = theBuffer.ReadLine (theStream, aLineLen); // "outer loop"
if (aLine == NULL || !str_starts_with (aLine, "outer", 5))
{
TCollection_AsciiString aStr ("Error: unexpected format of facet at line ");
aStr += aNbLine + 1;
Message::DefaultMessenger()->Send (aStr, Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: unexpected format of facet at line ") + (aNbLine + 1));
return false;
}
@ -352,9 +348,7 @@ Standard_Boolean RWStl_Reader::ReadAscii (Standard_IStream& theStream,
gp_XYZ aReadVertex;
if (!ReadVertex (aLine, aReadVertex.ChangeCoord (1), aReadVertex.ChangeCoord (2), aReadVertex.ChangeCoord (3)))
{
TCollection_AsciiString aStr ("Error: cannot read vertex co-ordinates at line ");
aStr += aNbLine;
Message::DefaultMessenger()->Send (aStr, Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: cannot read vertex co-ordinates at line ") + aNbLine);
return false;
}
aVertex[i] = aReadVertex;
@ -401,7 +395,7 @@ Standard_Boolean RWStl_Reader::ReadBinary (Standard_IStream& theStream,
if ((theFileLen - THE_STL_HEADER_SIZE) % THE_STL_SIZEOF_FACET != 0
|| (theFileLen < THE_STL_MIN_FILE_SIZE))
{
Message::DefaultMessenger()->Send ("Error: Corrupted binary STL file (inconsistent file size)!", Message_Fail);
Message::SendFail ("Error: Corrupted binary STL file (inconsistent file size)");
return Standard_False;
}
const Standard_Integer aNbFacets = Standard_Integer((theFileLen - THE_STL_HEADER_SIZE) / THE_STL_SIZEOF_FACET);
@ -411,7 +405,7 @@ Standard_Boolean RWStl_Reader::ReadBinary (Standard_IStream& theStream,
char aHeader[THE_STL_HEADER_SIZE + 1];
if (theStream.read (aHeader, THE_STL_HEADER_SIZE).gcount() != std::streamsize(THE_STL_HEADER_SIZE))
{
Message::DefaultMessenger()->Send ("Error: Corrupted binary STL file!", Message_Fail);
Message::SendFail ("Error: Corrupted binary STL file");
return false;
}
@ -444,7 +438,7 @@ Standard_Boolean RWStl_Reader::ReadBinary (Standard_IStream& theStream,
const std::streamsize aDataToRead = aNbFacesInBuffer * aFaceDataLen;
if (theStream.read (aBuffer, aDataToRead).gcount() != aDataToRead)
{
Message::DefaultMessenger()->Send ("Error: binary STL read failed", Message_Fail);
Message::SendFail ("Error: binary STL read failed");
return false;
}
aBufferPtr = aBuffer;

View File

@ -136,7 +136,7 @@ Standard_Boolean StlAPI_Writer::Write (const TopoDS_Shape& theShape,
TCollection_AsciiString (aNbFacesNoTri) +
TCollection_AsciiString ((aNbFacesNoTri == 1) ? " face has" : " faces have") +
TCollection_AsciiString (" been skipped due to null triangulation");
Message::DefaultMessenger()->Send (aWarningMsg, Message_Warning);
Message::SendWarning (aWarningMsg);
}
return isDone;

View File

@ -2653,15 +2653,14 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
if (!theImage.InitZero (aFormat, Standard_Size(aTargetSize.x()), Standard_Size(aTargetSize.y())))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Fail to allocate an image ") + aTargetSize.x() + "x" + aTargetSize.y()
+ " for view dump", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Fail to allocate an image ") + aTargetSize.x() + "x" + aTargetSize.y() + " for view dump");
return Standard_False;
}
}
}
if (theImage.IsEmpty())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("V3d_View::ToPixMap() has been called without image dimensions"), Message_Fail);
Message::SendFail ("V3d_View::ToPixMap() has been called without image dimensions");
return Standard_False;
}
aTargetSize.x() = (Standard_Integer )theImage.SizeX();
@ -2704,8 +2703,8 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
if (theParams.TileSize > aMaxTexSizeX
|| theParams.TileSize > aMaxTexSizeY)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Image dump can not be performed - specified tile size (")
+ theParams.TileSize + ") exceeds hardware limits (" + aMaxTexSizeX + "x" + aMaxTexSizeY + ")", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Image dump can not be performed - specified tile size (")
+ theParams.TileSize + ") exceeds hardware limits (" + aMaxTexSizeX + "x" + aMaxTexSizeY + ")");
return Standard_False;
}
@ -2714,10 +2713,10 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
{
if (MyViewer->Driver()->InquireLimit (Graphic3d_TypeOfLimit_IsWorkaroundFBO))
{
Message::DefaultMessenger ()->Send (TCollection_AsciiString ("Warning, workaround for Intel driver problem with empty FBO for images with big width is applyed."), Message_Warning);
Message::SendWarning ("Warning, workaround for Intel driver problem with empty FBO for images with big width is applied");
}
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Info, tiling image dump is used, image size (")
+ aFBOVPSize.x() + "x" + aFBOVPSize.y() + ") exceeds hardware limits (" + aMaxTexSizeX + "x" + aMaxTexSizeY + ")", Message_Info);
Message::SendInfo (TCollection_AsciiString ("Info, tiling image dump is used, image size (")
+ aFBOVPSize.x() + "x" + aFBOVPSize.y() + ") exceeds hardware limits (" + aMaxTexSizeX + "x" + aMaxTexSizeY + ")");
aFBOVPSize.x() = Min (aFBOVPSize.x(), aMaxTexSizeX);
aFBOVPSize.y() = Min (aFBOVPSize.y(), aMaxTexSizeY);
isTiling = true;
@ -2740,7 +2739,7 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
}
aFBOVPSize = aWinSize;
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Warning, on screen buffer is used for image dump - content might be invalid"), Message_Warning);
Message::SendWarning ("Warning, on screen buffer is used for image dump - content might be invalid");
}
// backup camera parameters

View File

@ -162,7 +162,7 @@ Xw_Window::Xw_Window (const Handle(Aspect_DisplayConnection)& theXDisplay,
}
if (aVisInfo == NULL)
{
Message::DefaultMessenger()->Send ("Warning: cannot choose Visual using EGL while creating Xw_Window", Message_Warning);
Message::SendWarning ("Warning: cannot choose Visual using EGL while creating Xw_Window");
}
#else
int aDummy = 0;