-using namespace std;
+#include <Standard_Stream.hxx>
-#include "GEOMImpl_IInsertOperations.hxx"
+#include <GEOMImpl_IInsertOperations.hxx>
#include "utilities.h"
-#include "OpUtil.hxx"
-#include "Utils_ExceptHandlers.hxx"
+#include <OpUtil.hxx>
+#include <Utils_ExceptHandlers.hxx>
#include <TFunction_DriverTable.hxx>
#include <TFunction_Driver.hxx>
#include <TFunction_Logbook.hxx>
#include <TDF_Tool.hxx>
-#include "GEOM_Function.hxx"
-#include "GEOM_PythonDump.hxx"
+#include <GEOM_Function.hxx>
+#include <GEOM_PythonDump.hxx>
-#include "GEOMImpl_CopyDriver.hxx"
-#include "GEOMImpl_ExportDriver.hxx"
-#include "GEOMImpl_ImportDriver.hxx"
+#include <GEOMImpl_CopyDriver.hxx>
+#include <GEOMImpl_ExportDriver.hxx>
+#include <GEOMImpl_ImportDriver.hxx>
-#include "GEOMImpl_ICopy.hxx"
-#include "GEOMImpl_IImportExport.hxx"
+#include <GEOMImpl_ICopy.hxx>
+#include <GEOMImpl_IImportExport.hxx>
-#include "GEOMImpl_Types.hxx"
+#include <GEOMImpl_Types.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
*/
//=============================================================================
void GEOMImpl_IInsertOperations::Export
- (const Handle(GEOM_Object) theOriginal,
- const char* theFileName,
- const char* theFormatName)
+ (const Handle(GEOM_Object) theOriginal,
+ const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& theFormatName)
{
SetErrorCode(KO);
//Set parameters
GEOMImpl_IImportExport aCI (aFunction);
aCI.SetOriginal(aRefFunction);
- char* aFileName = (char*)theFileName;
- aCI.SetFileName(aFileName);
+ aCI.SetFileName(theFileName);
- char* aFormatName = (char*)theFormatName;
Handle(TCollection_HAsciiString) aHLibName;
- if (!IsSupported(Standard_False, aFormatName, aHLibName)) {
+ if (!IsSupported(Standard_False, theFormatName, aHLibName)) {
return;
}
TCollection_AsciiString aLibName = aHLibName->String();
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << "geompy.Export(" << theOriginal
- << ", \"" << theFileName << "\", \"" << theFormatName << "\")";
+ GEOM::TPythonDump(aFunction) << "geompy.Export(" << theOriginal << ", \""
+ << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")";
SetErrorCode(OK);
}
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import
- (const char* theFileName,
- const char* theFormatName)
+ (const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& theFormatName)
{
SetErrorCode(KO);
- if (!theFileName || !theFormatName) return NULL;
+ if (theFileName.IsEmpty() || theFormatName.IsEmpty()) return NULL;
//Add a new result object
Handle(GEOM_Object) result = GetEngine()->AddObject(GetDocID(), GEOM_IMPORT);
//Set parameters
GEOMImpl_IImportExport aCI (aFunction);
- char* aFileName = (char*)theFileName;
- aCI.SetFileName(aFileName);
+ aCI.SetFileName(theFileName);
- char* aFormatName = (char*)theFormatName;
Handle(TCollection_HAsciiString) aHLibName;
- if (!IsSupported(Standard_True, aFormatName, aHLibName)) {
+ if (!IsSupported(Standard_True, theFormatName, aHLibName)) {
return result;
}
TCollection_AsciiString aLibName = aHLibName->String();
//Make a Python command
GEOM::TPythonDump(aFunction) << result << " = geompy.Import(\""
- << theFileName << "\", \"" << theFormatName << "\")";
+ << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")";
SetErrorCode(OK);
return result;
//=============================================================================
Standard_Boolean GEOMImpl_IInsertOperations::IsSupported
(const Standard_Boolean isImport,
- const TCollection_AsciiString theFormat,
+ const TCollection_AsciiString& theFormat,
Handle(TCollection_HAsciiString)& theLibName)
{
if (!InitResMgr()) return Standard_False;
// Import/Export mode
- Standard_CString aMode;
+ TCollection_AsciiString aMode;
+ //Standard_CString aMode;
if (isImport) aMode = "Import";
else aMode = "Export";
// Read supported formats for the certain mode
- if (myResMgr->Find(aMode)) {
- TCollection_AsciiString aFormats (myResMgr->Value(aMode));
+ if (myResMgr->Find(aMode.ToCString())) {
+ TCollection_AsciiString aFormats (myResMgr->Value(aMode.ToCString()));
if (aFormats.Search(theFormat) > -1) {
// Read library name for the supported format
TCollection_AsciiString aKey (theFormat);
#else
aResDir += "/share/salome/resources";
#endif
- TCollection_AsciiString aUserResDir (getenv("HOME"));
+ char * dir = getenv("GEOM_ENGINE_RESOURCES_DIR");
+ TCollection_AsciiString aUserResDir;
+ if ( dir )
+ {
+ aUserResDir = dir;
+ }
+ else
+ {
+ aUserResDir = getenv("HOME");
#ifdef WNT
- aUserResDir += "\\.salome\\resources";
+ aUserResDir += "\\.salome\\resources";
#else
- aUserResDir += "/.salome/resources";
+ aUserResDir += "/.salome/resources";
#endif
+ }
myResMgr = new Resource_Manager ("ImportExport", aResDir, aUserResDir, Standard_False);
if (!myResMgr->Find("Import") && !myResMgr->Find("Export")) {