{
static std::string PREFIX(" ");
- static std::string aResultName;
-
typedef std::map<std::string,std::string> TName2EntryMap;
typedef std::map<std::string,std::string> TEntry2NameMap;
{
std::string aName = GetName(theSObject);
- return GenerateName(aName,theSObject,theName2EntryMap,theEntry2NameMap,'X');
+ return GenerateName(aName, theSObject, theName2EntryMap, theEntry2NameMap, 'X');
}
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<Result_i*>(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<<thePrefix<<aName<<" = aVisu.ImportFile('"<<aFileName<<"')"<<endl;
theStr<<thePrefix<<aName<<" = aVisu.CreateResult('"<<aFileName<<"')"<<endl;
theStr<<thePrefix<<aName<<".SetBuildGroups("<<
}
}
return;
- case VISU::TCOLOREDPRS3DCACHE:
- theStr<<thePrefix<<"aCache = aVisu.GetColoredPrs3dCache(aVisu.GetCurrentStudy())"<<endl<<endl;
- SALOMEDS::ChildIterator_var aChildItet = theStudy->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<ColoredPrs3dHolder_i*>(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<<thePrefix<<"anInput = VISU.ColoredPrs3dHolder.BasicInput("<<
- aResultName<<", '"<<
- anInput->myMeshName<<"', "<<
- anEntity<<", '"<<
- anInput->myFieldName<<"', "<<
- anInput->myTimeStampNumber<<")"<<
- endl;
-
- if(Prs3d_i* aPrs3d = dynamic_cast<Prs3d_i*>(GetServant(aDevice).in())){
- std::string aComment = aPrs3d->GetComment();
- theStr<<thePrefix<<"aHolder = aCache.CreateHolder(VISU.T"<<aComment<<", anInput)"<<endl;
- theStr<<thePrefix<<"if aHolder != None:"<<endl;
- {
- std::string aPrefix = thePrefix + PREFIX;
- CORBA::String_var aNameInStudy = aSObject->GetName();
- theStr<<aPrefix<<"visu.SetName(aHolder, '"<<aNameInStudy.in()<<"')"<<endl;
- theStr<<aPrefix<<"aDevice = aHolder.GetDevice()"<<endl;
- TColoredPrs3dFactory aPrsFactory;
- switch(aPrs3d->GetType()){
- case VISU::TSCALARMAP:
- if(ScalarMap_i* aServant = dynamic_cast<ScalarMap_i*>(aPrs3d)){
- aPrefix = ScalarMapToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TDEFORMEDSHAPE:
- if(DeformedShape_i* aServant = dynamic_cast<DeformedShape_i*>(aPrs3d)){
- aPrefix = DeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TSTREAMLINES:
- if(StreamLines_i* aServant = dynamic_cast<StreamLines_i*>(aPrs3d)){
- aPrefix = StreamLinesToPython(aSObject, aServant, theStr, theEntry2NameMap, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TSCALARMAPONDEFORMEDSHAPE:
- if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast<ScalarMapOnDeformedShape_i*>(aPrs3d)){
- aPrefix = ScalarMapOnDeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TVECTORS:
- if(Vectors_i* aServant = dynamic_cast<Vectors_i*>(aPrs3d)){
- aPrefix = VectorsToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TISOSURFACES:
- if(IsoSurfaces_i* aServant = dynamic_cast<IsoSurfaces_i*>(aPrs3d)){
- aPrefix = IsoSurfacesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TCUTPLANES:
- if(CutPlanes_i* aServant = dynamic_cast<CutPlanes_i*>(aPrs3d)){
- aPrefix = CutPlanesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TCUTLINES:
- if(CutLines_i* aServant = dynamic_cast<CutLines_i*>(aPrs3d)){
- aPrefix = CutLinesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TPLOT3D:
- if (Plot3D_i* aServant = dynamic_cast<Plot3D_i*>(aPrs3d)) {
- aPrefix = Plot3DToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- case VISU::TGAUSSPOINTS:
- if(GaussPoints_i* aServant = dynamic_cast<GaussPoints_i*>(aPrs3d)){
- aPrefix = ColoredPrs3dToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix);
- break;
- }
- }
- theStr<<aPrefix<<"pass"<<endl<<endl;
- }
- }
- }
- }
- return;
}
}
} else { /*if(!CORBA::is_nil(anObj))*/
}
}
+
+ //---------------------------------------------------------------------------
+ void
+ DumpPrs3dCacheToPython(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 anIter = theStudy->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<ColoredPrs3dCache_i*>(GetServant(aBase).in());
+ theStr<<thePrefix<<"aCache = aVisu.GetColoredPrs3dCache(aVisu.GetCurrentStudy())"<<endl;
+ theStr<<thePrefix<<"if aCache != None:"<<endl;
+ {
+ std::string aPrefix = thePrefix + PREFIX;
+ std::string anArgument;
+ VISU::ColoredPrs3dCache::MemoryMode aMode = aCache->GetMemoryMode();
+ switch(aMode){
+ case VISU::ColoredPrs3dCache::MINIMAL : anArgument = "VISU.ColoredPrs3dCache.MINIMAL"; break;
+ case VISU::ColoredPrs3dCache::LIMITED : anArgument = "VISU.ColoredPrs3dCache.LIMITED"; break;
+ }
+ theStr<<aPrefix<<"aCache.SetMemoryMode("<<anArgument<<")"<<endl;
+
+ if(aMode == VISU::ColoredPrs3dCache::LIMITED)
+ theStr<<aPrefix<<"aCache.SetLimitedMemory("<<aCache->GetLimitedMemory()<<") # (Mb)"<<endl;
+
+ SALOMEDS::ChildIterator_var aChildIter = theStudy->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<ColoredPrs3dHolder_i*>(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<<aPrefix<<"anInput = VISU.ColoredPrs3dHolder.BasicInput("<<
+ aResultName<<", '"<<
+ anInput->myMeshName<<"', "<<
+ anEntity<<", '"<<
+ anInput->myFieldName<<"', "<<
+ anInput->myTimeStampNumber<<")"<<
+ endl;
+
+ std::string aComment = aDevice->GetComment();
+ theStr<<aPrefix<<"aHolder = aCache.CreateHolder(VISU.T"<<aComment<<", anInput)"<<endl;
+ theStr<<aPrefix<<"if aHolder != None:"<<endl;
+ {
+ std::string aPrefix2 = aPrefix + PREFIX;
+ CORBA::String_var aNameInStudy = aSObject->GetName();
+ theStr<<aPrefix2<<"visu.SetName(aHolder, '"<<aNameInStudy.in()<<"')"<<endl;
+ theStr<<aPrefix2<<"aDevice = aHolder.GetDevice()"<<endl;
+ theStr<<aPrefix2<<"if aDevice != None:"<<endl;
+ {
+ std::string aPrefix3 = aPrefix2 + PREFIX;
+ TColoredPrs3dFactory aPrsFactory;
+ switch(aDevice->GetType()){
+ case VISU::TSCALARMAP:
+ if(ScalarMap_i* aServant = dynamic_cast<ScalarMap_i*>(aDevice)){
+ ScalarMapToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TDEFORMEDSHAPE:
+ if(DeformedShape_i* aServant = dynamic_cast<DeformedShape_i*>(aDevice)){
+ DeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TSTREAMLINES:
+ if(StreamLines_i* aServant = dynamic_cast<StreamLines_i*>(aDevice)){
+ StreamLinesToPython(aSObject, aServant, theStr, theEntry2NameMap, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TSCALARMAPONDEFORMEDSHAPE:
+ if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast<ScalarMapOnDeformedShape_i*>(aDevice)){
+ ScalarMapOnDeformedShapeToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TVECTORS:
+ if(Vectors_i* aServant = dynamic_cast<Vectors_i*>(aDevice)){
+ VectorsToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TISOSURFACES:
+ if(IsoSurfaces_i* aServant = dynamic_cast<IsoSurfaces_i*>(aDevice)){
+ IsoSurfacesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TCUTPLANES:
+ if(CutPlanes_i* aServant = dynamic_cast<CutPlanes_i*>(aDevice)){
+ CutPlanesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TCUTLINES:
+ if(CutLines_i* aServant = dynamic_cast<CutLines_i*>(aDevice)){
+ CutLinesToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TPLOT3D:
+ if(Plot3D_i* aServant = dynamic_cast<Plot3D_i*>(aDevice)){
+ Plot3DToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ case VISU::TGAUSSPOINTS:
+ if(GaussPoints_i* aServant = dynamic_cast<GaussPoints_i*>(aDevice)){
+ ColoredPrs3dToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3);
+ break;
+ }
+ }
+ theStr<<aPrefix3<<"pass"<<endl;
+ }
+ theStr<<aPrefix2<<"pass"<<endl<<endl;
+ }
+ }
+ theStr<<aPrefix<<"pass"<<endl;
+ }
+ }
+ }
+ }
+
+
//---------------------------------------------------------------------------
void
DumpAnimationsToPython(SALOMEDS::Study_ptr theStudy,
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);
- VISU::DumpAnimationsToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aPrefix);
+ VISU::DumpChildrenToPython(aStudy,
+ theIsPublished,
+ theIsValidScript,
+ aComponent.in(),
+ aStr,
+ aName2EntryMap,
+ aEntry2NameMap,
+ "",
+ aPrefix);
+
+ VISU::DumpContainersToPython(aStudy,
+ theIsPublished,
+ theIsValidScript,
+ aComponent.in(),
+ aStr,
+ aName2EntryMap,
+ aEntry2NameMap,
+ "",
+ aPrefix);
+
+ VISU::DumpPrs3dCacheToPython(aStudy,
+ theIsPublished,
+ theIsValidScript,
+ aComponent.in(),
+ aStr,
+ aName2EntryMap,
+ aEntry2NameMap,
+ "",
+ aPrefix);
+
+ VISU::DumpAnimationsToPython(aStudy,
+ theIsPublished,
+ theIsValidScript,
+ aComponent.in(),
+ aStr,
+ aPrefix);
//Output the script that sets up the visul parameters.
if(theIsPublished) {