From 989fe4c4cfe093f5b9593914461ab34e9c1ae657 Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 16 Jul 2007 14:05:11 +0000 Subject: [PATCH] To fix problem with Python dumping for the 3DCacheSystem when it is published into Study before Result objects --- src/VISU_I/VISU_DumpPython.cc | 299 ++++++++++++++++++++++------------ 1 file changed, 194 insertions(+), 105 deletions(-) diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index 733b0a81..073d7367 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -61,8 +61,6 @@ namespace VISU { static std::string PREFIX(" "); - static std::string aResultName; - typedef std::map TName2EntryMap; typedef std::map TEntry2NameMap; @@ -118,7 +116,7 @@ namespace VISU { std::string aName = GetName(theSObject); - return GenerateName(aName,theSObject,theName2EntryMap,theEntry2NameMap,'X'); + return GenerateName(aName, theSObject, theName2EntryMap, theEntry2NameMap, 'X'); } @@ -876,19 +874,17 @@ namespace VISU 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); + std::string aName = GenerateName(theSObject, theName2EntryMap, theEntry2NameMap); VISU::VISUType aType = aBase->GetType(); switch(aType){ case VISU::TRESULT: if(Result_i* aServant = dynamic_cast(GetServant(anObj).in())){ - aResultName = aName; - std::string aFileName = aServant->GetFileName(); + std::string aFileName = aServant->GetInitFileName(); Result_i::ECreationId anId = aServant->GetCreationId(); if(anId == Result_i::eImportFile || anId == Result_i::eCopyAndImportFile){ switch(anId){ case Result_i::eImportFile: - //theStr<NewChildIterator(theSObject); - for(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){ - SALOMEDS::SObject_var aSObject = aChildItet->Value(); - CORBA::Object_var anObject = SObjectToObject(aSObject); - if (CORBA::is_nil(anObject)) - continue; - if(ColoredPrs3dHolder_i* aServant = dynamic_cast(GetServant(anObject).in())){ - ColoredPrs3dHolder::BasicInput_var anInput = aServant->GetBasicInput(); - std::string anEntity; - switch(anInput->myEntity){ - case VISU::NODE : anEntity = "VISU.NODE"; break; - case VISU::EDGE : anEntity = "VISU.EDGE"; break; - case VISU::FACE : anEntity = "VISU.FACE"; break; - case VISU::CELL : anEntity = "VISU.CELL"; break; - } - - ColoredPrs3d_var aDevice = aServant->GetDevice(); - theStr<myMeshName<<"', "<< - anEntity<<", '"<< - anInput->myFieldName<<"', "<< - anInput->myTimeStampNumber<<")"<< - endl; - - if(Prs3d_i* aPrs3d = dynamic_cast(GetServant(aDevice).in())){ - std::string aComment = aPrs3d->GetComment(); - theStr<GetName(); - theStr<GetType()){ - case VISU::TSCALARMAP: - if(ScalarMap_i* aServant = dynamic_cast(aPrs3d)){ - aPrefix = ScalarMapToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix); - break; - } - case VISU::TDEFORMEDSHAPE: - if(DeformedShape_i* aServant = dynamic_cast(aPrs3d)){ - aPrefix = DeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix); - break; - } - case VISU::TSTREAMLINES: - if(StreamLines_i* aServant = dynamic_cast(aPrs3d)){ - aPrefix = StreamLinesToPython(aSObject, aServant, theStr, theEntry2NameMap, "aDevice", aPrsFactory, aPrefix); - break; - } - case VISU::TSCALARMAPONDEFORMEDSHAPE: - if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast(aPrs3d)){ - aPrefix = ScalarMapOnDeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix); - break; - } - case VISU::TVECTORS: - if(Vectors_i* aServant = dynamic_cast(aPrs3d)){ - aPrefix = VectorsToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix); - break; - } - case VISU::TISOSURFACES: - if(IsoSurfaces_i* aServant = dynamic_cast(aPrs3d)){ - aPrefix = IsoSurfacesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix); - break; - } - case VISU::TCUTPLANES: - if(CutPlanes_i* aServant = dynamic_cast(aPrs3d)){ - aPrefix = CutPlanesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix); - break; - } - case VISU::TCUTLINES: - if(CutLines_i* aServant = dynamic_cast(aPrs3d)){ - aPrefix = CutLinesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix); - break; - } - case VISU::TPLOT3D: - if (Plot3D_i* aServant = dynamic_cast(aPrs3d)) { - aPrefix = Plot3DToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix); - break; - } - case VISU::TGAUSSPOINTS: - if(GaussPoints_i* aServant = dynamic_cast(aPrs3d)){ - aPrefix = ColoredPrs3dToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix); - break; - } - } - theStr<NewChildIterator(theSObject); + for(anIter->InitEx(false); anIter->More(); anIter->Next()){ + SALOMEDS::SObject_var aSObject = anIter->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::TCOLOREDPRS3DCACHE){ + ColoredPrs3dCache_i* aCache = dynamic_cast(GetServant(aBase).in()); + theStr<GetMemoryMode(); + switch(aMode){ + case VISU::ColoredPrs3dCache::MINIMAL : anArgument = "VISU.ColoredPrs3dCache.MINIMAL"; break; + case VISU::ColoredPrs3dCache::LIMITED : anArgument = "VISU.ColoredPrs3dCache.LIMITED"; break; + } + theStr<GetLimitedMemory()<<") # (Mb)"<NewChildIterator(aSObject); + for(aChildIter->InitEx(false); aChildIter->More(); aChildIter->Next()){ + SALOMEDS::SObject_var aSObject = aChildIter->Value(); + CORBA::Object_var anObject = SObjectToObject(aSObject); + if (CORBA::is_nil(anObject)) + continue; + + ColoredPrs3dHolder_i* aServant = dynamic_cast(GetServant(anObject).in()); + if(!aServant) + continue; + + ColoredPrs3d_i* aDevice = aServant->GetPrs3dDevice(); + if(!aDevice) + continue; + + Result_i* aResult = aDevice->GetCResult(); + std::string aResultEntry = aResult->GetEntry(); + std::string aResultName = theEntry2NameMap[aResultEntry]; + + ColoredPrs3dHolder::BasicInput_var anInput = aServant->GetBasicInput(); + std::string anEntity; + switch(anInput->myEntity){ + case VISU::NODE : anEntity = "VISU.NODE"; break; + case VISU::EDGE : anEntity = "VISU.EDGE"; break; + case VISU::FACE : anEntity = "VISU.FACE"; break; + case VISU::CELL : anEntity = "VISU.CELL"; break; + } + + + theStr<myMeshName<<"', "<< + anEntity<<", '"<< + anInput->myFieldName<<"', "<< + anInput->myTimeStampNumber<<")"<< + endl; + + std::string aComment = aDevice->GetComment(); + theStr<GetName(); + theStr<GetType()){ + case VISU::TSCALARMAP: + if(ScalarMap_i* aServant = dynamic_cast(aDevice)){ + ScalarMapToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3); + break; + } + case VISU::TDEFORMEDSHAPE: + if(DeformedShape_i* aServant = dynamic_cast(aDevice)){ + DeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3); + break; + } + case VISU::TSTREAMLINES: + if(StreamLines_i* aServant = dynamic_cast(aDevice)){ + StreamLinesToPython(aSObject, aServant, theStr, theEntry2NameMap, "aDevice", aPrsFactory, aPrefix3); + break; + } + case VISU::TSCALARMAPONDEFORMEDSHAPE: + if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast(aDevice)){ + ScalarMapOnDeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3); + break; + } + case VISU::TVECTORS: + if(Vectors_i* aServant = dynamic_cast(aDevice)){ + VectorsToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3); + break; + } + case VISU::TISOSURFACES: + if(IsoSurfaces_i* aServant = dynamic_cast(aDevice)){ + IsoSurfacesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3); + break; + } + case VISU::TCUTPLANES: + if(CutPlanes_i* aServant = dynamic_cast(aDevice)){ + CutPlanesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3); + break; + } + case VISU::TCUTLINES: + if(CutLines_i* aServant = dynamic_cast(aDevice)){ + CutLinesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3); + break; + } + case VISU::TPLOT3D: + if(Plot3D_i* aServant = dynamic_cast(aDevice)){ + Plot3DToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3); + break; + } + case VISU::TGAUSSPOINTS: + if(GaussPoints_i* aServant = dynamic_cast(aDevice)){ + ColoredPrs3dToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3); + break; + } + } + theStr<