VISU_Result_i.cc \
VISU_ResultUtils.cc \
VISU_MultiResult_i.cc \
+ VISU_Gen_i.cc \
VISU_CorbaMedConvertor.cxx \
VISU_PrsObject_i.cc \
VISU_Prs3d_i.cc \
VISU_TimeAnimation.cxx \
VISU_View_i.cc \
VISU_Table_i.cc \
- VISU_Gen_i.cc \
VISU_DumpPython.cc \
SALOME_GenericObjPointer.cc
$(MED_LDFLAGS) \
../../idl/libSalomeIDLVISU.la
-libVISUEngineImpl_la_LIBADD= -lboost_signals@BOOST_LIBSUFFIX@ -lboost_thread@BOOST_LIBSUFFIX@ \
+libVISUEngineImpl_la_LIBADD= \
+ -lboost_signals@BOOST_LIBSUFFIX@ \
+ -lboost_thread@BOOST_LIBSUFFIX@ \
+ -lboost_filesystem@BOOST_LIBSUFFIX@ \
-lSalomeHDFPersist \
-lSalomeGenericObj \
-lSalomeContainer \
bin_PROGRAMS = VISU_I
dist_VISU_I_SOURCES=VISU_I.cxx
VISU_I_CPPFLAGS=$(libVISUEngineImpl_la_CPPFLAGS)
-VISU_I_LDADD=$(libVISUEngineImpl_la_LIBADD) $(libVISUEngineImpl_la_LDFLAGS) \
+VISU_I_LDADD=\
+ $(libVISUEngineImpl_la_LIBADD) \
+ $(libVISUEngineImpl_la_LDFLAGS) \
$(KERNEL_LDFLAGS) \
-lSALOMEBasics \
-lSalomeCatalog \
// STL Includes
#include <strstream>
-using namespace std;
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/operations.hpp>
+namespace filesystem = boost::filesystem;
-static QFileInfo aFileInfo;
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
#else
static int MYDEBUG = 0;
#endif
SALOMEDS::TMPFile*
VISU_Gen_i
::Save(SALOMEDS::SComponent_ptr theComponent,
- const char* theTmpDir,
+ const char* theURL,
bool theIsMultiFile)
{
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - theTmpDir = '"<<theTmpDir<<"'");
+ if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - theURL = '"<<theURL<<"'");
- typedef std::vector<std::string> TFileNames;
- TFileNames aFileNames;
- TFileNames aFilePathes;
+ Result_i::TFileNames aFileNames;
+ Result_i::TFileNames aFullFileNames;
+ Result_i::TFileNames aTemporaryDirs;
SALOMEDS::Study_var aStudy = theComponent->GetStudy();
SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theComponent);
SALOMEDS::SObject_var aSObject = anIter->Value();
CORBA::Object_var anObj = SObjectToObject(aSObject);
if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(anObj).in())){
- std::string aFileName, aFilePath;
- if(aResult->Save(theComponent, theTmpDir, theIsMultiFile, aFileName, aFilePath)){
- aFileNames.push_back(aFileName);
- aFilePathes.push_back(aFilePath);
- }
+ aResult->Save(theComponent,
+ theURL,
+ theIsMultiFile,
+ aFileNames,
+ aFullFileNames,
+ aTemporaryDirs);
}
}
aListOfFileNames[aCounter-1] = aFileNames[aCounter-1].c_str();
}
- SALOMEDS::ListOfFileNames_var aListOfFilePathes = new SALOMEDS::ListOfFileNames;
- aListOfFilePathes->length(aFilePathes.size());
- if(!aFilePathes.empty()){
- for(int aCounter = aFileNames.size(); aCounter > 0; aCounter--)
- aListOfFilePathes[aCounter-1] = aFilePathes[aCounter-1].c_str();
+ SALOMEDS::ListOfFileNames_var aListOfFullFileNames = new SALOMEDS::ListOfFileNames;
+ if(!aFullFileNames.empty()){
+ aListOfFullFileNames->length(aFullFileNames.size());
+ for(int aCounter = aFullFileNames.size(); aCounter > 0; aCounter--)
+ aListOfFullFileNames[aCounter-1] = aFullFileNames[aCounter-1].c_str();
}
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
if(theIsMultiFile)
- aStreamFile = SALOMEDS_Tool::PutFilesToStream(theTmpDir, aListOfFilePathes.in(), theIsMultiFile);
- else
- aStreamFile = SALOMEDS_Tool::PutFilesToStream(aListOfFilePathes.in(), aListOfFileNames.in());
-
+ aStreamFile = SALOMEDS_Tool::PutFilesToStream(theURL, aListOfFullFileNames.in(), theIsMultiFile);
+ else{
+ aStreamFile = SALOMEDS_Tool::PutFilesToStream(aListOfFullFileNames.in(), aListOfFileNames.in());
+ Result_i::TFileNames::const_iterator anIter = aTemporaryDirs.begin();
+ for(; anIter != aTemporaryDirs.end(); anIter++){
+ filesystem::path aDirName(*anIter);
+ if(filesystem::exists(aDirName)){
+ filesystem::remove_all(aDirName);
+ if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aDirName ='"<<aDirName.string()<<"'\n");
+ }
+ }
+ }
return aStreamFile._retn();
}
Result_i* aResult = Result_i::New(myStudyDocument,
Result_i::eFile,
- Result_i::eImportFile);
+ Result_i::eImportFile,
+ true,
+ true,
+ true,
+ true);
if(aResult->Create(theFileName) != NULL)
return aResult->_this();
Result_i* aResult = Result_i::New(myStudyDocument,
Result_i::eFile,
Result_i::eImportFile,
- false);
+ false,
+ true,
+ true,
+ true);
if(aResult->Create(theFileName) != NULL)
return aResult->_this();
Result_i* aResult = Result_i::New(myStudyDocument,
Result_i::eRestoredFile,
- Result_i::eCopyAndImportFile);
+ Result_i::eCopyAndImportFile,
+ true,
+ true,
+ true,
+ true);
if(aResult->Create(theFileName) != NULL)
return aResult->_this();
else
Result_i* aResult = Result_i::New(myStudyDocument,
Result_i::eComponent,
- Result_i::eImportMed);
+ Result_i::eImportMed,
+ true,
+ true,
+ true,
+ true);
if (aResult->Create(theMedSObject) != NULL)
return aResult->_this();
else
Result_i* aResult = Result_i::New(myStudyDocument,
Result_i::eComponent,
- Result_i::eImportMedField);
+ Result_i::eImportMedField,
+ true,
+ true,
+ true,
+ true);
if (aResult->Create(theField) != NULL)
return aResult->_this();
#include <strstream>
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/operations.hpp>
+namespace filesystem = boost::filesystem;
+
#ifdef _DEBUG_
static int MYDEBUG = 1;
static int MYTIMEDEBUG = 0;
//---------------------------------------------------------------
inline
MultiResult_i::TResolutions
- GetResolutions(const MultiResult_i::TMainPart2SubParts& theMainPart2SubParts,
+ GetResolutions(const MultiResult_i::TMainPart2SubPartNames& theMainPart2SubPartNames,
const std::string& thePartName)
{
MultiResult_i::TResolutions aResolutions;
aResolutions.insert(VISU::Result::FULL);
MultiResult_i::TPartName aMainPart = ExtractMainPart(thePartName);
- MultiResult_i::TMainPart2SubParts::const_iterator anIter = theMainPart2SubParts.find(aMainPart);
- if(anIter != theMainPart2SubParts.end()){
- const MultiResult_i::TSubParts& aSubParts = anIter->second;
+ MultiResult_i::TMainPart2SubPartNames::const_iterator anIter = theMainPart2SubPartNames.find(aMainPart);
+ if(anIter != theMainPart2SubPartNames.end()){
+ const MultiResult_i::TSubPartNames& aSubPartNames = anIter->second;
- if(aSubParts.find(aMainPart + "_LOW") != aSubParts.end())
+ if(aSubPartNames.find(aMainPart + "_LOW") != aSubPartNames.end())
aResolutions.insert(VISU::Result::LOW);
- if(aSubParts.find(aMainPart + "_MED") != aSubParts.end())
+ if(aSubPartNames.find(aMainPart + "_MED") != aSubPartNames.end())
aResolutions.insert(VISU::Result::MEDIUM);
}
return aResolutions;
//---------------------------------------------------------------
inline
VISU::Result::Resolution
- GetResolution(const MultiResult_i::TMainPart2SubParts& theMainPart2SubParts,
+ GetResolution(const MultiResult_i::TMainPart2SubPartNames& theMainPart2SubPartNames,
const std::string& thePartName)
{
- MultiResult_i::TResolutions aResolutions = GetResolutions(theMainPart2SubParts, thePartName);
+ MultiResult_i::TResolutions aResolutions = GetResolutions(theMainPart2SubPartNames, thePartName);
if(aResolutions.find(VISU::Result::LOW) != aResolutions.end())
return VISU::Result::LOW;
//---------------------------------------------------------------
inline
std::string
- GetIconName(const MultiResult_i::TMainPart2SubParts& theMainPart2SubParts,
+ GetIconName(const MultiResult_i::TMainPart2SubPartNames& theMainPart2SubPartNames,
const std::string& thePartName)
{
- VISU::Result::Resolution aResolution = GetResolution(theMainPart2SubParts,
+ VISU::Result::Resolution aResolution = GetResolution(theMainPart2SubPartNames,
thePartName);
if(aResolution == VISU::Result::LOW)
return "ICON_MULTIPR_VIEW_LOW";
MultiResult_i::TPartInfos* thePartInfos,
MultiResult_i::TPartName2FileName* thePartName2FileName,
MultiResult_i::TPartName2Resolution* thePartName2Resolution,
- MultiResult_i::TMainPart2SubParts* theMainPart2SubParts,
+ MultiResult_i::TMainPart2SubPartNames* theMainPart2SubPartNames,
CORBA::Boolean* theIsDone,
CORBA::Boolean theIsBuild,
_PTR(Study) theStudy)
VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
const VISU::PMesh& aMesh = aMeshMapIter->second;
- MultiResult_i::TParts aParts = aMultiprObj.getParts();
+ MultiResult_i::TPartNames aPartNames = aMultiprObj.getParts();
QString aComment = "Sub-parts: #";
- aComment += QString::number(aParts.size());
+ aComment += QString::number(aPartNames.size());
CreateAttributes(theStudy,
aMesh->myPartsEntry,
MultiResult_i::TPartName2FileName& aPartName2FileName = *thePartName2FileName;
MultiResult_i::TPartName2Resolution& aPartName2Resolution = *thePartName2Resolution;
- MultiResult_i::TMainPart2SubParts& aMainPart2SubParts = *theMainPart2SubParts;
+ MultiResult_i::TMainPart2SubPartNames& aMainPart2SubPartNames = *theMainPart2SubPartNames;
- for (size_t aPartID = 0 ; aPartID < aParts.size() ; aPartID++) {
- const MultiResult_i::TPartName& aPartName = aParts[aPartID];
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
MultiResult_i::TPartName aMainPart = ExtractMainPart(aPartName);
- aMainPart2SubParts[aMainPart].insert(aPartName);
+ aMainPart2SubPartNames[aMainPart].insert(aPartName);
}
std::string aLastEntry;
- for (size_t aPartID = 0 ; aPartID < aParts.size() ; aPartID++) {
- const MultiResult_i::TPartName& aPartName = aParts[aPartID];
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
std::string aStringInfo = aMultiprObj.getPartInfo(aPartName.c_str());
MultiResult_i::TPartInfo aPartInfo;
aPartName2FileName[aPartInfo.myName] = aPartInfo.myFileName;
QString aComment = "";
- MultiResult_i::TResolutions aResoltutions = GetResolutions(aMainPart2SubParts, aPartInfo.myName);
+ MultiResult_i::TResolutions aResoltutions = GetResolutions(aMainPart2SubPartNames, aPartInfo.myName);
std::string aResoltutionsString = Resolutions2String(aResoltutions);
if ( IsFullResolution(aPartInfo.myName) ) {
- std::string anIconName = GetIconName(aMainPart2SubParts, aPartInfo.myName);
- VISU::Result::Resolution aResolution = GetResolution(aMainPart2SubParts, aPartInfo.myName);
+ std::string anIconName = GetIconName(aMainPart2SubPartNames, aPartInfo.myName);
+ VISU::Result::Resolution aResolution = GetResolution(aMainPart2SubPartNames, aPartInfo.myName);
aComment.sprintf("myComment=PART;myMeshName=%s;myFile=%s;myResolutions=%s;myState=%c",
aPartInfo.myMeshName.c_str(), aPartInfo.myFileName.c_str(), aResoltutionsString.c_str(), aResolution);
aLastEntry = CreateAttributes(theStudy,
MultiResult_i::TPartInfos* myPartInfos;
MultiResult_i::TPartName2FileName* myPartName2FileName;
MultiResult_i::TPartName2Resolution* myPartName2Resolution;
- MultiResult_i::TMainPart2SubParts* myMainPart2SubParts;
+ MultiResult_i::TMainPart2SubPartNames* myMainPart2SubPartNames;
CORBA::Boolean* myIsDone;
CORBA::Boolean myIsBuild;
_PTR(Study) myStudy;
MultiResult_i::TPartInfos* thePartInfos,
MultiResult_i::TPartName2FileName* thePartName2FileName,
MultiResult_i::TPartName2Resolution* thePartName2Resolution,
- MultiResult_i::TMainPart2SubParts* theMainPart2SubParts,
+ MultiResult_i::TMainPart2SubPartNames* theMainPart2SubPartNames,
CORBA::Boolean* theIsDone,
CORBA::Boolean theIsBuild,
_PTR(Study) theStudy):
myPartInfos(thePartInfos),
myPartName2FileName(thePartName2FileName),
myPartName2Resolution(thePartName2Resolution),
- myMainPart2SubParts(theMainPart2SubParts),
+ myMainPart2SubPartNames(theMainPart2SubPartNames),
myIsDone(theIsDone),
myIsBuild(theIsBuild),
myStudy(theStudy)
theArgs.myPartInfos,
theArgs.myPartName2FileName,
theArgs.myPartName2Resolution,
- theArgs.myMainPart2SubParts,
+ theArgs.myMainPart2SubPartNames,
theArgs.myIsDone,
theArgs.myIsBuild,
theArgs.myStudy);
//---------------------------------------------------------------
VISU::MultiResult_i
-::MultiResult_i (SALOMEDS::Study_ptr theStudy,
- const ESourceId& theSourceId,
- const ECreationId& theCreationId,
- CORBA::Boolean theIsBuildImmediately,
- CORBA::Boolean theIsBuildFields,
- CORBA::Boolean theIsBuildMinMax,
- CORBA::Boolean theIsBuildGroups):
+::MultiResult_i(SALOMEDS::Study_ptr theStudy,
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId,
+ CORBA::Boolean theIsBuildImmediately,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildMinMax,
+ CORBA::Boolean theIsBuildGroups):
Result_i(theStudy,
theSourceId,
theCreationId,
{}
+//---------------------------------------------------------------
+VISU::MultiResult_i
+::MultiResult_i()
+{}
+
+
//---------------------------------------------------------------
size_t
VISU::MultiResult_i
&myPartInfos,
&myPartName2FileName,
&myPartName2Resolution,
- &myMainPart2SubParts,
+ &myMainPart2SubPartNames,
&myIsPartsDone,
myIsBuildParts,
myStudy);
&myPartInfos,
&myPartName2FileName,
&myPartName2Resolution,
- &myMainPart2SubParts,
+ &myMainPart2SubPartNames,
&myIsPartsDone,
myIsBuildParts,
myStudy);
}
+//---------------------------------------------------------------
+bool
+VISU::MultiResult_i
+::Save(SALOMEDS::SComponent_ptr theComponent,
+ const std::string& theURL,
+ bool theIsMultiFile,
+ TFileNames& theFileNames,
+ TFileNames& theFullFileNames,
+ TFileNames& theTemporaryDirs)
+{
+ bool anIsDone = Result_i::Save(theComponent,
+ theURL,
+ theIsMultiFile,
+ theFileNames,
+ theFullFileNames,
+ theTemporaryDirs);
+ if(!anIsDone)
+ return false;
+
+ if(!myMultiprObj.isValidDistributedMEDFile())
+ return true;
+
+ // Obtain a temporary directory
+ filesystem::path aTmpDir = theIsMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
+ aTmpDir /= GetName();
+ cout<<"aTmpDir = '"<<aTmpDir.string()<<endl;
+
+ filesystem::create_directory(aTmpDir);
+ if(!theIsMultiFile)
+ theTemporaryDirs.push_back(aTmpDir.string());
+
+ myMultiprObj.savePersistent(aTmpDir.string().c_str());
+
+ cout<<"myMultiprObj.getMEDFilename() = '"<<myMultiprObj.getMEDFilename()<<endl;
+ MultiResult_i::TPartNames aPartNames = myMultiprObj.getParts();
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
+ std::string aStringInfo = myMultiprObj.getPartInfo(aPartName.c_str());
+
+ MultiResult_i::TPartInfo aPartInfo;
+ std::istrstream anOutputStream(aStringInfo.c_str());
+ anOutputStream>>(aPartInfo.myMeshName);
+ anOutputStream>>(aPartInfo.myPartID);
+ anOutputStream>>(aPartInfo.myName);
+ anOutputStream>>(aPartInfo.myPath);
+ anOutputStream>>(aPartInfo.myFileName);
+
+ cout<<"aPartInfo.myFileName = '"<<(aPartInfo.myFileName)<<endl;
+ filesystem::path aFile(aPartInfo.myFileName);
+ theFileNames.push_back(aFile.leaf());
+ theFullFileNames.push_back(aFile.branch_path().string());
+ }
+
+ return true;
+}
+
+
//---------------------------------------------------------------
void
VISU::MultiResult_i
if(!myIsBuildParts)
return aResult._retn();
- MultiResult_i::TParts aMeshParts;
- MultiResult_i::TParts aParts = myMultiprObj.getParts();
- for (size_t aPartID = 0 ; aPartID < aParts.size() ; aPartID++) {
- const MultiResult_i::TPartName& aPartName = aParts[aPartID];
+ MultiResult_i::TPartNames aMeshParts;
+ MultiResult_i::TPartNames aPartNames = myMultiprObj.getParts();
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
if(!IsFullResolution(aPartName))
continue;
if(!myIsBuildParts)
return aResult._retn();
- MultiResult_i::TParts aParts = myMultiprObj.getParts();
- for (size_t aPartID = 0 ; aPartID < aParts.size() ; aPartID++) {
- const MultiResult_i::TPartName& aPartName = aParts[aPartID];
+ MultiResult_i::TPartNames aPartNames = myMultiprObj.getParts();
+ for (size_t aPartID = 0 ; aPartID < aPartNames.size() ; aPartID++) {
+ const MultiResult_i::TPartName& aPartName = aPartNames[aPartID];
MultiResult_i::TPartName aMainPart = ExtractMainPart(thePartName);
if(aMainPart != thePartName)
continue;
if(aMeshName != theMeshName)
continue;
- MultiResult_i::TResolutions aResolutions = VISU::GetResolutions(myMainPart2SubParts, thePartName);
+ MultiResult_i::TResolutions aResolutions = VISU::GetResolutions(myMainPart2SubPartNames, thePartName);
if(aResolutions.empty())
return aResult._retn();
CORBA::Boolean theIsBuildMinMax,
CORBA::Boolean theIsBuildGroups);
+ MultiResult_i();
+
virtual
~MultiResult_i();
typedef std::string TPartName;
- typedef std::vector<TPartName> TParts;
+ typedef std::vector<TPartName> TPartNames;
typedef size_t TPartID;
typedef std::string TPath;
- typedef std::string TFileName;
typedef std::string TMeshName;
struct TPartInfo
typedef std::set<std::string> TRepresentationKey;
typedef std::map<TRepresentationKey, PInput> TRepresentation2Input;
- typedef std::set<TPartName> TSubParts;
- typedef std::map<TPartName, TSubParts> TMainPart2SubParts;
+ typedef std::set<TPartName> TSubPartNames;
+ typedef std::map<TPartName, TSubPartNames> TMainPart2SubPartNames;
private:
multipr::Obj myMultiprObj;
TPartName2FileName myPartName2FileName;
TPartName2Resolution myPartName2Resolution;
- TMainPart2SubParts myMainPart2SubParts;
+ TMainPart2SubPartNames myMainPart2SubPartNames;
TRepresentation2Input myRepresentation2Input;
const std::string& thePrefix,
CORBA::Boolean theIsMultiFile);
+ //---------------------------------------------------------------
+ virtual
+ bool
+ Save(SALOMEDS::SComponent_ptr theComponent,
+ const std::string& theURL,
+ bool theIsMultiFile,
+ TFileNames& theFileNames,
+ TFileNames& theFullFileNames,
+ TFileNames& theTemporaryDirs);
+
virtual
void
ToStream(std::ostringstream& theStr);
namespace VISU
{
+ //----------------------------------------------------------------------------
class Result_i;
+
+ //----------------------------------------------------------------------------
+ struct TResultObserver: public virtual boost::signalslib::trackable
+ {
+ virtual
+ void
+ UpdateFromResult(Result_i* theResult) = 0;
+ };
+
+
//----------------------------------------------------------------------------
//! Base class for all VTK 3D presentations.
/*!
- implement basic actor management (CreateActor, UpdateActor, UpdateActors, RemoveActor and RemoveActors);
- implement common 3D functionality like "clipping planes" and offset.
*/
- class VISU_I_EXPORT Prs3d_i :
- public virtual POA_VISU::Prs3d,
- public virtual SALOME::GenericObj_i,
- public virtual TActorFactory,
- public virtual PrsObject_i
+ class VISU_I_EXPORT Prs3d_i : public virtual POA_VISU::Prs3d,
+ public virtual SALOME::GenericObj_i,
+ public virtual TActorFactory,
+ public virtual PrsObject_i
{
Prs3d_i(const Prs3d_i&);
#include "VISU_MultiResult_i.hh"
#include "VISU_ResultUtils.hh"
+#include "VISU_Prs3d_i.hh"
#include "VISU_Convertor_impl.hxx"
#include "VISU_CorbaMedConvertor.hxx"
// OCCT Includes
#include <Bnd_Box.hxx>
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/operations.hpp>
+namespace filesystem = boost::filesystem;
+
#ifdef _DEBUG_
static int MYDEBUG = 1;
//---------------------------------------------------------------
VISU::Result_i
-::Result_i (SALOMEDS::Study_ptr theStudy,
- const ESourceId& theSourceId,
- const ECreationId& theCreationId,
- CORBA::Boolean theIsBuildImmediately,
- CORBA::Boolean theIsBuildFields,
- CORBA::Boolean theIsBuildMinMax,
- CORBA::Boolean theIsBuildGroups):
+::Result_i(SALOMEDS::Study_ptr theStudy,
+ const ESourceId& theSourceId,
+ const ECreationId& theCreationId,
+ CORBA::Boolean theIsBuildImmediately,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildMinMax,
+ CORBA::Boolean theIsBuildGroups):
myStudyDocument(SALOMEDS::Study::_duplicate(theStudy)),
myCreationId(theCreationId),
mySourceId(theSourceId),
}
+//---------------------------------------------------------------
+VISU::Result_i
+::Result_i()
+{}
+
+
//---------------------------------------------------------------
void
VISU::Result_i
//---------------------------------------------------------------
VISU::Storable*
-VISU::Result_i::
-Create(const char* theFileName)
+VISU::Result_i
+::Create(const char* theFileName)
{
try {
myFileInfo.setFile(theFileName);
bool
VISU::Result_i
::Save(SALOMEDS::SComponent_ptr theComponent,
- const char* theTmpDir,
+ const std::string& theURL,
bool theIsMultiFile,
- std::string& theFileName,
- std::string& theFilePath)
+ TFileNames& theFileNames,
+ TFileNames& theFullFileNames,
+ TFileNames& theTemporaryDirs)
{
switch(GetCreationId()){
case Result_i::eImportFile:
case Result_i::eCopyAndImportFile: {
- theFileName = std::string("_") + GetName();
- theFilePath = GetFileInfo().filePath().latin1();
+ filesystem::path aFileName = std::string("_") + GetName();
+ filesystem::path aFilePath = GetFileInfo().filePath().latin1();
if(theIsMultiFile){
CORBA::String_var anURL = GetStudyDocument()->URL();
- theFileName = SALOMEDS_Tool::GetNameFromPath(anURL.in()) + theFileName;
-
- std::ostringstream aCommand;
- aCommand<<COPY_COMMAND<<theFilePath<<" "<<theTmpDir<<theFileName;
- if(system(aCommand.str().c_str()) != 0)
+ aFilePath = SALOMEDS_Tool::GetNameFromPath(anURL.in()) + aFilePath.string();
+ filesystem::path aPathToCopy = filesystem::path(theURL) / aFileName;
+ filesystem::copy_file(aFilePath, aPathToCopy);
+ if(!filesystem::exists(aPathToCopy))
return false;
}
+ if(MYDEBUG) MESSAGE("Result_i::Save - aFileName ='"<<aFileName.string()
+ <<"'; aFilePath = '"<<aFilePath.string()<<"'\n");
+ theFileNames.push_back(aFileName.string());
+ theFullFileNames.push_back(aFilePath.string());
return true;
}}
CORBA::Boolean theIsMultiFile)
{
if(MYDEBUG) MESSAGE("Result_i::Restore - " << thePrefix);
+ mySObject = SALOMEDS::SObject::_duplicate(theSObject);
+ mySComponent = mySObject->GetFatherComponent();
+ myStudyDocument = theSObject->GetStudy();
+
+ myCreationId = ECreationId(Storable::FindValue(theMap, "myCreationId").toInt());
+ mySourceId = eRestoredFile;
+ if(myCreationId == eImportMed || myCreationId == eImportMedField)
+ mySourceId = eRestoredComponent;
+
+ myIsBuildFields = Storable::FindValue(theMap, "myIsBuildFields", "1").toInt();
+ myIsBuildMinMax = Storable::FindValue(theMap, "myIsBuildMinMax", "1").toInt();
+ myIsBuildGroups = Storable::FindValue(theMap, "myIsBuildGroups", "1").toInt();
+ myIsBuildParts = Storable::FindValue(theMap, "myIsBuildParts", "0").toInt();
+
+ myIsBuildImmediately = true;
+
try {
- mySObject = SALOMEDS::SObject::_duplicate(theSObject);
- myStudyDocument = mySObject->GetStudy();
- mySComponent = mySObject->GetFatherComponent();
myName = VISU::Storable::FindValue(theMap, "myName").latin1();
SetFileName(VISU::Storable::FindValue(theMap, "myInitFileName").latin1());
const std::string& thePrefix,
CORBA::Boolean theIsMultiFile)
{
- SALOMEDS::Study_var aStudy = theSObject->GetStudy();
-
- ECreationId aCreationId = ECreationId(Storable::FindValue(theMap, "myCreationId").toInt());
- ESourceId aSourceId = eRestoredFile;
- if(aCreationId == eImportMed || aCreationId == eImportMedField)
- aSourceId = eRestoredComponent;
-
- CORBA::Boolean anIsBuildFields = Storable::FindValue(theMap,"myIsBuildFields","1").toInt();
- CORBA::Boolean anIsBuildMinMax = Storable::FindValue(theMap,"myIsBuildMinMax","1").toInt();
- CORBA::Boolean anIsBuildGroups = Storable::FindValue(theMap,"myIsBuildGroups","1").toInt();
-
- VISU::Result_i* aResult = new RESULT_CLASS_NAME(aStudy,
- aSourceId,
- aCreationId,
- true,
- anIsBuildFields,
- anIsBuildMinMax,
- anIsBuildGroups);
- if (aResult == NULL)
- return NULL;
-
+ VISU::Result_i* aResult = new RESULT_CLASS_NAME();
return aResult->Restore(theSObject, theMap, thePrefix, theIsMultiFile);
}
::ToStream(std::ostringstream& theStr)
{
if(MYDEBUG) MESSAGE(GetComment());
- Storable::DataToStream(theStr,"myName",myName.c_str());
- Storable::DataToStream(theStr,"myInitFileName",GetFileName().c_str());
- Storable::DataToStream(theStr,"myCreationId",myCreationId);
- Storable::DataToStream(theStr,"myIsBuildFields",myIsFieldsDone);
- Storable::DataToStream(theStr,"myIsBuildMinMax",myIsMinMaxDone);
- Storable::DataToStream(theStr,"myIsBuildGroups",myIsGroupsDone);
+ Storable::DataToStream(theStr,"myName", myName.c_str());
+ Storable::DataToStream(theStr,"myInitFileName", GetFileName().c_str());
+ Storable::DataToStream(theStr,"myCreationId", myCreationId);
+ Storable::DataToStream(theStr,"myIsBuildFields", myIsFieldsDone);
+ Storable::DataToStream(theStr,"myIsBuildMinMax", myIsMinMaxDone);
+ Storable::DataToStream(theStr,"myIsBuildGroups", myIsGroupsDone);
+ Storable::DataToStream(theStr,"myIsBuildParts", myIsBuildParts);
}
namespace VISU
{
//----------------------------------------------------------------------------
- class Result_i;
-
-
- //----------------------------------------------------------------------------
- struct TResultObserver: public virtual boost::signalslib::trackable
- {
- virtual
- void
- UpdateFromResult(Result_i* theResult) = 0;
- };
+ class TResultObserver;
//----------------------------------------------------------------------------
New(SALOMEDS::Study_ptr theStudy,
const ESourceId& theSourceId,
const ECreationId& theCreationId,
- CORBA::Boolean theIsBuildImmediately = true,
- CORBA::Boolean theIsBuildFields = true,
- CORBA::Boolean theIsBuildMinMax = true,
- CORBA::Boolean theIsBuildGroups = true);
+ CORBA::Boolean theIsBuildImmediately,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildMinMax,
+ CORBA::Boolean theIsBuildGroups);
virtual
void
Result_i(SALOMEDS::Study_ptr theStudy,
const ESourceId& theSourceId,
const ECreationId& theCreationId,
- CORBA::Boolean theIsBuildImmediately = true,
- CORBA::Boolean theIsBuildFields = true,
- CORBA::Boolean theIsBuildMinMax = true,
- CORBA::Boolean theIsBuildGroups = true);
+ CORBA::Boolean theIsBuildImmediately,
+ CORBA::Boolean theIsBuildFields,
+ CORBA::Boolean theIsBuildMinMax,
+ CORBA::Boolean theIsBuildGroups);
+
+ Result_i();
virtual
~Result_i();
ToStream(std::ostringstream& theStr);
//---------------------------------------------------------------
+ typedef std::string TFileName;
+ typedef std::vector<TFileName> TFileNames;
+
virtual
bool
Save(SALOMEDS::SComponent_ptr theComponent,
- const char* theURL,
+ const std::string& theURL,
bool theIsMultiFile,
- std::string& theFileName,
- std::string& theFilePath);
+ TFileNames& theFileNames,
+ TFileNames& theFullFileNames,
+ TFileNames& theTemporaryDirs);
virtual
bool