Message::DefaultMessenger()->Send() have been replaced by shortcuts Message::Send().
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
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
~~~~~
}
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;
}
}
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);
}
}
}
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);
}
}
}
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();
}
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 = "";
}
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);
}
}
}
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())
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;
}
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;
}
/*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;
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
}
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;
}
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));
}
}
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;
}
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)();
}
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)
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;
}
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;
}
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;
}
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
// =======================================================================
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");
}
// =======================================================================
// =======================================================================
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");
}
// =======================================================================
// =======================================================================
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");
}
// =======================================================================
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)
{
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;
}
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)();
}
myFontParams = theParams;
if (!myFTLib->IsValid())
{
- Message::DefaultMessenger()->Send ("FreeType library is unavailable", Message_Trace);
+ Message::SendTrace ("FreeType library is unavailable");
Release();
return false;
}
{
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;
}
{
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;
}
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;
}
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();
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)
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;
}
{
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)
{
{
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)();
}
{
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;
}
}
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");
}
}
}
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);
}
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;
}
}
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;
}
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
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;
}
}
|| 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;
}
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();
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;
}
}
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);
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;
}
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* ,
const TCollection_AsciiString& )
{
Clear();
- Message::DefaultMessenger()->Send ("Error: no image library available", Message_Fail);
+ Message::SendFail ("Error: no image library available");
return false;
}
#endif
if (aFileFormat == getNullGuid())
{
- Message::DefaultMessenger()->Send ("Error: unsupported image format", Message_Fail);
+ Message::SendFail ("Error: unsupported image format");
return false;
}
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;
}
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;
}
|| 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;
}
{
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;
}
}
{
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;
}
}
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;
{
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
}
|| 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;
}
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);
}
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)();
}
{
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)();
}
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)();
}
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)
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;
}
}
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;
}
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;
}
}
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;
}
}
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;
}
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;
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;
}
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;
}
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;
}
}
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;
}
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;
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;
}
}
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;
}
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;
}
{
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
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;
}
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;
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;
}
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;
}
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;
}
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;
}
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;
}
&& (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;
}
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;
}
// 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;
}
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
: (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;
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;
#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)();
}
{
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))
|| 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;
}
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;
}
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;
}
}
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;
}
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;
}
|| !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;
}
|| 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;
}
#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;
}
#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.");
}
}
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
{
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);
}
{
if (eglTerminate ((EGLDisplay )myEglDisplay) != EGL_TRUE)
{
- ::Message::DefaultMessenger()->Send ("OpenGl_GraphicDriver, EGL, eglTerminate FAILED!", Message_Warning);
+ ::Message::SendWarning ("OpenGl_GraphicDriver, EGL, eglTerminate FAILED");
}
}
}
#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;
}
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)
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);
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
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;
}
}
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
{
}
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;
}
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;
}
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;
}
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;
}
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;
}
{
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;
}
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;
}
}
{
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)
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;
}
{
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
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;
}
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;
}
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;
}
}
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;
}
}
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;
}
}
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;
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)
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;
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];
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;
}
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;
}
(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
}
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 + "'.");
}
}
}
void RWGltf_GltfJsonParser::reportGltfSyntaxProblem (const TCollection_AsciiString& theMsg,
Message_Gravity theGravity)
{
- Message::DefaultMessenger()->Send (myErrorPrefix + theMsg, theGravity);
+ Message::Send (myErrorPrefix + theMsg, theGravity);
}
// =======================================================================
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;
}
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;
}
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())
{
}
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);
}
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
}
// =======================================================================
void RWGltf_PrimitiveArrayReader::reportError (const TCollection_AsciiString& theText)
{
- Message::DefaultMessenger()->Send (myErrorPrefix + theText, Message_Fail);
+ Message::SendFail (myErrorPrefix + theText);
}
// =======================================================================
{
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;
}
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;
}
{
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
}
else
{
- Message::DefaultMessenger()->Send ("Error! Skipped NamedData instance shared across shapes", Message_Alarm);
+ Message::SendAlarm ("Error! Skipped NamedData instance shared across shapes");
}
}
}
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);
}
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;
}
}
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;
}
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
{
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
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;
|| 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;
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;
}
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;
}
}
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(); }
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;
}
{
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
{
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
}
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);
}
}
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))
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;
}
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;
}
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;
}
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;
}
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))
}
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;
}
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;
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);
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;
}
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;
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;
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();
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;
}
{
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;
}
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
}
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;