mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-13 17:18:36 +05:00
SIMAN removal
This commit is contained in:
parent
f8174cfe42
commit
ab0d7e24cd
@ -66,7 +66,6 @@
|
||||
|
||||
#include <SALOMEDS_Tool.hxx>
|
||||
#include <SALOMEDS_wrap.hxx>
|
||||
#include <SALOME_DataContainer_i.hxx>
|
||||
#include <Basics_DirUtils.hxx>
|
||||
|
||||
#include <set>
|
||||
@ -2930,149 +2929,6 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what,
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : importData
|
||||
// purpose : imports geometrical data file into the GEOM internal data structure
|
||||
//=================================================================================
|
||||
Engines::ListOfIdentifiers* GEOM_Gen_i::importData(
|
||||
CORBA::Long studyId, Engines::DataContainer_ptr data, const Engines::ListOfOptions& options)
|
||||
{
|
||||
CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" );
|
||||
SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
|
||||
SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId );
|
||||
|
||||
Engines::ListOfIdentifiers_var aResult = new Engines::ListOfIdentifiers;
|
||||
GEOM::GEOM_IInsertOperations_var aInsOp = GetIInsertOperations(aStudy->StudyId());
|
||||
if (aInsOp->_is_nil()) {
|
||||
MESSAGE("No insert operations!");
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
// Get a temporary directory to store a file
|
||||
std::string aTmpDir = SALOMEDS_Tool::GetTmpDir();
|
||||
std::string aFileName("file");
|
||||
if (aFileName.rfind("/") != std::string::npos) { // remove folders from the name
|
||||
aFileName = aFileName.substr(aFileName.rfind("/") + 1);
|
||||
}
|
||||
|
||||
std::string anExtension(data->extension());
|
||||
aFileName += "." + anExtension;
|
||||
// convert extension to upper case
|
||||
std::transform(anExtension.begin(), anExtension.end(), anExtension.begin(), ::toupper);
|
||||
std::string aFullPath = aTmpDir + aFileName;
|
||||
|
||||
Engines::TMPFile* aFileStream = data->get();
|
||||
const char *aBuffer = (const char*)aFileStream->NP_data();
|
||||
#ifdef WIN32
|
||||
std::ofstream aFile(aFullPath.c_str(), std::ios::binary);
|
||||
#else
|
||||
std::ofstream aFile(aFullPath.c_str());
|
||||
#endif
|
||||
aFile.write(aBuffer, aFileStream->length());
|
||||
aFile.close();
|
||||
|
||||
GEOM::ListOfGBO_var aObjects = aInsOp->ImportFile(aFullPath.c_str(), "XAO");
|
||||
|
||||
if ( aObjects->length() > 0 && aInsOp->IsDone() ) {
|
||||
aResult->length(aObjects->length());
|
||||
// publish main object (first in the list of returned geom objects)
|
||||
CORBA::String_var aName = aObjects[0]->GetName();
|
||||
SALOMEDS::SObject_var aSO = PublishInStudy(aStudy.in(), SALOMEDS::SObject::_nil(), aObjects[0].in(), aName.in());
|
||||
aResult[0] = aSO->GetID();
|
||||
// publish groups && fields
|
||||
for (int i = 1; i < aObjects->length(); i++ ) {
|
||||
aName = aObjects[i]->GetName();
|
||||
aSO = AddInStudy(aStudy.in(), aObjects[0].in(), aName.in(), aObjects[0].in());
|
||||
aResult[i] = aSO->GetID();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aObjects->length() == 0)
|
||||
MESSAGE("ImportXAO operation is failed for file "<<aFullPath.c_str());
|
||||
if (!aInsOp->IsDone())
|
||||
MESSAGE("Import operation is not done for file "<<aFullPath.c_str());
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
// remove temporary file and directory
|
||||
SALOMEDS::ListOfFileNames aTmpFiles;
|
||||
aTmpFiles.length(1);
|
||||
aTmpFiles[0] = aFileName.c_str();
|
||||
SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aTmpFiles, true);
|
||||
|
||||
_impl->DocumentModified(studyId, false);
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : getModifiedData
|
||||
// purpose : exports all geometry of this GEOM module into one BRep file
|
||||
//=================================================================================
|
||||
Engines::ListOfData* GEOM_Gen_i::getModifiedData(CORBA::Long studyId)
|
||||
{
|
||||
Engines::ListOfData_var aResult = new Engines::ListOfData;
|
||||
|
||||
if (!_impl->DocumentModified(studyId)) {
|
||||
MESSAGE("Document is not modified")
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
CORBA::Object_var aSMObject = name_service->Resolve("/myStudyManager");
|
||||
SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
|
||||
if (CORBA::is_nil(aStudyManager))
|
||||
return aResult._retn();
|
||||
SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId );
|
||||
if (CORBA::is_nil(aStudy))
|
||||
return aResult._retn();
|
||||
SALOMEDS::SComponent_var aComponent = aStudy->FindComponent("GEOM");
|
||||
if (CORBA::is_nil(aComponent))
|
||||
return aResult._retn();
|
||||
SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(aComponent); // check only published shapes
|
||||
|
||||
GEOM::GEOM_IInsertOperations_var aInsOp = GetIInsertOperations(aStudy->StudyId());
|
||||
if (aInsOp->_is_nil()) {
|
||||
MESSAGE("No insert operations!");
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
GEOM::GEOM_Object_var shapeObj;
|
||||
|
||||
for(; anIter->More(); anIter->Next()) {
|
||||
SALOMEDS::SObject_var aSO = anIter->Value();
|
||||
SALOMEDS::SObject_var aRefSO;
|
||||
// export only not referenced objects, or referenced outside of GEOM
|
||||
if (!aSO->ReferencedObject(aRefSO) || aRefSO->GetFatherComponent()->GetID() != aComponent->GetID()) {
|
||||
CORBA::Object_var anObj = aSO->GetObject();
|
||||
if (!CORBA::is_nil(anObj)) {
|
||||
GEOM::GEOM_Object_var aCORBAMainShape = GEOM::GEOM_Object::_narrow(anObj);
|
||||
if(!aCORBAMainShape->_is_nil()) {
|
||||
CORBA::String_var entry = aCORBAMainShape->GetEntry();
|
||||
Handle(GEOM_Object) aMainShape = Handle(GEOM_Object)::DownCast(_impl->GetObject(studyId, entry));
|
||||
|
||||
GEOM::shape_type aCORBAShapeType = aCORBAMainShape->GetShapeType();
|
||||
if (!aMainShape.IsNull() && !(aCORBAShapeType == GEOM::VERTEX) && !(aCORBAShapeType == GEOM::EDGE)) {
|
||||
shapeObj = aCORBAMainShape;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!CORBA::is_nil(shapeObj)) { // Shape is correct, write it to the temporary file
|
||||
std::string aPath = Kernel_Utils::GetTmpFileName() + ".xao";
|
||||
aInsOp->Export(shapeObj.in(), aPath.c_str(), "XAO");
|
||||
aResult->length(1);
|
||||
Engines::DataContainer_var aData = (new Engines_DataContainer_i(
|
||||
aPath.c_str(), "", "", true))->_this();
|
||||
aResult[0] = aData;
|
||||
} else {
|
||||
MESSAGE("No shapes to export");
|
||||
}
|
||||
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : GetDependencyTree
|
||||
// purpose : Collects dependencies of the given objects from other ones
|
||||
|
@ -317,13 +317,6 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
||||
SALOMEDS::SObject_ptr where,
|
||||
CORBA::Long row );
|
||||
|
||||
// SIMAN-related functions (check out/check in) : import data to study
|
||||
virtual Engines::ListOfIdentifiers* importData(CORBA::Long studyId,
|
||||
Engines::DataContainer_ptr data,
|
||||
const Engines::ListOfOptions& options);
|
||||
// SIMAN-related functions (check out/check in) : get modified data
|
||||
virtual Engines::ListOfData* getModifiedData(CORBA::Long studyId);
|
||||
|
||||
/*! \brief Fills 3 lists that is used to clean study of redundant objects.
|
||||
* To be used from GUI.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user