--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+// File : VISU_DumpPython.cc
+// Author : Alexey PETROV
+// Module : VISU
+
+#include "VISU_Gen_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_PrsObject_i.hh"
+
+#include "VISU_Prs3d_i.hh"
+#include "VISU_Mesh_i.hh"
+#include "VISU_ScalarMap_i.hh"
+#include "VISU_IsoSurfaces_i.hh"
+#include "VISU_DeformedShape_i.hh"
+#include "VISU_CutPlanes_i.hh"
+#include "VISU_CutLines_i.hh"
+#include "VISU_Vectors_i.hh"
+#include "VISU_StreamLines_i.hh"
+#include "VISU_Table_i.hh"
+
+#include "utilities.h"
+
+#include <cctype>
+#include <strstream>
+#include <functional>
+
+#include <qstring.h>
+#include <qfileinfo.h>
+
+//#define COUT
+
+using namespace std;
+
+namespace VISU{
+ static std::string PREFIX(" ");
+
+ typedef std::map<std::string,std::string> TName2EntryMap;
+ typedef std::map<std::string,std::string> TEntry2NameMap;
+
+ inline
+ std::string
+ GenerateName(std::string theName,
+ SALOMEDS::SObject_ptr theSObject,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ char theSuffix)
+ {
+ if(theName2EntryMap.find(theName) != theName2EntryMap.end()){
+ theName = GenerateName(theName + theSuffix, theSObject, theName2EntryMap, theEntry2NameMap, theSuffix);
+ }else{
+ CORBA::String_var anID = theSObject->GetID();
+ theName2EntryMap[theName] = anID.in();
+ theEntry2NameMap[anID.in()] = theName;
+ //cout<<"GenerateName - "<<theName<<" => "<<anID.in()<<endl;
+ }
+
+ return theName;
+ }
+
+ struct TReplacePredicate{
+ bool operator()(char theChar) const
+ {
+ return !(isdigit(theChar) || isalpha(theChar) || theChar == '_');
+ }
+ };
+
+ inline
+ std::string
+ GetName(SALOMEDS::SObject_ptr theSObject)
+ {
+ CORBA::String_var aString = theSObject->GetName();
+
+ std::string aName = QString(aString.in()).simplifyWhiteSpace().latin1();
+
+ //replace_if(aName.begin(),aName.end(),not1(ptr_fun(isxdigit)),'_');
+ replace_if(aName.begin(),aName.end(),TReplacePredicate(),'_');
+
+ if ( isdigit( aName[0] ))
+ aName.insert( 0, 1, 'a' );
+
+ return aName;
+ }
+
+ inline
+ std::string
+ GenerateName(SALOMEDS::SObject_ptr theSObject,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap)
+ {
+ std::string aName = GetName(theSObject);
+
+ return GenerateName(aName,theSObject,theName2EntryMap,theEntry2NameMap,'X');
+ }
+
+
+ //===========================================================================
+ typedef void (*TDumpToPython)(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix);
+
+
+ void
+ DumpToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix);
+
+
+ //===========================================================================
+ std::string
+ ScalarMapToPython(SALOMEDS::SObject_ptr theSObject,
+ VISU::ScalarMap_i* theServant,
+ std::ostream& theStr,
+ std::string& theName,
+ const std::string& theConstructorName,
+ const std::string& theArgumentName,
+ std::string thePrefix)
+ {
+ std::string aParam;
+ switch(theServant->GetEntity()){
+ case NODE:
+ aParam = "VISU.NODE";
+ break;
+ case EDGE:
+ aParam = "VISU.EDGE";
+ break;
+ case FACE:
+ aParam = "VISU.FACE";
+ break;
+ case CELL:
+ aParam = "VISU.CELL";
+ break;
+ }
+
+ theStr<<thePrefix<<theName<<" = aVisu."<<theConstructorName<<"("<<theArgumentName<<
+ ",'"<<theServant->GetMeshName()<<"'"<<
+ ","<<aParam<<
+ ",'"<<theServant->GetFieldName()<<"'"<<
+ ","<<theServant->GetIteration()<<
+ ")"<<endl;
+
+ theStr<<thePrefix<<"if "<<theName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"aName2ObjectMap['"<<theName<<"'] = "<<theName<<endl;
+
+ theStr<<thePrefix<<theName<<".SetScalarMode("<<theServant->GetScalarMode()<<")"<<endl;
+
+ switch(theServant->GetScaling()){
+ case LINEAR:
+ aParam = "VISU.LINEAR";
+ break;
+ case LOGARITHMIC:
+ aParam = "VISU.LOGARITHMIC";
+ break;
+ }
+ theStr<<thePrefix<<theName<<".SetScaling("<<aParam<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetRange("<<theServant->GetMin()<<","<<theServant->GetMax()<<")"<<endl;
+
+ switch(theServant->GetBarOrientation()){
+ case ScalarMap::HORIZONTAL:
+ aParam = "VISU.ScalarMap.HORIZONTAL";
+ break;
+ case ScalarMap::VERTICAL:
+ aParam = "VISU.ScalarMap.VERTICAL";
+ break;
+ }
+ theStr<<thePrefix<<theName<<".SetBarOrientation("<<aParam<<")"<<endl;
+
+ theStr<<thePrefix<<theName<<".SetPosition("<<theServant->GetPosX()<<","<<theServant->GetPosY()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetSize("<<theServant->GetWidth()<<","<<theServant->GetHeight()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetNbColors("<<theServant->GetNbColors()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetLabels("<<theServant->GetLabels()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetTitle('"<<theServant->GetTitle()<<"')"<<endl;
+
+ return thePrefix;
+ }
+
+
+ //===========================================================================
+ std::string
+ DeformedShapeToPython(SALOMEDS::SObject_ptr theSObject,
+ VISU::DeformedShape_i* theServant,
+ std::ostream& theStr,
+ std::string& theName,
+ const std::string& theConstructorName,
+ const std::string& theArgumentName,
+ std::string thePrefix)
+ {
+ thePrefix = ScalarMapToPython(theSObject,theServant,theStr,theName,theConstructorName,theArgumentName,thePrefix);
+ theStr<<thePrefix<<theName<<".SetScale("<<theServant->GetScale()<<")"<<endl;
+ theStr<<thePrefix<<theName<<".ShowColored("<<theServant->IsColored()<<")"<<endl;
+ SALOMEDS::Color aColor = theServant->GetColor();
+ theStr<<thePrefix<<theName<<".SetColor(SALOMEDS.Color("<<
+ aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
+
+ return thePrefix;
+ }
+
+
+ //===========================================================================
+ template<class TTableAttr>
+ void
+ TableAttrToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ TTableAttr theTableAttr,
+ const std::string& theAttrName,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::SObject_var aFatherSObject = theSObject->GetFather();
+ if(aFatherSObject->FindAttribute(anAttr,"AttributeComment")){
+ SALOMEDS::AttributeComment_var aComment =
+ SALOMEDS::AttributeComment::_narrow(anAttr);
+ CORBA::String_var aValue = aComment->Value();
+ Storable::TRestoringMap aMap;
+ Storable::StrToMap(aValue.in(),aMap);
+ bool anIsExist;
+ QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
+ if(anIsExist){
+ if(strcmp(aMethodName.latin1(),"ImportTables") == 0){
+ return;
+ }
+ }
+ }
+
+ std::string aSObjectName = GetName(theSObject);
+ theStr<<thePrefix<<aSObjectName<<" = aBuilder.NewObject(aSComponent)"<<endl;
+ theStr<<thePrefix<<"if "<<aSObjectName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ std::string aName = "aTableAttr";
+ theStr<<thePrefix<<aName<<" = aBuilder.FindOrCreateAttribute("<<
+ aSObjectName<<",'"<<theAttrName<<"')"<<endl;
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ std::string aPrefix = thePrefix;
+ thePrefix += PREFIX;
+
+ CORBA::String_var aString = theTableAttr->GetTitle();
+ theStr<<thePrefix<<aName<<".SetTitle('"<<aString.in()<<"')"<<endl;
+
+ CORBA::Long aNbColumns = theTableAttr->GetNbColumns();
+ theStr<<thePrefix<<aName<<".SetNbColumns("<<aNbColumns<<")"<<endl;
+
+ CORBA::Long aNbRows = theTableAttr->GetNbRows();
+
+ // push values and their indices into streams
+ strstream values, rows, columns;
+ string comma = "";
+ for(CORBA::Long i = 1; i <= aNbColumns; i++){
+ for(CORBA::Long j = aNbRows; j > 0; j--){
+ if(theTableAttr->HasValue(j,i)){
+ values << comma << theTableAttr->GetValue(j,i);
+ rows << comma << j;
+ columns << comma << i;
+ if ( comma.empty() )
+ comma = ",";
+ }
+ }
+ }
+ // push titles and units into streams
+ strstream rowUnits, rowTitles, colTitles;
+ SALOMEDS::StringSeq_var aRowUnits = theTableAttr->GetRowUnits();
+ SALOMEDS::StringSeq_var aRowTitles = theTableAttr->GetRowTitles();
+ comma = "";
+ for(CORBA::Long j = 1; j <= aNbRows; j++){
+ rowUnits << comma << "'" << aRowUnits [ j - 1 ] << "'";
+ rowTitles << comma << "'" << aRowTitles[ j - 1 ] << "'";
+ if ( comma.empty() )
+ comma = ",";
+ }
+ SALOMEDS::StringSeq_var aColumnTitles = theTableAttr->GetColumnTitles();
+ comma = "";
+ for(CORBA::Long j = 1; j <= aNbColumns; j++){
+ colTitles << comma << "'" << aColumnTitles[ j - 1 ] << "'";
+ if ( comma.empty() )
+ comma = ",";
+ }
+ values << '\0';
+ rows << '\0';
+ columns << '\0';
+ rowUnits << '\0';
+ rowTitles << '\0';
+ colTitles << '\0';
+ // write FillTable command
+ theStr<< thePrefix << aName << "_values = [" << values.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_rows = [" << rows.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_columns = [" << columns.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_rUnits = [" << rowUnits.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_rTitles = [" << rowTitles.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_cTitles = [" << colTitles.str() << "]" << endl;
+ theStr<< thePrefix << "visu.FillTable( "
+ << aName << ", "
+ << aName << "_values, "
+ << aName << "_rows, "
+ << aName << "_columns, "
+ << aName << "_rTitles, "
+ << aName << "_rUnits, "
+ << aName << "_cTitles )" << endl;
+
+ if(theSObject->FindAttribute(anAttr,"AttributeIOR")){
+ theStr<<endl;
+ std::string aName = "aTable";
+ theStr<<thePrefix<<"anID = "<<aSObjectName<<".GetID()"<<endl;
+ theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
+ theArgumentName = aName;
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ std::string aPrefix2 = thePrefix + PREFIX;
+
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ aPrefix2);
+
+ theStr<<aPrefix2<<"pass"<<endl<<endl;
+ }
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ theStr<<aPrefix<<"pass"<<endl<<endl;
+ }
+
+
+ //===========================================================================
+ void
+ DumpChildrenToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ SALOMEDS::ChildIterator_var aChildItet = theStudy->NewChildIterator(theSObject);
+ for(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){
+ SALOMEDS::SObject_var aSObject = aChildItet->Value();
+ DumpToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ aSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+ }
+ }
+
+
+ //===========================================================================
+ void
+ DumpTableAttrToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(theSObject->FindAttribute(anAttr,"AttributeTableOfInteger")){
+ SALOMEDS::AttributeTableOfInteger_var aTableAttr =
+ SALOMEDS::AttributeTableOfInteger::_narrow(anAttr);
+
+ TableAttrToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ aTableAttr,
+ "AttributeTableOfInteger",
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ }else if(theSObject->FindAttribute(anAttr,"AttributeTableOfReal")){
+ SALOMEDS::AttributeTableOfReal_var aTableAttr =
+ SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+
+ TableAttrToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ aTableAttr,
+ "AttributeTableOfReal",
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+ }
+ }
+
+
+ //===========================================================================
+ void
+ DumpToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ std::string aName = GetName(theSObject);
+ if(aName == "")
+ return;
+
+ CORBA::Object_var anObj = SObjectToObject(theSObject);
+ if(!CORBA::is_nil(anObj)){
+ VISU::Base_var aBase = VISU::Base::_narrow(anObj);
+ if(!CORBA::is_nil(aBase)){
+ std::string aName = GenerateName(theSObject,theName2EntryMap,theEntry2NameMap);
+ CORBA::String_var anID = theSObject->GetID();
+
+ VISU::VISUType aType = aBase->GetType();
+ switch(aType){
+ case VISU::TRESULT:
+ if(Result_i* aServant = dynamic_cast<Result_i*>(GetServant(anObj).in())){
+ std::string aFileName = aServant->GetFileName();
+ Result_i::ECreationId anId = aServant->GetCreationId();
+ if(anId == Result_i::eImportFile || anId == Result_i::eCopyAndImportFile){
+ switch(anId){
+ case Result_i::eImportFile:
+ theStr<<thePrefix<<aName<<" = aVisu.ImportFile('"<<aFileName<<"')"<<endl;
+ break;
+ case Result_i::eCopyAndImportFile:
+ theStr<<thePrefix<<aName<<" = aVisu.CopyAndImportFile('"<<aFileName<<"')"<<endl;
+ break;
+ }
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }else{
+ SALOMEDS::SObject_var aRefSObj;
+ if(theSObject->FindSubObject(1,aRefSObj)){
+ SALOMEDS::SObject_var aTargetRefSObj;
+ if(aRefSObj->ReferencedObject(aTargetRefSObj)){
+ CORBA::String_var aString = aTargetRefSObj->GetName();
+ theStr<<thePrefix<<"aSObject = theStudy.FindObject('"<<aString.in()<<"')"<<endl;
+ theStr<<thePrefix<<"if aSObject:"<<endl;
+ thePrefix += PREFIX;
+ theStr<<thePrefix<<"anObject = aSObject.GetObject()"<<endl;
+ theStr<<thePrefix<<"if anObject:"<<endl;
+ std::string aPrefix1 = thePrefix;
+ thePrefix += PREFIX;
+
+ switch(anId){
+ case Result_i::eImportMed:
+ theStr<<thePrefix<<aName<<" = aVisu.ImportMed(aSObject)"<<endl;
+ break;
+ case Result_i::eImportMedField:
+ theStr<<thePrefix<<aName<<" = aVisu.ImportMedField(anObject)"<<endl;
+ break;
+ }
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ std::string aPrefix2 = thePrefix;
+ thePrefix += PREFIX;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ theStr<<aPrefix2<<"pass"<<endl<<endl;
+ theStr<<aPrefix1<<"pass"<<endl<<endl;
+ }
+ }
+ }
+ }
+ return;
+ case VISU::TMESH:
+ if(Mesh_i* aServant = dynamic_cast<Mesh_i*>(GetServant(anObj).in())){
+ VISU::Entity anEntity = aServant->GetEntity();
+ const std::string& aSubMeshName = aServant->GetSubMeshName();
+ if(anEntity >= 0){
+ std::string aParam;
+ switch(anEntity){
+ case NODE:
+ aParam = "VISU.NODE";
+ break;
+ case EDGE:
+ aParam = "VISU.EDGE";
+ break;
+ case FACE:
+ aParam = "VISU.FACE";
+ break;
+ case CELL:
+ aParam = "VISU.CELL";
+ break;
+ }
+
+ if(aSubMeshName == "")
+ theStr<<thePrefix<<aName<<" = aVisu.MeshOnEntity("<<theArgumentName<<
+ ",'"<<aServant->GetMeshName()<<"'"<<
+ ","<<aParam<<
+ ")"<<endl;
+ else
+ theStr<<thePrefix<<aName<<" = aVisu.FamilyMeshOnEntity("<<theArgumentName<<
+ ",'"<<aServant->GetMeshName()<<"'"<<
+ ","<<aParam<<
+ ",'"<<aSubMeshName<<"'"<<
+ ")"<<endl;
+ }else
+ theStr<<thePrefix<<aName<<" = aVisu.GroupMesh("<<theArgumentName<<
+ ",'"<<aServant->GetMeshName()<<"'"<<
+ ",'"<<aSubMeshName<<"'"<<
+ ")"<<endl;
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"aName2ObjectMap['"<<aName<<"'] = "<<aName<<endl;
+
+ SALOMEDS::Color aColor;
+ aColor = aServant->GetCellColor();
+ theStr<<thePrefix<<aName<<".SetCellColor(SALOMEDS.Color("<<
+ aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
+
+ aColor = aServant->GetNodeColor();
+ theStr<<thePrefix<<aName<<".SetNodeColor(SALOMEDS.Color("<<
+ aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
+
+ aColor = aServant->GetLinkColor();
+ theStr<<thePrefix<<aName<<".SetLinkColor(SALOMEDS.Color("<<
+ aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
+
+ std::string aParam;
+ switch(aServant->GetPresentationType()){
+ case POINT:
+ aParam = "VISU.POINT";
+ break;
+ case WIREFRAME:
+ aParam = "VISU.WIREFRAME";
+ break;
+ case SHADED:
+ aParam = "VISU.SHADED";
+ break;
+ case INSIDEFRAME:
+ aParam = "VISU.INSIDEFRAME";
+ break;
+ case SURFACEFRAME:
+ aParam = "VISU.SURFACEFRAME";
+ break;
+ case SHRINK:
+ aParam = "VISU.SHRINK";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetPresentationType("<<aParam<<")"<<endl;
+ theStr<<endl;
+
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ return;
+ }
+ break;
+ case VISU::TSCALARMAP:
+ if(ScalarMap_i* aServant = dynamic_cast<ScalarMap_i*>(GetServant(anObj).in())){
+ thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"ScalarMapOnField",theArgumentName,thePrefix);
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TDEFORMEDSHAPE:
+ if(DeformedShape_i* aServant = dynamic_cast<DeformedShape_i*>(GetServant(anObj).in())){
+ thePrefix = DeformedShapeToPython(theSObject,aServant,theStr,aName,"DeformedShapeOnField",theArgumentName,thePrefix);
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TSTREAMLINES:
+ if(StreamLines_i* aServant = dynamic_cast<StreamLines_i*>(GetServant(anObj).in())){
+ thePrefix = DeformedShapeToPython(theSObject,aServant,theStr,aName,"StreamLinesOnField",theArgumentName,thePrefix);
+
+ std::string aParam;
+ switch(aServant->GetDirection()){
+ case StreamLines::FORWARD:
+ aParam = "VISU.StreamLines.FORWARD";
+ break;
+ case StreamLines::BACKWARD:
+ aParam = "VISU.StreamLines.BACKWARD";
+ break;
+ case StreamLines::BOTH:
+ aParam = "VISU.StreamLines.BOTH";
+ break;
+ }
+
+ theStr<<thePrefix<<"aPrs3d = None"<<endl;
+ VISU::Prs3d_var aPrs3d = aServant->GetSource();
+ if(!CORBA::is_nil(aPrs3d)){
+ if(Prs3d_i* aServant3d = dynamic_cast<Prs3d_i*>(GetServant(aPrs3d).in())){
+ SALOMEDS::SObject_var aSObject = aServant3d->GetSObject();
+ CORBA::String_var anID = aSObject->GetID();
+ std::string anArg = theEntry2NameMap[anID.in()];
+ theStr<<thePrefix<<"if aName2ObjectMap.has_key('"<<anArg<<"'):"<<endl;
+ thePrefix += PREFIX;
+ theStr<<thePrefix<<"aPrs3d = aName2ObjectMap['"<<anArg<<"']"<<endl;
+ }
+ }
+
+ theStr<<thePrefix<<aName<<".SetParams("<<
+ aServant->GetIntegrationStep()<<","<<
+ aServant->GetPropagationTime()<<","<<
+ aServant->GetStepLength()<<","<<
+ "aPrs3d"<<","<<
+ aServant->GetUsedPoints()<<","<<
+ aParam<<
+ ")"<<endl;
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TVECTORS:
+ if(Vectors_i* aServant = dynamic_cast<Vectors_i*>(GetServant(anObj).in())){
+ thePrefix = DeformedShapeToPython(theSObject,aServant,theStr,aName,"VectorsOnField",theArgumentName,thePrefix);
+
+ theStr<<thePrefix<<aName<<".SetLineWidth("<<aServant->GetLineWidth()<<")"<<endl;
+
+ std::string aParam;
+ switch(aServant->GetGlyphType()){
+ case Vectors::ARROW:
+ aParam = "VISU.Vectors.ARROW";
+ break;
+ case Vectors::CONE2:
+ aParam = "VISU.Vectors.CONE2";
+ break;
+ case Vectors::CONE6:
+ aParam = "VISU.Vectors.CONE6";
+ break;
+ case Vectors::NONE:
+ aParam = "VISU.Vectors.NONE";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetGlyphType("<<aParam<<")"<<endl;
+
+ switch(aServant->GetGlyphPos()){
+ case Vectors::CENTER:
+ aParam = "VISU.Vectors.CENTER";
+ break;
+ case Vectors::TAIL:
+ aParam = "VISU.Vectors.TAIL";
+ break;
+ case Vectors::HEAD:
+ aParam = "VISU.Vectors.HEAD";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetGlyphPos("<<aParam<<")"<<endl;
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TISOSURFACE:
+ if(IsoSurfaces_i* aServant = dynamic_cast<IsoSurfaces_i*>(GetServant(anObj).in())){
+ thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"IsoSurfacesOnField",theArgumentName,thePrefix);
+ theStr<<thePrefix<<aName<<".SetNbSurfaces("<<aServant->GetNbSurfaces()<<")"<<endl;
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TCUTPLANES:
+ if(CutPlanes_i* aServant = dynamic_cast<CutPlanes_i*>(GetServant(anObj).in())){
+ thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"CutPlanesOnField",theArgumentName,thePrefix);
+
+ std::string aParam;
+ switch(aServant->GetOrientationType()){
+ case CutPlanes::XY:
+ aParam = "VISU.CutPlanes.XY";
+ break;
+ case CutPlanes::YZ:
+ aParam = "VISU.CutPlanes.YZ";
+ break;
+ case CutPlanes::ZX:
+ aParam = "VISU.CutPlanes.ZX";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetOrientation("<<aParam<<","<<aServant->GetRotateX()<<","<<aServant->GetRotateY()<<")"<<endl;
+
+ theStr<<thePrefix<<aName<<".SetDisplacement("<<aServant->GetDisplacement()<<")"<<endl;
+ CORBA::Long aNbPlanes = aServant->GetNbPlanes();
+ theStr<<thePrefix<<aName<<".SetNbPlanes("<<aNbPlanes<<")"<<endl;
+
+ for(CORBA::Long anId = 0; anId < aNbPlanes; anId++){
+ if(!aServant->IsDefault(anId))
+ theStr<<thePrefix<<aName<<".SetPlanePosition("<<anId<<","<<aServant->GetPlanePosition(anId)<<")"<<endl;
+ }
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TCUTLINES:
+ if(CutLines_i* aServant = dynamic_cast<CutLines_i*>(GetServant(anObj).in())){
+ thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"CutLinesOnField",theArgumentName,thePrefix);
+
+ std::string aParam;
+ switch(aServant->GetOrientationType()){
+ case CutPlanes::XY:
+ aParam = "VISU.CutPlanes.XY";
+ break;
+ case CutPlanes::YZ:
+ aParam = "VISU.CutPlanes.YZ";
+ break;
+ case CutPlanes::ZX:
+ aParam = "VISU.CutPlanes.ZX";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetOrientation("<<aParam<<","<<aServant->GetRotateX()<<","<<aServant->GetRotateY()<<")"<<endl;
+
+ switch(aServant->GetOrientationType2()){
+ case CutPlanes::XY:
+ aParam = "VISU.CutPlanes.XY";
+ break;
+ case CutPlanes::YZ:
+ aParam = "VISU.CutPlanes.YZ";
+ break;
+ case CutPlanes::ZX:
+ aParam = "VISU.CutPlanes.ZX";
+ break;
+ }
+ theStr<<thePrefix<<aName<<".SetOrientation2("<<aParam<<","<<aServant->GetRotateX2()<<","<<aServant->GetRotateY2()<<")"<<endl;
+
+ theStr<<thePrefix<<aName<<".SetDisplacement("<<aServant->GetDisplacement()<<")"<<endl;
+ theStr<<thePrefix<<aName<<".SetDisplacement2("<<aServant->GetDisplacement2()<<")"<<endl;
+
+ if(!aServant->IsDefault())
+ theStr<<thePrefix<<aName<<".SetBasePlanePosition("<<aServant->GetBasePlanePosition()<<")"<<endl;
+
+ CORBA::Long aNbLines = aServant->GetNbLines();
+ theStr<<thePrefix<<aName<<".SetNbLines("<<aNbLines<<")"<<endl;
+ for(CORBA::Long anId = 0; anId < aNbLines; anId++){
+ if(!aServant->IsDefaultPosition(anId))
+ theStr<<thePrefix<<aName<<".SetLinePosition("<<anId<<","<<aServant->GetLinePosition(anId)<<")"<<endl;
+ }
+
+ theStr<<endl;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ return;
+ case VISU::TCURVE:
+ if(Curve_i* aServant = dynamic_cast<Curve_i*>(GetServant(anObj).in()))
+ {
+ theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve(" <<
+ theArgumentName<< // table
+ ","<<aServant->GetHRow()<< // H row
+ ","<<aServant->GetVRow()<< // V row
+ ",'"<<aServant->GetTitle()<<"'"; // title
+ SALOMEDS::Color aColor = aServant->GetColor();
+ theStr << ",SALOMEDS.Color("<<
+ aColor.R<<","<<aColor.G<<","<<aColor.B<<")"; // color
+
+ std::string aParam;
+ switch(aServant->GetMarker()){
+ case Curve::NONE: aParam = "VISU.Curve.NONE"; break;
+ case Curve::CIRCLE: aParam = "VISU.Curve.CIRCLE"; break;
+ case Curve::RECTANGLE: aParam = "VISU.Curve.RECTANGLE"; break;
+ case Curve::DIAMOND: aParam = "VISU.Curve.DIAMOND"; break;
+ case Curve::DTRIANGLE: aParam = "VISU.Curve.DTRIANGLE"; break;
+ case Curve::UTRIANGLE: aParam = "VISU.Curve.UTRIANGLE"; break;
+ case Curve::LTRIANGLE: aParam = "VISU.Curve.LTRIANGLE"; break;
+ case Curve::RTRIANGLE: aParam = "VISU.Curve.RTRIANGLE"; break;
+ case Curve::CROSS: aParam = "VISU.Curve.CROSS"; break;
+ case Curve::XCROSS: aParam = "VISU.Curve.XCROSS"; break;
+ }
+ theStr<<","<<aParam; // marker
+
+ switch(aServant->GetLine()){
+ case Curve::VOIDLINE: aParam = "VISU.Curve.VOIDLINE"; break;
+ case Curve::SOLIDLINE: aParam = "VISU.Curve.SOLIDLINE"; break;
+ case Curve::DASHLINE: aParam = "VISU.Curve.DASHLINE"; break;
+ case Curve::DOTLINE: aParam = "VISU.Curve.DOTLINE"; break;
+ case Curve::DASHDOTLINE: aParam = "VISU.Curve.DASHDOTLINE"; break;
+ case Curve::DASHDOTDOTLINE: aParam = "VISU.Curve.DASHDOTDOTLINE"; break;
+ }
+ theStr<<","<<aParam<<","<<aServant->GetLineWidth()<<")"<<endl; // line type,width
+ }
+ return;
+ case VISU::TTABLE:
+ if(Table_i* aServant = dynamic_cast<Table_i*>(GetServant(anObj).in())){
+ SALOMEDS::SObject_var aSObject = aServant->GetSObject();
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(theSObject->FindAttribute(anAttr,"AttributeComment")){
+ using namespace SALOMEDS;
+ AttributeComment_var aComment = AttributeComment::_narrow(anAttr);
+ CORBA::String_var aValue = aComment->Value();
+ Storable::TRestoringMap aMap;
+ Storable::StrToMap(aValue.in(),aMap);
+ bool anIsExist;
+ QString aSourceId = VISU::Storable::FindValue(aMap,"mySourceId",&anIsExist);
+ if(anIsExist){
+ if(strcmp(aSourceId.latin1(),"CutLines") == 0){
+ theStr<<thePrefix<<"if aName2ObjectMap.has_key('"<<theArgumentName<<"'):"<<endl;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"anObject = aName2ObjectMap['"<<theArgumentName<<"']"<<endl;
+ theStr<<thePrefix<<"anIOR = anObject.GetID()"<<endl;
+ theStr<<thePrefix<<"aSObject = theStudy.FindObjectIOR(anIOR)"<<endl;
+ theStr<<thePrefix<<"if aSObject:"<<endl;
+ std::string aPrefix = thePrefix;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"anID = aSObject.GetID()"<<endl;
+ theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
+ theStr<<endl;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ theStr<<aPrefix<<"pass"<<endl<<endl;
+ }else if(strcmp(aSourceId.latin1(),"TableFile") == 0){
+ CORBA::Short aTag = theSObject->Tag();
+ theStr<<thePrefix<<"anIsFound, aSObject = "<<theArgumentName<<".FindSubObject("<<aTag<<")"<<endl;
+ theStr<<thePrefix<<"if anIsFound:"<<endl;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"anID = aSObject.GetID()"<<endl;
+ theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
+ theStr<<endl;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }else if(strcmp(aSourceId.latin1(),"TableAttr") == 0){
+ theArgumentName = aName;
+ DumpTableAttrToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+ }
+ }
+ }
+ }
+ return;
+ }
+ }
+ }else{
+ SALOMEDS::GenericAttribute_var anAttr;
+ if(theSObject->FindAttribute(anAttr,"AttributeComment")){
+ SALOMEDS::AttributeComment_var aComment =
+ SALOMEDS::AttributeComment::_narrow(anAttr);
+ CORBA::String_var aValue = aComment->Value();
+ Storable::TRestoringMap aMap;
+ Storable::StrToMap(aValue.in(),aMap);
+ bool anIsExist;
+ QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
+ if(anIsExist){
+ if(strcmp(aTypeName.latin1(),"ImportTables") == 0){
+ QString aFileName = VISU::Storable::FindValue(aMap,"myFileName",&anIsExist);
+ if(anIsExist){
+ std::string aName = GenerateName(theSObject,theName2EntryMap,theEntry2NameMap);
+ theStr<<thePrefix<<aName<<" = aVisu.ImportTables('"<<aFileName.latin1()<<"')"<<endl;
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ theArgumentName = aName;
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ return;
+ }
+ }else if(strcmp(aTypeName.latin1(),"VIEW3D") == 0){
+ std::string aName = GetName(theSObject);
+ theStr<<thePrefix<<aName<<" = aBuilder.NewObject(aSComponent)"<<endl;
+
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ thePrefix += PREFIX;
+
+ theStr<<thePrefix<<"anAttr = aBuilder.FindOrCreateAttribute("<<aName<<",'AttributeName')"<<endl;
+ theStr<<thePrefix<<"anAttr.SetValue('"<<aName<<"')"<<endl;
+
+ theStr<<thePrefix<<"anAttr = aBuilder.FindOrCreateAttribute("<<aName<<",'AttributeComment')"<<endl;
+ theStr<<thePrefix<<"anAttr.SetValue('"<<aValue.in()<<"')"<<endl;
+
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ return;
+ }
+ }
+ }else{
+ DumpTableAttrToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+ }
+ }
+
+ DumpChildrenToPython(theStudy,
+ theIsPublished,
+ theIsValidScript,
+ theSObject,
+ theStr,
+ theName2EntryMap,
+ theEntry2NameMap,
+ theArgumentName,
+ thePrefix);
+ }
+
+
+ //===========================================================================
+ void
+ DumpCurveToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ SALOMEDS::SObject_var aTargetRefSObj;
+ if(theSObject->ReferencedObject(aTargetRefSObj)){
+ CORBA::Object_var anObj = SObjectToObject(aTargetRefSObj);
+ if(CORBA::is_nil(anObj))
+ return;
+
+ VISU::Base_var aBase = VISU::Base::_narrow(anObj);
+ if(CORBA::is_nil(aBase))
+ return;
+
+ if(aBase->GetType() == VISU::TCURVE){
+ CORBA::String_var anID = aTargetRefSObj->GetID();
+ std::string anArg = theEntry2NameMap[anID.in()];
+ theStr<<thePrefix<<"if aName2ObjectMap.has_key('"<<anArg<<"'):"<<endl;
+ thePrefix += PREFIX;
+ theStr<<thePrefix<<"anObject = aName2ObjectMap['"<<anArg<<"']"<<endl;
+ theStr<<thePrefix<<"if anObject: " <<theArgumentName<<".AddCurve(anObject)"<<endl;
+ theStr<<thePrefix<<"pass"<<endl<<endl;
+ }
+ }
+ }
+
+
+ //===========================================================================
+ void
+ DumpContainersToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ TName2EntryMap& theName2EntryMap,
+ TEntry2NameMap& theEntry2NameMap,
+ std::string theArgumentName,
+ std::string thePrefix)
+ {
+ SALOMEDS::ChildIterator_var aChildItet = theStudy->NewChildIterator(theSObject);
+ for(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){
+ SALOMEDS::SObject_var aSObject = aChildItet->Value();
+ CORBA::Object_var anObj = SObjectToObject(aSObject);
+ if(CORBA::is_nil(anObj))
+ continue;
+
+ VISU::Base_var aBase = VISU::Base::_narrow(anObj);
+ if(CORBA::is_nil(aBase))
+ continue;
+
+ if(aBase->GetType() == VISU::TCONTAINER){
+ theStr<<endl;
+ std::string aName = GenerateName(aSObject,theName2EntryMap,theEntry2NameMap);
+ theStr<<thePrefix<<aName<<" = aVisu.CreateContainer()"<<endl;
+ theStr<<thePrefix<<"if "<<aName<<":"<<endl;
+ std::string aPrefix = thePrefix + PREFIX;
+ theArgumentName = aName;
+
+ SALOMEDS::ChildIterator_var aCurveIter = theStudy->NewChildIterator(aSObject);
+ for(aCurveIter->InitEx(false); aCurveIter->More(); aCurveIter->Next()){
+ SALOMEDS::SObject_var aRefSObj = aCurveIter->Value();
+ DumpCurveToPython(theStudy,theIsPublished,theIsValidScript,aRefSObj,theStr,theName2EntryMap,theEntry2NameMap,theArgumentName,aPrefix);
+ }
+
+ theStr<<aPrefix<<"pass"<<endl<<endl;
+ }
+ }
+ }
+
+
+ //===========================================================================
+ Engines::TMPFile*
+ VISU_Gen_i::
+ DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript)
+ {
+ SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
+ if(CORBA::is_nil(aStudy))
+ return new Engines::TMPFile(0);
+
+ TName2EntryMap aName2EntryMap;
+ TEntry2NameMap aEntry2NameMap;
+
+#ifndef COUT
+ ostringstream aStr;
+#else
+#define aStr cout
+#endif
+
+ std::string aPrefix(PREFIX);
+ aStr<<"### This file is generated by SALOME automatically by dump python funcitonality"
+ " of VISU component"<<endl<<endl;
+ aStr<<"def RebuildData(theStudy):"<<endl;
+ aStr<<aPrefix<<"from batchmode_salome import orb, naming_service, lcc, myStudyManager"<<endl;
+ aStr<<aPrefix<<"import SALOME_MED"<<endl;
+ aStr<<aPrefix<<"import SALOMEDS"<<endl;
+ aStr<<aPrefix<<"import VISU"<<endl;
+ aStr<<aPrefix<<"import visu"<<endl;
+ aStr<<endl;
+ aStr<<aPrefix<<"aVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,theStudy,0)"<<endl;
+ aStr<<aPrefix<<"aSComponent = visu.PublishComponent(theStudy)"<<endl;
+ aStr<<aPrefix<<"aMed = lcc.FindOrLoadComponent('FactoryServer','MED')"<<endl;
+ aStr<<aPrefix<<"aBuilder = theStudy.NewBuilder()"<<endl;
+ aStr<<aPrefix<<"aName2ObjectMap = {}"<<endl;
+ aStr<<endl;
+
+ SALOMEDS::SComponent_var aComponent = FindOrCreateVisuComponent(aStudy);
+ VISU::DumpChildrenToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aName2EntryMap,aEntry2NameMap,"",aPrefix);
+ VISU::DumpContainersToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aName2EntryMap,aEntry2NameMap,"",aPrefix);
+
+ aStr<<aPrefix<<"pass"<<endl;
+
+#ifndef COUT
+ std::string aResult = aStr.str();
+ //ofstream anFStream("/tmp/dump.py");
+ //anFStream<<aResult<<endl;
+
+ CORBA::ULong aSize = aResult.size() + 1;
+ char* aBuffer = new char[aSize];
+ strcpy(aBuffer,&aResult[0]);
+ return new Engines::TMPFile(aSize,aSize,(CORBA::Octet*)aBuffer,1);
+#else
+#undef aStr
+ return new Engines::TMPFile(0);
+#endif
+ }
+
+}