NPAL17002: merge from 3.2.X.

This commit is contained in:
jfa 2007-10-24 06:40:41 +00:00
parent 6b50b26b84
commit 8d6ca361a1
3 changed files with 27 additions and 18 deletions

View File

@ -28,9 +28,7 @@
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <Standard_ConstructionError.hxx> #include <Standard_Failure.hxx>
#include <NCollection_DataMap.hxx>
#ifdef WNT #ifdef WNT
#include <windows.h> #include <windows.h>
@ -106,8 +104,11 @@ Standard_Integer GEOMImpl_ExportDriver::Execute(TFunction_Logbook& log) const
if ( anExportLib ) if ( anExportLib )
fp = (funcPoint)GetProc( anExportLib, "Export" ); fp = (funcPoint)GetProc( anExportLib, "Export" );
if ( !fp ) if ( !fp ) {
return 0; TCollection_AsciiString aMsg = aFormatName;
aMsg += " plugin was not installed";
Standard_Failure::Raise(aMsg.ToCString());
}
// perform the export // perform the export
int res = fp( aShape, aFileName, aFormatName ); int res = fp( aShape, aFileName, aFormatName );

View File

@ -29,11 +29,9 @@
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <Standard_ConstructionError.hxx> #include <Standard_Failure.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <NCollection_DataMap.hxx>
#ifdef WNT #ifdef WNT
#include <windows.h> #include <windows.h>
#else #else
@ -100,8 +98,11 @@ Standard_Integer GEOMImpl_ImportDriver::Execute(TFunction_Logbook& log) const
if ( anImportLib ) if ( anImportLib )
fp = (funcPoint)GetProc( anImportLib, "Import" ); fp = (funcPoint)GetProc( anImportLib, "Import" );
if ( !fp ) if ( !fp ) {
return 0; TCollection_AsciiString aMsg = aFormatName;
aMsg += " plugin was not installed";
Standard_Failure::Raise(aMsg.ToCString());
}
// perform the import // perform the import
TCollection_AsciiString anError; TCollection_AsciiString anError;

View File

@ -72,15 +72,16 @@ typedef QMap<QString, QString> FilterMap;
static QString getFileName( QWidget* parent, static QString getFileName( QWidget* parent,
const QString& initial, const QString& initial,
const FilterMap& filterMap, const FilterMap& filterMap,
const QStringList filters,
const QString& caption, const QString& caption,
bool open, bool open,
QString& format ) QString& format )
{ {
static QString lastUsedFilter; static QString lastUsedFilter;
QStringList filters; //QStringList filters;
QString aBrepFilter; QString aBrepFilter;
for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it ) { for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it ) {
filters.push_back( it.key() ); //filters.push_back( it.key() );
if (it.key().contains("BREP", false)) { if (it.key().contains("BREP", false)) {
aBrepFilter = it.key(); aBrepFilter = it.key();
@ -474,15 +475,18 @@ bool GEOMToolsGUI::Import()
// Obtain a list of available import formats // Obtain a list of available import formats
FilterMap aMap; FilterMap aMap;
QStringList filters;
GEOM::string_array_var aFormats, aPatterns; GEOM::string_array_var aFormats, aPatterns;
aInsOp->ImportTranslators( aFormats, aPatterns ); aInsOp->ImportTranslators( aFormats, aPatterns );
for ( int i = 0, n = aFormats->length(); i < n; i++ ) for ( int i = 0, n = aFormats->length(); i < n; i++ ) {
aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] ); aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] );
filters.push_back( (char*)aPatterns[i] );
}
QString fileType; QString fileType;
QString fileName = getFileName(app->desktop(), "", aMap, QString fileName = getFileName(app->desktop(), "", aMap, filters,
tr("GEOM_MEN_IMPORT"), true, fileType); tr("GEOM_MEN_IMPORT"), true, fileType);
if (fileType.isEmpty() ) if (fileType.isEmpty() )
@ -579,10 +583,13 @@ bool GEOMToolsGUI::Export()
// Obtain a list of available export formats // Obtain a list of available export formats
FilterMap aMap; FilterMap aMap;
QStringList filters;
GEOM::string_array_var aFormats, aPatterns; GEOM::string_array_var aFormats, aPatterns;
aInsOp->ExportTranslators( aFormats, aPatterns ); aInsOp->ExportTranslators( aFormats, aPatterns );
for ( int i = 0, n = aFormats->length(); i < n; i++ ) for ( int i = 0, n = aFormats->length(); i < n; i++ ) {
aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] ); aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] );
filters.push_back( (char*)aPatterns[i] );
}
// Get selected objects // Get selected objects
LightApp_SelectionMgr* sm = app->selectionMgr(); LightApp_SelectionMgr* sm = app->selectionMgr();
@ -602,7 +609,7 @@ bool GEOMToolsGUI::Export()
continue; continue;
QString fileType; QString fileType;
QString file = getFileName(app->desktop(), QString( IObject->getName() ), aMap, QString file = getFileName(app->desktop(), QString( IObject->getName() ), aMap, filters,
tr("GEOM_MEN_EXPORT"), false, fileType); tr("GEOM_MEN_EXPORT"), false, fileType);
// User has pressed "Cancel" --> stop the operation // User has pressed "Cancel" --> stop the operation