// Function : getEntry
// Purpose :
//================================================================
-static char* getEntry( GEOM::GEOM_Object_ptr object )
+static string getEntry( GEOM::GEOM_Object_ptr object )
{
SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
if ( SO )
- return (char*)(SO->GetID().c_str());
+ return SO->GetID();
}
}
return "";
// Function : getName
// Purpose :
//================================================================
-static const char* getName( GEOM::GEOM_Object_ptr object )
+static string getName( GEOM::GEOM_Object_ptr object )
{
SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") )
{
_PTR(AttributeName) aNameAttr( anAttr );
- return aNameAttr->Value().c_str();
+ return aNameAttr->Value();
}
}
}
string entry = getEntry( theObj );
if ( entry != "" ) {
- Display( new SALOME_InteractiveObject(
- entry.c_str(), "GEOM", strdup( getName( theObj ) ) ), updateViewer );
+ Display(new SALOME_InteractiveObject(entry.c_str(), "GEOM", getName(theObj).c_str()),
+ updateViewer);
}
}
string entry = getEntry( theObj );
if ( entry != "" )
{
- Erase( new SALOME_InteractiveObject(
- entry.c_str(), "GEOM", strdup( getName( theObj ) ) ), forced, updateViewer );
+ Erase(new SALOME_InteractiveObject(entry.c_str(), "GEOM", getName(theObj).c_str()),
+ forced, updateViewer);
}
}
theSelMgr->setSelectedObjects( toSelect, true );
}
-
} // if ( selected not empty )
} // if ( selMgr && appStudy )
- app->updateActions(); //SRN: To update a Save button in the toolbar
+ app->updateActions(); //SRN: To update a Save button in the toolbar
} // if ( app )
//=====================================================================================
bool GEOMToolsGUI::Import()
{
- SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( getGeometryGUI()->getApp() );
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( getGeometryGUI()->getApp() );
//SUIT_Application* app = getGeometryGUI()->getApp();
if (! app) return false;
QString fileType;
- QString file = getFileName(app->desktop(), "", aMap, tr("GEOM_MEN_IMPORT"), true, fileType );
- if( file.isEmpty() || fileType.isEmpty() )
+ QString fileName = getFileName(app->desktop(), "", aMap,
+ tr("GEOM_MEN_IMPORT"), true, fileType);
+ if (fileName.isEmpty() || fileType.isEmpty())
return false;
- GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() );
+ GEOM_Operation* anOp = new GEOM_Operation (app, aInsOp.in());
try {
SUIT_OverrideCursor wc;
- app->putInfo( tr("GEOM_PRP_LOADING").arg(SUIT_Tools::file( file, /*withExten=*/true )) );
+ app->putInfo(tr("GEOM_PRP_LOADING").arg(SUIT_Tools::file(fileName, /*withExten=*/true)));
anOp->start();
- anObj = aInsOp->Import( file.latin1(), fileType.latin1() );
+ CORBA::String_var fileN = fileName.latin1();
+ CORBA::String_var fileT = fileType.latin1();
+ anObj = aInsOp->Import(fileN, fileT);
if ( !anObj->_is_nil() && aInsOp->IsDone() ) {
- anObj->SetName( GEOMBase::GetDefaultName( QObject::tr( "GEOM_IMPORT" ) ).latin1() );
- QString aPublishObjName = GEOMBase::GetDefaultName( SUIT_Tools::file( file, /*withExten=*/true ));
+ anObj->SetName(GEOMBase::GetDefaultName(QObject::tr("GEOM_IMPORT")).latin1());
+ QString aPublishObjName =
+ GEOMBase::GetDefaultName(SUIT_Tools::file(fileName, /*withExten=*/true));
SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy(aStudy);
GeometryGUI::GetGeomGen()->PublishInStudy(aDSStudy,
void GEOM_IInsertOperations_i::ImportTranslators
(GEOM::string_array_out theFormats, GEOM::string_array_out thePatterns)
{
- // Get sequences of available formats
- Handle(TColStd_HSequenceOfAsciiString) aFormats = new TColStd_HSequenceOfAsciiString;
- Handle(TColStd_HSequenceOfAsciiString) aPatterns = new TColStd_HSequenceOfAsciiString;
- if (!GetOperations()->ImportTranslators(aFormats, aPatterns) ||
- aFormats->Length() != aPatterns->Length())
- {
- aFormats->Clear(); aPatterns->Clear();
- }
-
- const int formSize = aFormats->Length(), pattSize = aPatterns->Length();
-
// allocate the CORBA arrays
GEOM::string_array_var aFormatsArray = new GEOM::string_array();
GEOM::string_array_var aPatternsArray = new GEOM::string_array();
- aFormatsArray->length(formSize);
- aPatternsArray->length(formSize);
-
- // fill the local CORBA arrays with values from sequences
- CORBA::Long i = 1;
- for (; i <= formSize; i++) {
- aFormatsArray[i-1] = CORBA::string_dup(aFormats->Value(i).ToCString());
- aPatternsArray[i-1] = CORBA::string_dup(aPatterns->Value(i).ToCString());
+
+ // Get sequences of available formats
+ Handle(TColStd_HSequenceOfAsciiString) aFormats = new TColStd_HSequenceOfAsciiString;
+ Handle(TColStd_HSequenceOfAsciiString) aPatterns = new TColStd_HSequenceOfAsciiString;
+ if (GetOperations()->ImportTranslators(aFormats, aPatterns)) {
+ const int formSize = aFormats->Length();
+ if (formSize == aPatterns->Length()) {
+ aFormatsArray->length(formSize);
+ aPatternsArray->length(formSize);
+
+ // fill the local CORBA arrays with values from sequences
+ CORBA::Long i = 1;
+ for (; i <= formSize; i++) {
+ aFormatsArray[i-1] = CORBA::string_dup(aFormats->Value(i).ToCString());
+ aPatternsArray[i-1] = CORBA::string_dup(aPatterns->Value(i).ToCString());
+ }
+ }
}
// initialize out-parameters with local arrays
- theFormats = aFormatsArray._retn();
+ theFormats = aFormatsArray._retn();
thePatterns = aPatternsArray._retn();
}
void GEOM_IInsertOperations_i::ExportTranslators
(GEOM::string_array_out theFormats, GEOM::string_array_out thePatterns)
{
- // Get sequences of available formats
- Handle(TColStd_HSequenceOfAsciiString) aFormats = new TColStd_HSequenceOfAsciiString;
- Handle(TColStd_HSequenceOfAsciiString) aPatterns = new TColStd_HSequenceOfAsciiString;
- if (!GetOperations()->ExportTranslators(aFormats, aPatterns)) return;
-
- const int formSize = aFormats->Length(), pattSize = aPatterns->Length();
- if (formSize != pattSize) return;
-
// allocate the CORBA arrays
GEOM::string_array_var aFormatsArray = new GEOM::string_array();
GEOM::string_array_var aPatternsArray = new GEOM::string_array();
- aFormatsArray->length(formSize);
- aPatternsArray->length(formSize);
-
- // fill the local CORBA arrays with values from sequences
- CORBA::Long i = 1;
- for (; i <= formSize; i++) {
- aFormatsArray[i-1] = CORBA::string_dup(aFormats->Value(i).ToCString());
- aPatternsArray[i-1] = CORBA::string_dup(aPatterns->Value(i).ToCString());
+
+ // Get sequences of available formats
+ Handle(TColStd_HSequenceOfAsciiString) aFormats = new TColStd_HSequenceOfAsciiString;
+ Handle(TColStd_HSequenceOfAsciiString) aPatterns = new TColStd_HSequenceOfAsciiString;
+ if (GetOperations()->ExportTranslators(aFormats, aPatterns)) {
+ const int formSize = aFormats->Length();
+ if (formSize == aPatterns->Length()) {
+ aFormatsArray->length(formSize);
+ aPatternsArray->length(formSize);
+
+ // fill the local CORBA arrays with values from sequences
+ CORBA::Long i = 1;
+ for (; i <= formSize; i++) {
+ aFormatsArray[i-1] = CORBA::string_dup(aFormats->Value(i).ToCString());
+ aPatternsArray[i-1] = CORBA::string_dup(aPatterns->Value(i).ToCString());
+ }
+ }
}
// initialize out-parameters with local arrays
- theFormats = aFormatsArray._retn();
+ theFormats = aFormatsArray._retn();
thePatterns = aPatternsArray._retn();
}