If a Resource file with parameters for ShapeFix is absent, use static parameters instead if possible.
const TCollection_AsciiString& theUserDefaultsDirectory,
const Standard_Boolean theIsVerbose)
: myName (theName),
- myVerbose (theIsVerbose)
+ myVerbose (theIsVerbose),
+ myInitialized(Standard_False)
{
if (!theDefaultsDirectory.IsEmpty())
{
}
Resource_Manager::Resource_Manager(const Standard_CString aName,
- const Standard_Boolean Verbose) : myName(aName), myVerbose(Verbose)
+ const Standard_Boolean Verbose) : myName(aName), myVerbose(Verbose), myInitialized(Standard_False)
{
OSD_Environment envDebug("ResourceDebug");
Debug = (!envDebug.Value().IsEmpty()) ;
<< "\". File not found or permission denied." << std::endl;
return;
}
+ myInitialized = Standard_True;
Standard_Integer LineNumber = 1;
while ((aKind = WhatKindOfLine(File, Token1, Token2)) != Resource_KOL_End) {
switch (aKind) {
//! Returns internal Ref or User map with parameters
Standard_EXPORT Resource_DataMapOfAsciiStringAsciiString& GetMap(Standard_Boolean theRefMap = Standard_True);
+
+ //! Returns true if Resource have been found
+ Standard_Boolean IsInitialized() const { return myInitialized; }
private:
Resource_DataMapOfAsciiStringAsciiString myUserMap;
Resource_DataMapOfAsciiStringExtendedString myExtStrMap;
Standard_Boolean myVerbose;
+ Standard_Boolean myInitialized;
};
if (aContext.IsNull())
{
Standard_CString aRscfile = Interface_Static::CVal(thePrscfile);
- if (aRscfile != nullptr && strlen(aRscfile) == 0)
+ aContext = new ShapeProcess_ShapeContext(theShape, aRscfile);
+ if (!aContext->ResourceManager()->IsInitialized())
{
- aContext = new ShapeProcess_ShapeContext(theShape, nullptr);
+ // If resource file wasn't found, use static values instead
Interface_Static::FillMap(aContext->ResourceManager()->GetMap());
}
- else
- {
- if (!aRscfile)
- aRscfile = thePrscfile;
- aContext = new ShapeProcess_ShapeContext(theShape, aRscfile);
- }
aContext->SetDetalisation(theDetalisationLevel);
}
aContext->SetNonManifold(theNonManifold);