-// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
SalomeApp_DataObject* aFatherDO = it->second;
it = entry2SuitObject.find(theID);
- if (it != entry2SuitObject.end()) { // this SOobject is already added somethere
+ if (it != entry2SuitObject.end()) { // this SOobject is already added somewhere
suit_obj = it->second;
SUIT_DataObject* oldFather = suit_obj->parent();
if (oldFather) {
suit_obj->updateItem();
// define position in the data tree (in aFatherDO) to insert the aSObj
- int pos = -1;
- //int childDataObjCount = aFatherDO->childCount();
- _PTR(UseCaseIterator) aUseCaseIter = aUseCaseBuilder->GetUseCaseIterator(aFatherSO);
- for (int cur = 0; aUseCaseIter->More() && pos < 0; cur++, aUseCaseIter->Next()) {
- if (aUseCaseIter->Value()->GetID() == theID) {
- pos = cur;
- break;
- }
- }
+ int pos = aUseCaseBuilder->GetIndexInFather(aFatherSO, aSObj);
aFatherDO->insertChildAtPos(suit_obj, pos);
//aFatherDO->insertChild(suit_obj, pos);
/* Define visibility state */
bool isComponent = dynamic_cast<SalomeApp_ModuleObject*>( suit_obj ) != 0;
if ( suit_obj && !isComponent && myStudy->visibilityState( theID.c_str() ) == Qtx::UnpresentableState ) {
- QString moduleTitle = ((CAM_Application*)myStudy->application())->moduleTitle(suit_obj->componentDataType());
- if (!moduleTitle.isEmpty()) {
- LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(moduleTitle,false);
- if (aDisplayer) {
- if(aDisplayer->canBeDisplayed(theID.c_str())) {
- myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState ); //hide the just added object
- //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
- }
- //else
- //MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
+ LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer
+ (suit_obj->componentDataType(),false);
+ if (aDisplayer) {
+ if (aDisplayer->canBeDisplayed(theID.c_str())) {
+ //hide the just added object
+ myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState );
+ //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
}
+ //else
+ // MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
}
}
} // END: work with tree nodes structure
return;
}
- int last2Pnt_pos = theID.rfind( ":" );
+ int last2Pnt_pos = (int)theID.rfind( ":" ); //!< TODO: conversion from size_t to int
std::string parent_id = theID.substr( 0, last2Pnt_pos );
int tag = atoi( theID.substr( last2Pnt_pos+1 ).c_str() );
/* Define visibility state */
bool isComponent = dynamic_cast<SalomeApp_ModuleObject*>( suit_obj ) != 0;
if ( suit_obj && !isComponent ) {
- QString moduleTitle = ((CAM_Application*)myStudy->application())->moduleTitle(suit_obj->componentDataType());
- if (!moduleTitle.isEmpty()) {
- LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(moduleTitle,false);
- if (aDisplayer) {
- if(aDisplayer->canBeDisplayed(theID.c_str())) {
- myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState );
- //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
- }
- //else
- //MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
+ LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer
+ (suit_obj->componentDataType(),false);
+ if (aDisplayer) {
+ if (aDisplayer->canBeDisplayed(theID.c_str())) {
+ myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState );
+ //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
}
+ //else
+ // MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
}
}
break;
// parse the children
o = o->firstChild();
}
- else if ( o->nextBrother() > 0 ) {
+ else if ( o->nextBrother() ) {
o = o->nextBrother();
}
else {
aModel->saveAs( theFileName, this, listOfFiles );
if ( !listOfFiles.isEmpty() )
saveModuleData(aModel->module()->name(), 0, // 0 means persistence file
- listOfFiles);
+ listOfFiles);
}
}
aModel->save(listOfFiles);
if ( !listOfFiles.isEmpty() )
saveModuleData(aModel->module()->name(), 0, // 0 means persistence file
- listOfFiles);
+ listOfFiles);
}
}
bool isMultiFile,
bool toSaveGUI )
{
- int savePoint;
+ int savePoint = 0;
_PTR(AttributeParameter) ap;
_PTR(IParameters) ip = ClientFactory::getIParameters(ap);
// This code is shared with persistence mechanism.
// NOTE: this should be revised if behavior of saveModuleData() changes!
saveModuleData(aModel->module()->name(), 1, // 1 means dump file
- listOfFiles);
+ listOfFiles);
}
}
{
std::vector<std::string> aListOfFiles = GetListOfFiles( theModuleName.toStdString().c_str(), type );
- int i, aLength = aListOfFiles.size() - 1;
+ int i, aLength = (int)aListOfFiles.size() - 1; //!< TODO: conversion from size_t to int
if ( aLength < 0 )
return;
Re-implemented from LightApp_Study, actually does not save anything but
simply cleans up light modules' data
*/
-bool SalomeApp_Study::saveStudyData( const QString& theFileName, int type )
+bool SalomeApp_Study::saveStudyData( const QString& /*theFileName*/, int type )
{
ModelList list; dataModels( list );
QListIterator<CAM_DataModel*> it( list );
}
QStringList listOfFiles;
openModuleData(dm->module()->name(), 0, // 0 means persistence file
- listOfFiles);
+ listOfFiles);
if (dm && dm->open(studyName, this, listOfFiles)) {
// Remove the files and temporary directory, created
// for this module by LightApp_Engine_i::Load()
bool isMultiFile = false; // TODO: decide, how to access this parameter
RemoveTemporaryFiles( dm->module()->name().toStdString().c_str(), isMultiFile, true );
SetListOfFiles( dm->module()->name().toStdString().c_str(), 0, // 0 means persistence file
- std::vector<std::string>() );
+ std::vector<std::string>() );
// Something has been read -> create data model tree
LightApp_DataModel* aDM = dynamic_cast<LightApp_DataModel*>( dm );
if (aListOfFiles.size() > 0) {
std::string aTmpDir = aListOfFiles[0];
- const int n = aListOfFiles.size() - 1;
+ const int n = (int)aListOfFiles.size() - 1; //!< TODO: conversion from size_t to int
std::vector<std::string> aSeq;
aSeq.reserve(n);
for (int i = 0; i < n; i++)
aSeq.push_back(CORBA::string_dup(aListOfFiles[i + 1].c_str()));
SalomeApp_Engine_i* engine = SalomeApp_Engine_i::GetInstance( theModuleName, false );
- bool toRemove = force || engine && !engine->keepFiles();
+ bool toRemove = force || ( engine && !engine->keepFiles() );
if ( toRemove ) {
SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq, true);
{
_PTR(StudyBuilder) sb = studyDS()->NewBuilder();
std::vector<_PTR(SObject)> aRefs = studyDS()->FindDependances( obj );
- for( int i=0, n=aRefs.size(); i<n; i++ )
+ for( size_t i=0, n=aRefs.size(); i<n; i++ )
{
_PTR( SObject ) o = aRefs[i];
if( o->GetFatherComponent()->ComponentDataType()==obj->GetFatherComponent()->ComponentDataType() )