#include <strstream>
#ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
static int MYTIMEDEBUG = 0;
#else
static int MYDEBUG = 0;
myMultiprObj.create(theFileName);
if (myMultiprObj.isValidDistributedMEDFile()) {
aTargetFileName = myMultiprObj.getSequentialMEDFilename();
- SetFileName(aFileInfo.filePath().latin1());
+ SetInitFileName(aFileInfo.filePath().latin1());
+ SetName(VISU::GenerateName(aFileInfo.fileName()).latin1(), false);
myIsBuildParts = true;
}
}
}
std::string aBase, aSuffix;
- SplitName(GetName(), aBase, aSuffix);
+ SplitName(GetFileName(), aBase, aSuffix);
BEGMSG(MYDEBUG, "aBase = '"<<aBase<<"'; aSuffix = '"<<aSuffix<<"'\n");
aPrefix = aPrefix + "_" + aBase;
aFileName = aFileName + aSuffix;
INITMSG(MYDEBUG, "aFileName = '"<<aFileName<<"'\n");
- std::string aPathToCopy(theURL + aFileName);
- BEGMSG(MYDEBUG, "aPathToCopy = '"<<aPathToCopy<<"'\n");
-
- if(theIsMultiFile)
+ if(theIsMultiFile || theIsASCII){
+ std::string aPathToCopy(theURL + aFileName);
+ BEGMSG(MYDEBUG, "aPathToCopy = '"<<aPathToCopy<<"'\n");
+
if(!VISU::CopyFile(aFile, aPathToCopy))
return false;
- if(theIsMultiFile || theIsASCII)
- HDFascii::ConvertFromHDFToASCII(const_cast<char*>(aPathToCopy.c_str()), true);
+ if(theIsASCII)
+ HDFascii::ConvertFromHDFToASCII(const_cast<char*>(aPathToCopy.c_str()), true);
+ }
theFileNames.push_back(aFileName);
theFiles.push_back(aFile);
}
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::MultiResult_i
+::CanCopy(SALOMEDS::SObject_ptr theObject)
+{
+ if(!myIsPartsDone)
+ return Result_i::CanCopy(theObject);
+
+ return false;
+}
+
+
//---------------------------------------------------------------
void
VISU::MultiResult_i
{
std::string aBase, aSuffix;
- SplitName(GetName(), aBase, aSuffix);
+ SplitName(GetFileName(), aBase, aSuffix);
INITMSG(MYDEBUG, "aBase = '"<<aBase<<"'; aSuffix = '"<<aSuffix<<"'\n");
QFileInfo aFileInfo(myMultiprObj.getSequentialMEDFilename());
}
std::string aBase, aSuffix;
- SplitName(GetName(), aBase, aSuffix);
+ SplitName(GetFileName(), aBase, aSuffix);
INITMSGA(MYDEBUG, 0, "aBase = '"<<aBase<<"'; aSuffix = '"<<aSuffix<<"'\n");
std::string aSourceFileName = GetFileInfo().absFilePath().latin1();
TRepresentation2Input::iterator anIter = myRepresentation2Input.find(aRepresentationKey);
if(anIter == myRepresentation2Input.end()){
INITMSG(MYDEBUG, "MultiResult_i::GetInput - this = "<<this<<"\n");
- std::string aFileName = SALOMEDS_Tool::GetTmpDir() + "tmp.med";
+ std::string aFileName = SALOMEDS_Tool::GetTmpDir() + "multipr_merge.med";
if(MYDEBUG){
INITMSG(MYDEBUG, "aFileName = '"<<aFileName<<"':\n");
TFileNames::const_iterator anIter = aFileNames.begin();
#include <Bnd_Box.hxx>
#ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
#else
static int MYDEBUG = 0;
#endif
aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
GetComment(),
myFileInfo.filePath().latin1(),
- GetFileName().c_str()); // Restoring of Python dump
+ GetInitFileName().c_str()); // Restoring of Python dump
std::string aResultEntry =
CreateAttributes(myStudy,
aSComponentEntry.in(),
NO_ICON,
anIOR.in(),
- myName,
+ GetName(),
NO_PERFSITENT_REF,
aComment.latin1(),
true);
{
try {
myFileInfo.setFile(theFileName);
- if(!myIsBuildParts)
- SetFileName(myFileInfo.filePath().latin1());
- myName = VISU::GenerateName(myFileInfo.fileName()).latin1();
+ myFileName = myFileInfo.fileName().latin1();
+
+ if(!myIsBuildParts){
+ SetInitFileName(myFileInfo.filePath().latin1());
+ SetName(VISU::GenerateName(myFileInfo.fileName()).latin1(), false);
+ }
+
if(mySourceId == eRestoredFile){
- std::string aTmpDir(SALOMEDS_Tool::GetTmpDir());
- static QString aCommand;
- aCommand.sprintf(" %s %s", myFileInfo.absFilePath().latin1(), aTmpDir.c_str() );
- aCommand = QDir::convertSeparators( aCommand );
- aCommand.prepend( COPY_COMMAND );
-
- if(system(aCommand.latin1()) == -1){
- MESSAGE("Create - Can't execute the command :"<<aCommand);
+ QString aTmpDir(SALOMEDS_Tool::GetTmpDir().c_str());
+ QString aSuffix = QString::number(size_t(this));
+ QString aPathToCopy(aTmpDir + myFileInfo.fileName() + ":" + aSuffix);
+ if(!VISU::CopyFile(myFileInfo.absFilePath().latin1(), aPathToCopy.latin1()))
return NULL;
- }
- if(MYDEBUG) MESSAGE("Result_i::Create - aCommand = "<<aCommand);
- myFileInfo.setFile(QString(aTmpDir.c_str()) + myFileInfo.fileName());
- }
+
+ myFileInfo.setFile(aPathToCopy);
+ myFileName = myFileInfo.fileName().latin1();
+ }
myInput.reset(CreateConvertor(myFileInfo.absFilePath().latin1()));
string aCompDataType = GetComponentDataType(theMedSObject);
myFileInfo.setFile(aCompDataType.c_str());
- SetFileName(aCompDataType);
+ SetInitFileName(aCompDataType);
- myName = VISU::GenerateName("aResult").latin1();
+ myFileName = VISU::GenerateName("aResult").latin1();
return Build(theMedSObject);
}catch(std::exception& exc){
string aCompDataType = "MED";
myFileInfo.setFile(aCompDataType.c_str());
- SetFileName(aCompDataType);
+ SetInitFileName(aCompDataType);
- myName = VISU::GenerateName("aResult").latin1();
+ myFileName = VISU::GenerateName("aResult").latin1();
CORBA::String_var anIOR = myStudyDocument->ConvertObjectToIOR(theField);
SALOMEDS::SObject_var aFieldSObject = myStudyDocument->FindObjectIOR(anIOR);
aPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
}
- std::string aFileName = aPrefix + "_" + GetName();
+ std::string aFileName = aPrefix + "_" + GetFileName();
BEGMSG(MYDEBUG, "aFileName = '"<<aFileName<<"'\n");
std::string aFile = GetFileInfo().filePath().latin1();
BEGMSG(MYDEBUG, "aFile = '"<<aFile<<"'\n");
- std::string aPathToCopy(theURL + aFileName);
- BEGMSG(MYDEBUG, "aPathToCopy = '"<<aPathToCopy<<"'\n");
-
- if(theIsMultiFile || theIsASCII)
+ if(theIsMultiFile || theIsASCII){
+ std::string aPathToCopy(theURL + aFileName);
+ BEGMSG(MYDEBUG, "aPathToCopy = '"<<aPathToCopy<<"'\n");
+
if(!VISU::CopyFile(aFile, aPathToCopy))
return false;
- if(theIsASCII)
- HDFascii::ConvertFromHDFToASCII(const_cast<char*>(aPathToCopy.c_str()), true);
+ if(theIsASCII)
+ HDFascii::ConvertFromHDFToASCII(const_cast<char*>(aPathToCopy.c_str()), true);
+ }
theFileNames.push_back(aFileName);
theFiles.push_back(aFile);
myIsBuildImmediately = true;
try {
- myName = VISU::Storable::FindValue(theMap, "myName").latin1();
- VISU::GenerateName(myName); // To register the name in global naming map
- SetFileName(VISU::Storable::FindValue(theMap, "myInitFileName").latin1());
+ myFileName = VISU::Storable::FindValue(theMap, "myName").latin1();
+ SetInitFileName(VISU::Storable::FindValue(theMap, "myInitFileName").latin1());
SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
if (theSObject->FindSubObject(1, aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)) {
aStudyPrefix = SALOMEDS_Tool::GetNameFromPath(anURL.in());
}
if (!myFileInfo.isFile()) {
- string aFileName = thePrefix + aStudyPrefix + "_" + myName;
+ std::string aFileName = thePrefix + aStudyPrefix + "_" + myFileName;
myFileInfo.setFile(aFileName.c_str());
}
if(MYDEBUG)
aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
GetComment(),
myFileInfo.filePath().latin1(),
- GetFileName().c_str()); // Restoring of Python dump
+ GetInitFileName().c_str()); // Restoring of Python dump
SALOMEDS::GenericAttribute_var anAttr;
if (!theSObject->FindAttribute(anAttr, "AttributeString"))
throw std::runtime_error("Build - There is no AttributeString for the SObject !!!");
VISU::Result_i
::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,"myName", GetFileName().c_str());
+ Storable::DataToStream(theStr,"myInitFileName", GetInitFileName().c_str());
Storable::DataToStream(theStr,"myCreationId", myCreationId);
Storable::DataToStream(theStr,"myIsBuildFields", myIsFieldsDone);
Storable::DataToStream(theStr,"myIsBuildMinMax", myIsMinMaxDone);
//---------------------------------------------------------------
-const std::string&
+std::string
VISU::Result_i
-::GetFileName() const
+::GetInitFileName() const
{
return myInitFileName;
}
void
VISU::Result_i
-::SetFileName(const std::string& theFileName)
+::SetInitFileName(const std::string& theFileName)
{
myInitFileName = theFileName;
}
//---------------------------------------------------------------
-const std::string&
+std::string
VISU::Result_i
-::GetName() const
+::GetFileName() const
{
- return myName;
+ if(GetSourceId() == eFile)
+ return QString("%1:%2").arg(myFileName.c_str()).arg(size_t(this)).latin1();
+
+ return myFileName;
}
-const QFileInfo&
+QFileInfo
VISU::Result_i
::GetFileInfo() const
{
return myFileInfo;
}
-const VISU::Result_i::ECreationId&
+VISU::Result_i::ECreationId
VISU::Result_i
::GetCreationId() const
{
}
-const VISU::Result_i::ESourceId&
+VISU::Result_i::ESourceId
VISU::Result_i
::GetSourceId() const
{
return anEntry.in();
}
-const SALOMEDS::SObject_var&
+SALOMEDS::SObject_var
VISU::Result_i
::GetSObject() const
{
return mySObject;
}
-const SALOMEDS::Study_var&
+SALOMEDS::Study_var
VISU::Result_i
::GetStudyDocument() const
{
return myStudy;
}
-const SALOMEDS::SComponent_var&
+SALOMEDS::SComponent_var
VISU::Result_i
::GetSComponent() const
{