From bc74b715f69346e66aa5da6e1081e91e5262ec37 Mon Sep 17 00:00:00 2001 From: gdd Date: Thu, 8 Sep 2011 14:34:30 +0000 Subject: [PATCH] Untabify --- src/VISU_I/VISU_DumpPython.cc | 3120 ++++++++++++++++----------------- 1 file changed, 1560 insertions(+), 1560 deletions(-) diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index 4fa096cc..161a9cd0 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -64,19 +64,19 @@ namespace VISU { //--------------------------------------------------------------------------- static std::string PREFIX(" "); - + typedef std::map TName2EntryMap; typedef std::map TEntry2NameMap; - - + + //--------------------------------------------------------------------------- inline std::string GenerateName(std::string theName, - SALOMEDS::SObject_ptr theSObject, - TName2EntryMap& theName2EntryMap, - TEntry2NameMap& theEntry2NameMap, - char theSuffix) + SALOMEDS::SObject_ptr theSObject, + TName2EntryMap& theName2EntryMap, + TEntry2NameMap& theEntry2NameMap, + char theSuffix) { if(theName2EntryMap.find(theName) != theName2EntryMap.end()){ theName = GenerateName(theName + theSuffix, theSObject, theName2EntryMap, theEntry2NameMap, theSuffix); @@ -86,11 +86,11 @@ namespace VISU theEntry2NameMap[anID.in()] = theName; //cout<<"GenerateName - "< "<GetName(); - + std::string aName = QString(aString.in()).simplified().toLatin1().data(); - + //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) + TName2EntryMap& theName2EntryMap, + TEntry2NameMap& theEntry2NameMap) { std::string aName = GetName(theSObject); - + return GenerateName(aName, theSObject, theName2EntryMap, theEntry2NameMap, 'X'); } - - + + //--------------------------------------------------------------------------- inline std::string @@ -140,11 +140,11 @@ namespace VISU { if(theArgument) return "True"; - + return "False"; } - - + + //--------------------------------------------------------------------------- inline std::string @@ -154,36 +154,36 @@ namespace VISU aStream<<"SALOMEDS.Color("<GetNumberOfClippingPlanes(); i++) { aPlane = dynamic_cast(thePrs->GetClippingPlane(i)); if (aPlane) { - if (!aPlane->isAuto()) { - aId = aMgr.GetPlaneId(aPlane); - if (aId > -1) { - theStr<isAuto()) { + aId = aMgr.GetPlaneId(aPlane); + if (aId > -1) { + theStr<GetOffset(x,y,z); theStr<GetMarkerType(); if( aMarkerType != VISU::MT_NONE ) { if( aMarkerType != VISU::MT_USER ) { VISU::MarkerScale aMarkerScale = theServant->GetMarkerScale(); std::string aParam1, aParam2; switch( aMarkerType ) { - case MT_POINT: aParam1 = "MT_POINT"; break; - case MT_PLUS: aParam1 = "MT_PLUS"; break; - case MT_STAR: aParam1 = "MT_STAR"; break; - case MT_O: aParam1 = "MT_O"; break; - case MT_X: aParam1 = "MT_X"; break; - case MT_O_POINT: aParam1 = "MT_O_POINT"; break; - case MT_O_PLUS: aParam1 = "MT_O_PLUS"; break; - case MT_O_STAR: aParam1 = "MT_O_STAR"; break; - case MT_O_X: aParam1 = "MT_O_X"; break; - case MT_POINT_SPRITE: aParam1 = "MT_POINT_SPRITE"; break; - default: aParam1 = "MT_NONE"; break; + case MT_POINT: aParam1 = "MT_POINT"; break; + case MT_PLUS: aParam1 = "MT_PLUS"; break; + case MT_STAR: aParam1 = "MT_STAR"; break; + case MT_O: aParam1 = "MT_O"; break; + case MT_X: aParam1 = "MT_X"; break; + case MT_O_POINT: aParam1 = "MT_O_POINT"; break; + case MT_O_PLUS: aParam1 = "MT_O_PLUS"; break; + case MT_O_STAR: aParam1 = "MT_O_STAR"; break; + case MT_O_X: aParam1 = "MT_O_X"; break; + case MT_POINT_SPRITE: aParam1 = "MT_POINT_SPRITE"; break; + default: aParam1 = "MT_NONE"; break; } switch( aMarkerScale ) { - case MS_10: aParam2 = "MS_10"; break; - case MS_15: aParam2 = "MS_15"; break; - case MS_20: aParam2 = "MS_20"; break; - case MS_25: aParam2 = "MS_25"; break; - case MS_30: aParam2 = "MS_30"; break; - case MS_35: aParam2 = "MS_35"; break; - case MS_40: aParam2 = "MS_40"; break; - case MS_45: aParam2 = "MS_45"; break; - case MS_50: aParam2 = "MS_50"; break; - case MS_55: aParam2 = "MS_55"; break; - case MS_60: aParam2 = "MS_60"; break; - case MS_65: aParam2 = "MS_65"; break; - case MS_70: aParam2 = "MS_70"; break; - default: aParam2 = "MS_NONE"; break; + case MS_10: aParam2 = "MS_10"; break; + case MS_15: aParam2 = "MS_15"; break; + case MS_20: aParam2 = "MS_20"; break; + case MS_25: aParam2 = "MS_25"; break; + case MS_30: aParam2 = "MS_30"; break; + case MS_35: aParam2 = "MS_35"; break; + case MS_40: aParam2 = "MS_40"; break; + case MS_45: aParam2 = "MS_45"; break; + case MS_50: aParam2 = "MS_50"; break; + case MS_55: aParam2 = "MS_55"; break; + case MS_60: aParam2 = "MS_60"; break; + case MS_65: aParam2 = "MS_65"; break; + case MS_70: aParam2 = "MS_70"; break; + default: aParam2 = "MS_NONE"; break; } if( aMarkerType == MT_POINT_SPRITE ) aParam2 = "MS_NONE"; @@ -259,39 +259,39 @@ namespace VISU } } } - + //--------------------------------------------------------------------------- struct TColoredPrs3dFactory { virtual std::string operator()(std::ostream& theStr, - std::string thePrefix) + std::string thePrefix) { - + return thePrefix; } }; - - + + struct TCreateFromResult: TColoredPrs3dFactory { VISU::ColoredPrs3d_i* myServant; std::string myConstructorName; std::string myArgumentName; - + SALOMEDS::SObject_var mySObject; std::string myName; - + TCreateFromResult(const SALOMEDS::SObject_ptr theSObject, - VISU::ColoredPrs3d_i* theServant, - const std::string& theName, - const std::string& theConstructorName, - const std::string& theArgumentName): - myServant(theServant), - myConstructorName(theConstructorName), - myArgumentName(theArgumentName), - myName(theName) + VISU::ColoredPrs3d_i* theServant, + const std::string& theName, + const std::string& theConstructorName, + const std::string& theArgumentName): + myServant(theServant), + myConstructorName(theConstructorName), + myArgumentName(theArgumentName), + myName(theName) { mySObject = SALOMEDS::SObject::_duplicate(theSObject); } @@ -299,84 +299,84 @@ namespace VISU virtual std::string operator()(std::ostream& theStr, - std::string thePrefix) + std::string thePrefix) { std::string aParam; switch(myServant->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; + 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<GetCMeshName()<<"'"<< - ", "<GetCFieldName()<<"'"<< - ", "<GetTimeStampNumber()<< - ")"<GetCMeshName()<<"'"<< + ", "<GetCFieldName()<<"'"<< + ", "<GetTimeStampNumber()<< + ")"<Object map theStr<GetName(); theStr<GetPosX()<<", "<GetPosY()<<")"<GetWidth()<<", "<GetHeight()<<")"<GetNbColors()<<")"<GetLabels()<<")"<GetTitle()<<"')"<GetBarOrientation()){ - case ColoredPrs3dBase::HORIZONTAL: - aParam = "VISU.ColoredPrs3d.HORIZONTAL"; - break; - case ColoredPrs3dBase::VERTICAL: - aParam = "VISU.ColoredPrs3d.VERTICAL"; - break; + case ColoredPrs3dBase::HORIZONTAL: + aParam = "VISU.ColoredPrs3d.HORIZONTAL"; + break; + case ColoredPrs3dBase::VERTICAL: + aParam = "VISU.ColoredPrs3d.VERTICAL"; + break; } theStr<GetScalarMode()<<")"<IsRangeFixed()) theStr<GetMin()<<", "<GetMax()<<")"<GetGroupNames(); VISU::ColoredPrs3d_i::TGroupNames::const_iterator anIter = aGroupNames.begin(); for(; anIter != aGroupNames.end(); anIter++){ @@ -386,66 +386,66 @@ namespace VISU return thePrefix; } - - + + //--------------------------------------------------------------------------- std::string GaussPointsToPython(SALOMEDS::SObject_ptr theSObject, - VISU::GaussPoints_i* theServant, - std::ostream& theStr, - const std::string& theName, - TColoredPrs3dFactory& thePrsFactory, - std::string thePrefix) + VISU::GaussPoints_i* theServant, + std::ostream& theStr, + const std::string& theName, + TColoredPrs3dFactory& thePrsFactory, + std::string thePrefix) { thePrefix = ColoredPrs3dToPython(theSObject, theServant, theStr, theName, thePrsFactory, thePrefix); theStr<GetIsActiveLocalScalarBar(); theStr<GetIsDispGlobalScalarBar(); theStr<GetSpacing()<<")"<GetBiColor(); theStr<GetIsDeformed(); theStr<GetScaleFactor()<<")"<GetPrimitiveType()){ - case VISU::GaussPoints::SPRITE : - aParam = "VISU.GaussPoints.SPRITE"; - break; - case VISU::GaussPoints::POINT : - aParam = "VISU.GaussPoints.POINT"; - break; - case VISU::GaussPoints::SPHERE : - aParam = "VISU.GaussPoints.SPHERE"; - break; + case VISU::GaussPoints::SPRITE : + aParam = "VISU.GaussPoints.SPRITE"; + break; + case VISU::GaussPoints::POINT : + aParam = "VISU.GaussPoints.POINT"; + break; + case VISU::GaussPoints::SPHERE : + aParam = "VISU.GaussPoints.SPHERE"; + break; } theStr<GetClamp()<<")"<GetQMainTexture(); QString anAlphaTexture = theServant->GetQAlphaTexture(); theStr<GetAlphaThreshold()<<")"<GetResolution()<<")"<GetFaceLimit()<<")"<GetIsColored(); theStr<GetMinSize()<<")"<GetMaxSize()<<")"<GetColor())<<")"<GetGeomSize()<<")"<GetMagnification()<<")"<GetMagnificationIncrement()<<")"<IsBarVisible()? "True" : "False"; theStr<GetScaling()){ - case LINEAR: - aParam = "VISU.LINEAR"; - break; - case LOGARITHMIC: - aParam = "VISU.LOGARITHMIC"; - break; + case LINEAR: + aParam = "VISU.LINEAR"; + break; + case LOGARITHMIC: + aParam = "VISU.LOGARITHMIC"; + break; } std::string aVisible = theServant->IsBarVisible()? "True" : "False"; theStr<GetGaussMetric()){ - case AVERAGE: - aParam = "VISU.AVERAGE"; - break; - case MINIMUM: - aParam = "VISU.MINIMUM"; - break; - case MAXIMUM: - aParam = "VISU.MAXIMUM"; - break; + case AVERAGE: + aParam = "VISU.AVERAGE"; + break; + case MINIMUM: + aParam = "VISU.MINIMUM"; + break; + case MAXIMUM: + aParam = "VISU.MAXIMUM"; + break; } theStr<GetLinkColor(); theStr<IsRangeFixed()) theStr<GetMin()<<", "<GetMax()<<")"<GetColor())<<")"<GetScale()<<")"<IsColored())<<")"<GetColor())<<")"<IsColored())<<")"<GetColor())<<")"<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; + 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<GetSource(); if(!CORBA::is_nil(aPrs3d)){ if(Prs3d_i* aServant3d = dynamic_cast(GetServant(aPrs3d).in())){ - SALOMEDS::SObject_var aSObject = aServant3d->GetSObject(); - CORBA::String_var anID = aSObject->GetID(); - std::string anArg = theEntry2NameMap[anID.in()]; - theStr<GetSObject(); + CORBA::String_var anID = aSObject->GetID(); + std::string anArg = theEntry2NameMap[anID.in()]; + theStr<GetIntegrationStep()<<", "<< - theServant->GetPropagationTime()<<", "<< - theServant->GetStepLength()<<", "<< - "aPrs3d"<<", "<< - theServant->GetUsedPoints()<<", "<< - aParam<< - ")"<GetIntegrationStep()<<", "<< + theServant->GetPropagationTime()<<", "<< + theServant->GetStepLength()<<", "<< + "aPrs3d"<<", "<< + theServant->GetUsedPoints()<<", "<< + aParam<< + ")"<GetMin()<<", "<GetMax()<<")"<GetScale()<<")"<GetScalarEntity(); 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; + case NODE: + aParam = "VISU.NODE"; + break; + case EDGE: + aParam = "VISU.EDGE"; + break; + case FACE: + aParam = "VISU.FACE"; + break; + case CELL: + aParam = "VISU.CELL"; + break; } CORBA::String_var aFieldName = theServant->GetScalarFieldName(); CORBA::Long aTimeStampNumber = theServant->GetScalarTimeStampNumber(); theStr<GetLineWidth()<<")"<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; + 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<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; + 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<GetNbSurfaces()<<")"<IsLabeled()<<","<GetNbLabels()<<")"<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; + 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<GetRotateX()<<", "<GetRotateY()<<")"<IsDefault(anId)) - theStr<GetPlanePosition(anId)<<")"<GetPlanePosition(anId)<<")"<IsDeformed())<<")"<IsDeformed()){ theStr<< thePrefix << theName << ".SetScale(" << theServant->GetScale()<<")"<GetVectorialFieldEntity(); switch(anEntity){ - case NODE: - aStringEntity = "VISU.NODE"; - break; - case EDGE: - aStringEntity = "VISU.EDGE"; - break; - case FACE: - aStringEntity = "VISU.FACE"; - break; - case CELL: - aStringEntity = "VISU.CELL"; - break; + case NODE: + aStringEntity = "VISU.NODE"; + break; + case EDGE: + aStringEntity = "VISU.EDGE"; + break; + case FACE: + aStringEntity = "VISU.FACE"; + break; + case CELL: + aStringEntity = "VISU.CELL"; + break; } theStr<< thePrefix << theName << ".SetVectorialField("<GetVectorialFieldName() <<"')"<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; + 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<GetRotateX()<<", "<GetRotateY()<<")"<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; + 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<GetRotateX2()<<", "<GetRotateY2()<<")"<IsDefaultPosition(anId)) - theStr<GetLinePosition(anId)<<")"<GetLinePosition(anId)<<")"<GetPoint1(x1, y1, z1); theServant->GetPoint2(x2, y2, z2); theStr<IsUseAbsoluteLength(); theStr<GetOrientationType()){ - case CutPlanes::XY: - aParam = "VISU.Plot3D.XY"; - break; - case CutPlanes::YZ: - aParam = "VISU.Plot3D.YZ"; - break; - case CutPlanes::ZX: - aParam = "VISU.Plot3D.ZX"; - break; + case CutPlanes::XY: + aParam = "VISU.Plot3D.XY"; + break; + case CutPlanes::YZ: + aParam = "VISU.Plot3D.YZ"; + break; + case CutPlanes::ZX: + aParam = "VISU.Plot3D.ZX"; + break; } theStr<GetRotateX()<<", "<GetRotateY()<<")"<GetPlanePosition()<<", "<IsPositionRelative()<<")"<GetScaleFactor()<<")"<GetIsContourPrs()<<")"<GetNbOfContours()<<")"< 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) + 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,"AttributeString")){ SALOMEDS::AttributeString_var aComment = - SALOMEDS::AttributeString::_narrow(anAttr); + SALOMEDS::AttributeString::_narrow(anAttr); CORBA::String_var aValue = aComment->Value(); Storable::TRestoringMap aMap; Storable::StringToMap(aValue.in(),aMap); bool anIsExist; QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist); if(anIsExist){ - if(strcmp(aMethodName.toLatin1().data(),"ImportTables") == 0){ - return; - } + if(strcmp(aMethodName.toLatin1().data(),"ImportTables") == 0){ + return; + } } } - + std::string aSObjectName = GetName(theSObject); if(theArgumentName.empty()) theArgumentName = "aSComponent"; theStr<GetName()<<"\")"<GetTitle(); theStr<GetNbColumns(); theStr<GetNbRows(); - + // push values and their indices into streams stringstream 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); + 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 @@ -993,14 +993,14 @@ namespace VISU 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; @@ -1009,868 +1009,868 @@ namespace VISU 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; - + << aName << ", " + << aName << "_values, " + << aName << "_rows, " + << aName << "_columns, " + << aName << "_rTitles, " + << aName << "_rUnits, " + << aName << "_cTitles )" << endl; + if(theSObject->FindAttribute(anAttr,"AttributeIOR")){ theStr<GetName(); theStr<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); + 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) + 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); - + SALOMEDS::AttributeTableOfInteger::_narrow(anAttr); + TableAttrToPython(theStudy, - theIsPublished, - theIsValidScript, - theSObject, - aTableAttr, - "AttributeTableOfInteger", - theStr, - theName2EntryMap, - theEntry2NameMap, - theArgumentName, - thePrefix); - + theIsPublished, + theIsValidScript, + theSObject, + aTableAttr, + "AttributeTableOfInteger", + theStr, + theName2EntryMap, + theEntry2NameMap, + theArgumentName, + thePrefix); + }else if(theSObject->FindAttribute(anAttr,"AttributeTableOfReal")){ SALOMEDS::AttributeTableOfReal_var aTableAttr = - SALOMEDS::AttributeTableOfReal::_narrow(anAttr); - + SALOMEDS::AttributeTableOfReal::_narrow(anAttr); + TableAttrToPython(theStudy, - theIsPublished, - theIsValidScript, - theSObject, - aTableAttr, - "AttributeTableOfReal", - theStr, - theName2EntryMap, - theEntry2NameMap, - theArgumentName, - thePrefix); + 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) + 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::String_var anID = theSObject->GetID(); CORBA::String_var aNameInStudy = theSObject->GetName(); - + 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); - + 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())){ - 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<IsGroupsDone())<<")"<< - endl; - - theStr<IsFieldsDone())<<", "<< - GetBoolean(aServant->IsMinMaxDone())<<")"<< - endl; - - theStr<GetMeshNames(); - if (aMeshNames->length() > 0) { - for(size_t aMeshId = 0; aMeshId < aMeshNames->length(); aMeshId++){ - CORBA::String_var aMeshName = aMeshNames[aMeshId]; - VISU::Result::EntityNames_var aParts = aServant->GetPartNames(aMeshName); - if (aParts->length() > 0) { - for(size_t aPartId = 0; aPartId < aParts->length(); aPartId++){ - CORBA::String_var aPart = aParts[aPartId]; - VISU::Result::Resolution aResolution = aServant->GetResolution(aMeshName, aPart); - std::string aParam; - switch(aResolution){ - case VISU::Result::FULL: - aParam = "VISU.Result.FULL"; - break; - case VISU::Result::MEDIUM: - aParam = "VISU.Result.MEDIUM"; - break; - case VISU::Result::LOW: - aParam = "VISU.Result.LOW"; - break; - case VISU::Result::HIDDEN: - aParam = "VISU.Result.HIDDEN"; - break; - } - theStr<FindSubObject(1,aRefSObj)){ - SALOMEDS::SObject_var aTargetRefSObj; - if(aRefSObj->ReferencedObject(aTargetRefSObj)){ - CORBA::String_var aString = aTargetRefSObj->GetName(); - theStr<(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<GetCMeshName()<<"'"<< - ", "<GetCMeshName()<<"'"<< - ", "<GetCMeshName()<<"'"<< - ", '"<Object map - theStr<GetCellColor(); - theStr<GetNodeColor(); - theStr<GetLinkColor(); - theStr<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<IsShrank()? "True" : "False")<<")"<GetQuadratic2DPresentationType()){ - case LINES: - aQuad2DPresent = "VISU.LINES"; - break; - case ARCS: - aQuad2DPresent = "VISU.ARCS"; - break; - } - - theStr<(GetServant(anObj).in())){ - TCreateFromResult aPrsFactory(theSObject, aServant, aName, "ScalarMapOnField", theArgumentName); - thePrefix = ScalarMapToPython(theSObject, aServant, theStr,aName, aPrsFactory, thePrefix); - theStr<(GetServant(anObj).in())){ - TCreateFromResult aPrsFactory(theSObject, aServant, aName, "DeformedShapeOnField", theArgumentName); - thePrefix = DeformedShapeToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); - theStr<(GetServant(anObj).in())){ - TCreateFromResult aPrsFactory(theSObject, aServant, aName, "StreamLinesOnField", theArgumentName); - thePrefix = StreamLinesToPython(theSObject, aServant, theStr, theEntry2NameMap, aName, aPrsFactory, thePrefix); - theStr<(GetServant(anObj).in())){ - TCreateFromResult aPrsFactory(theSObject, aServant, aName, "DeformedShapeAndScalarMapOnField", theArgumentName); - thePrefix = DeformedShapeAndScalarMapToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); - theStr<(GetServant(anObj).in())){ - TCreateFromResult aPrsFactory(theSObject, aServant, aName, "VectorsOnField", theArgumentName); - thePrefix = VectorsToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); - theStr<(GetServant(anObj).in())){ - TCreateFromResult aPrsFactory(theSObject, aServant, aName, "IsoSurfacesOnField", theArgumentName); - thePrefix = IsoSurfacesToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); - theStr<(GetServant(anObj).in())){ - TCreateFromResult aPrsFactory(theSObject, aServant, aName, "CutPlanesOnField", theArgumentName); - thePrefix = CutPlanesToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); - theStr<(GetServant(anObj).in())){ - TCreateFromResult aPrsFactory(theSObject, aServant, aName, "CutLinesOnField", theArgumentName); - thePrefix = CutLinesToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); - - theArgumentName = aName; - DumpChildrenToPython(theStudy, - theIsPublished, - theIsValidScript, - theSObject, - theStr, - theName2EntryMap, - theEntry2NameMap, - theArgumentName, - thePrefix); - - theStr<(GetServant(anObj).in())){ - TCreateFromResult aPrsFactory(theSObject, aServant, aName, "CutSegmentOnField", theArgumentName); - thePrefix = CutSegmentToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); - - theArgumentName = aName; - DumpChildrenToPython(theStudy, - theIsPublished, - theIsValidScript, - theSObject, - theStr, - theName2EntryMap, - theEntry2NameMap, - theArgumentName, - thePrefix); - - theStr<(GetServant(anObj).in())) { - TCreateFromResult aPrsFactory(theSObject, aServant, aName, "Plot3DOnField", theArgumentName); - thePrefix = Plot3DToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); - theStr<(GetServant(anObj).in())) { - - SALOMEDS::GenericAttribute_var anAttr; - if(theSObject->FindAttribute(anAttr,"AttributeString")){ - using namespace SALOMEDS; - AttributeString_var aComment = AttributeString::_narrow(anAttr); - CORBA::String_var aValue = aComment->Value(); - Storable::TRestoringMap aMap; - Storable::StringToMap(aValue.in(),aMap); - bool anIsExist; - QString aSourceId = VISU::Storable::FindValue(aMap,"mySourceId",&anIsExist); - if(anIsExist) { - if( aSourceId == "TableAttr" ) { - DumpTableAttrToPython(theStudy, - theIsPublished, - theIsValidScript, - theSObject, - theStr, - theName2EntryMap, - theEntry2NameMap, - theArgumentName, - thePrefix); - } - } - } - - CORBA::Short aTag = theSObject->Tag(); - theStr<GetScaleFactor()<<")"<GetIsContourPrs()<<")"<GetNbOfContours()<<")"<GetScaling()){ - case LINEAR: - aParam = "VISU.LINEAR"; - break; - case LOGARITHMIC: - aParam = "VISU.LOGARITHMIC"; - break; - } - theStr<GetNbColors()<<")"<GetLabels()<<")"<GetBarOrientation()){ - case ColoredPrs3dBase::HORIZONTAL: - aParam = "VISU.ColoredPrs3d.HORIZONTAL"; - break; - case ColoredPrs3dBase::VERTICAL: - aParam = "VISU.ColoredPrs3d.VERTICAL"; - break; - } - theStr<IsRangeFixed()) - theStr<GetMin()<<", "<GetMax()<<")"<GetPosX()<<", "<GetPosY()<<")"<GetWidth()<<", "<GetHeight()<<")"<GetOffset(dx, dy, dz); - theStr<(GetServant(anObj).in())){ - TCreateFromResult aPrsFactory(theSObject, aServant, aName, "GaussPointsOnField", theArgumentName); - thePrefix = GaussPointsToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); - theStr<(GetServant(anObj).in())) - { - bool withZ = aServant->GetZRow()>0; - bool isV2 = aServant->GetIsV2(); - - theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve"; - if( isV2 ) - theStr << "WithZExt"; - else if( withZ ) - theStr << "WithZ"; - theStr << "(" << + case VISU::TRESULT: + if(Result_i* aServant = dynamic_cast(GetServant(anObj).in())){ + 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<IsGroupsDone())<<")"<< + endl; + + theStr<IsFieldsDone())<<", "<< + GetBoolean(aServant->IsMinMaxDone())<<")"<< + endl; + + theStr<GetMeshNames(); + if (aMeshNames->length() > 0) { + for(size_t aMeshId = 0; aMeshId < aMeshNames->length(); aMeshId++){ + CORBA::String_var aMeshName = aMeshNames[aMeshId]; + VISU::Result::EntityNames_var aParts = aServant->GetPartNames(aMeshName); + if (aParts->length() > 0) { + for(size_t aPartId = 0; aPartId < aParts->length(); aPartId++){ + CORBA::String_var aPart = aParts[aPartId]; + VISU::Result::Resolution aResolution = aServant->GetResolution(aMeshName, aPart); + std::string aParam; + switch(aResolution){ + case VISU::Result::FULL: + aParam = "VISU.Result.FULL"; + break; + case VISU::Result::MEDIUM: + aParam = "VISU.Result.MEDIUM"; + break; + case VISU::Result::LOW: + aParam = "VISU.Result.LOW"; + break; + case VISU::Result::HIDDEN: + aParam = "VISU.Result.HIDDEN"; + break; + } + theStr<FindSubObject(1,aRefSObj)){ + SALOMEDS::SObject_var aTargetRefSObj; + if(aRefSObj->ReferencedObject(aTargetRefSObj)){ + CORBA::String_var aString = aTargetRefSObj->GetName(); + theStr<(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<GetCMeshName()<<"'"<< + ", "<GetCMeshName()<<"'"<< + ", "<GetCMeshName()<<"'"<< + ", '"<Object map + theStr<GetCellColor(); + theStr<GetNodeColor(); + theStr<GetLinkColor(); + theStr<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<IsShrank()? "True" : "False")<<")"<GetQuadratic2DPresentationType()){ + case LINES: + aQuad2DPresent = "VISU.LINES"; + break; + case ARCS: + aQuad2DPresent = "VISU.ARCS"; + break; + } + + theStr<(GetServant(anObj).in())){ + TCreateFromResult aPrsFactory(theSObject, aServant, aName, "ScalarMapOnField", theArgumentName); + thePrefix = ScalarMapToPython(theSObject, aServant, theStr,aName, aPrsFactory, thePrefix); + theStr<(GetServant(anObj).in())){ + TCreateFromResult aPrsFactory(theSObject, aServant, aName, "DeformedShapeOnField", theArgumentName); + thePrefix = DeformedShapeToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); + theStr<(GetServant(anObj).in())){ + TCreateFromResult aPrsFactory(theSObject, aServant, aName, "StreamLinesOnField", theArgumentName); + thePrefix = StreamLinesToPython(theSObject, aServant, theStr, theEntry2NameMap, aName, aPrsFactory, thePrefix); + theStr<(GetServant(anObj).in())){ + TCreateFromResult aPrsFactory(theSObject, aServant, aName, "DeformedShapeAndScalarMapOnField", theArgumentName); + thePrefix = DeformedShapeAndScalarMapToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); + theStr<(GetServant(anObj).in())){ + TCreateFromResult aPrsFactory(theSObject, aServant, aName, "VectorsOnField", theArgumentName); + thePrefix = VectorsToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); + theStr<(GetServant(anObj).in())){ + TCreateFromResult aPrsFactory(theSObject, aServant, aName, "IsoSurfacesOnField", theArgumentName); + thePrefix = IsoSurfacesToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); + theStr<(GetServant(anObj).in())){ + TCreateFromResult aPrsFactory(theSObject, aServant, aName, "CutPlanesOnField", theArgumentName); + thePrefix = CutPlanesToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); + theStr<(GetServant(anObj).in())){ + TCreateFromResult aPrsFactory(theSObject, aServant, aName, "CutLinesOnField", theArgumentName); + thePrefix = CutLinesToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); + + theArgumentName = aName; + DumpChildrenToPython(theStudy, + theIsPublished, + theIsValidScript, + theSObject, + theStr, + theName2EntryMap, + theEntry2NameMap, + theArgumentName, + thePrefix); + + theStr<(GetServant(anObj).in())){ + TCreateFromResult aPrsFactory(theSObject, aServant, aName, "CutSegmentOnField", theArgumentName); + thePrefix = CutSegmentToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); + + theArgumentName = aName; + DumpChildrenToPython(theStudy, + theIsPublished, + theIsValidScript, + theSObject, + theStr, + theName2EntryMap, + theEntry2NameMap, + theArgumentName, + thePrefix); + + theStr<(GetServant(anObj).in())) { + TCreateFromResult aPrsFactory(theSObject, aServant, aName, "Plot3DOnField", theArgumentName); + thePrefix = Plot3DToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); + theStr<(GetServant(anObj).in())) { + + SALOMEDS::GenericAttribute_var anAttr; + if(theSObject->FindAttribute(anAttr,"AttributeString")){ + using namespace SALOMEDS; + AttributeString_var aComment = AttributeString::_narrow(anAttr); + CORBA::String_var aValue = aComment->Value(); + Storable::TRestoringMap aMap; + Storable::StringToMap(aValue.in(),aMap); + bool anIsExist; + QString aSourceId = VISU::Storable::FindValue(aMap,"mySourceId",&anIsExist); + if(anIsExist) { + if( aSourceId == "TableAttr" ) { + DumpTableAttrToPython(theStudy, + theIsPublished, + theIsValidScript, + theSObject, + theStr, + theName2EntryMap, + theEntry2NameMap, + theArgumentName, + thePrefix); + } + } + } + + CORBA::Short aTag = theSObject->Tag(); + theStr<GetScaleFactor()<<")"<GetIsContourPrs()<<")"<GetNbOfContours()<<")"<GetScaling()){ + case LINEAR: + aParam = "VISU.LINEAR"; + break; + case LOGARITHMIC: + aParam = "VISU.LOGARITHMIC"; + break; + } + theStr<GetNbColors()<<")"<GetLabels()<<")"<GetBarOrientation()){ + case ColoredPrs3dBase::HORIZONTAL: + aParam = "VISU.ColoredPrs3d.HORIZONTAL"; + break; + case ColoredPrs3dBase::VERTICAL: + aParam = "VISU.ColoredPrs3d.VERTICAL"; + break; + } + theStr<IsRangeFixed()) + theStr<GetMin()<<", "<GetMax()<<")"<GetPosX()<<", "<GetPosY()<<")"<GetWidth()<<", "<GetHeight()<<")"<GetOffset(dx, dy, dz); + theStr<(GetServant(anObj).in())){ + TCreateFromResult aPrsFactory(theSObject, aServant, aName, "GaussPointsOnField", theArgumentName); + thePrefix = GaussPointsToPython(theSObject, aServant, theStr, aName, aPrsFactory, thePrefix); + theStr<(GetServant(anObj).in())) + { + bool withZ = aServant->GetZRow()>0; + bool isV2 = aServant->GetIsV2(); + + theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve"; + if( isV2 ) + theStr << "WithZExt"; + else if( withZ ) + theStr << "WithZ"; + theStr << "(" << theArgumentName<< // table - ", "<GetHRow()<< // H row - ", "<GetVRow(); // V row - if( withZ || isV2 ) - theStr << ", " << aServant->GetZRow(); // Z row - if( isV2 ) - theStr << ", " << aServant->GetIsV2(); // right axis - - theStr << ", '"<GetTitle()<<"'"; // title - SALOMEDS::Color aColor = aServant->GetColor(); - theStr << ",SALOMEDS.Color("<< - aColor.R<<", "<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<<", "<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<<", "<GetLineWidth()<<")"<(GetServant(anObj).in())){ - SALOMEDS::GenericAttribute_var anAttr; - if(theSObject->FindAttribute(anAttr,"AttributeString")){ - using namespace SALOMEDS; - AttributeString_var aComment = AttributeString::_narrow(anAttr); - CORBA::String_var aValue = aComment->Value(); - Storable::TRestoringMap aMap; - Storable::StringToMap(aValue.in(),aMap); - bool anIsExist; - QString aSourceId = VISU::Storable::FindValue(aMap,"mySourceId",&anIsExist); - if(anIsExist){ - if( aSourceId == "CutLines" ){ - theStr<Tag(); - theStr<GetHRow()<< // H row + ", "<GetVRow(); // V row + if( withZ || isV2 ) + theStr << ", " << aServant->GetZRow(); // Z row + if( isV2 ) + theStr << ", " << aServant->GetIsV2(); // right axis + + theStr << ", '"<GetTitle()<<"'"; // title + SALOMEDS::Color aColor = aServant->GetColor(); + theStr << ",SALOMEDS.Color("<< + aColor.R<<", "<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<<", "<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<<", "<GetLineWidth()<<")"<(GetServant(anObj).in())){ + SALOMEDS::GenericAttribute_var anAttr; + if(theSObject->FindAttribute(anAttr,"AttributeString")){ + using namespace SALOMEDS; + AttributeString_var aComment = AttributeString::_narrow(anAttr); + CORBA::String_var aValue = aComment->Value(); + Storable::TRestoringMap aMap; + Storable::StringToMap(aValue.in(),aMap); + bool anIsExist; + QString aSourceId = VISU::Storable::FindValue(aMap,"mySourceId",&anIsExist); + if(anIsExist){ + if( aSourceId == "CutLines" ){ + theStr<Tag(); + theStr<FindAttribute(anAttr,"AttributeString")) { - SALOMEDS::AttributeString_var aComment = - SALOMEDS::AttributeString::_narrow(anAttr); - CORBA::String_var aValue = aComment->Value(); - Storable::TRestoringMap aMap; - Storable::StringToMap(aValue.in(),aMap); - bool anIsExist; - QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist); - if (anIsExist) { - if (aTypeName == "ImportTables") { - QString aFileName = VISU::Storable::FindValue(aMap,"myFileName",&anIsExist); - if(anIsExist){ - std::string aName = - GenerateName(theSObject,theName2EntryMap,theEntry2NameMap); + SALOMEDS::AttributeString_var aComment = + SALOMEDS::AttributeString::_narrow(anAttr); + CORBA::String_var aValue = aComment->Value(); + Storable::TRestoringMap aMap; + Storable::StringToMap(aValue.in(),aMap); + bool anIsExist; + QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist); + if (anIsExist) { + if (aTypeName == "ImportTables") { + QString aFileName = VISU::Storable::FindValue(aMap,"myFileName",&anIsExist); + if(anIsExist){ + std::string aName = + GenerateName(theSObject,theName2EntryMap,theEntry2NameMap); QString aFirstStrAsTitle = - VISU::Storable::FindValue(aMap,"myFirstStrAsTitle",&anIsExist).trimmed().toLower(); - if ( aFirstStrAsTitle == "1" || aFirstStrAsTitle == "true" ) - aFirstStrAsTitle = "True"; - else - aFirstStrAsTitle = "False"; - theStr<ReferencedObject(aTargetRefSObj)){ CORBA::Object_var anObj = SObjectToObject(aTargetRefSObj); if(CORBA::is_nil(anObj)) - return; - + return; + VISU::Base_var aBase = VISU::Base::_narrow(anObj); if(CORBA::is_nil(aBase)) - return; - + return; + if(aBase->GetType() == VISU::TCURVE){ - CORBA::String_var anID = aTargetRefSObj->GetID(); - std::string anArg = theEntry2NameMap[anID.in()]; - theStr<GetID(); + std::string anArg = theEntry2NameMap[anID.in()]; + theStr<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; - + continue; + VISU::Base_var aBase = VISU::Base::_narrow(anObj); if(CORBA::is_nil(aBase)) - continue; - + continue; + if(aBase->GetType() == VISU::TCONTAINER){ - theStr<GetName(); - theStr<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<GetName(); + theStr<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<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; - + continue; + VISU::Base_var aBase = VISU::Base::_narrow(anObj); if(CORBA::is_nil(aBase)) - continue; - + 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: - case VISU::TDEFORMEDSHAPEANDSCALARMAP: - if(DeformedShapeAndScalarMap_i* aServant = dynamic_cast(aDevice)){ - DeformedShapeAndScalarMapToPython(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::TCUTSEGMENT: - if(CutSegment_i* aServant = dynamic_cast(aDevice)){ - CutSegmentToPython(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)){ - GaussPointsToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3); - break; - } - } - theStr<(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: + case VISU::TDEFORMEDSHAPEANDSCALARMAP: + if(DeformedShapeAndScalarMap_i* aServant = dynamic_cast(aDevice)){ + DeformedShapeAndScalarMapToPython(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::TCUTSEGMENT: + if(CutSegment_i* aServant = dynamic_cast(aDevice)){ + CutSegmentToPython(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)){ + GaussPointsToPython(aSObject, aServant, theStr, "aDevice", aPrsFactory, aPrefix3); + break; + } + } + theStr<NewChildIterator(theSObject); for(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){ SALOMEDS::SObject_var aSObject = aChildItet->Value(); - + SALOMEDS::GenericAttribute_var anAttr; if (!aSObject->FindAttribute(anAttr, "AttributeString")) continue; - - SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); + + SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); QString value (aStringAttr->Value()); if(value.isEmpty()) continue; - - VISU::Storable::TRestoringMap aMap; + + VISU::Storable::TRestoringMap aMap; VISU::Storable::StringToMap(value, aMap); bool isExist; QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&isExist); if(!isExist || aTypeName != "EVOLUTION") continue; - - //EVOLUTION + + //EVOLUTION theStr<GetName(); theStr<NewChildIterator(aSObject); for (anIter->Init(); anIter->More(); anIter->Next()) { SALOMEDS::SObject_var anObj = anIter->Value(); - + //FIELD theStr<FindAttribute(anAttr, "AttributeString")) { @@ -2135,7 +2135,7 @@ namespace VISU theStr<Value()<<"')"<< endl; } - + SALOMEDS::SObject_var refObj; if(anObj->ReferencedObject(refObj)) { SALOMEDS::SObject_var father = refObj->GetFather(); @@ -2143,16 +2143,16 @@ namespace VISU QString path(theStudy->GetObjectPath(father)); //The following code requierd as a field name can contain '/' character theStr<GetName(); if(!value.isEmpty()) theStr<NewChildIterator(anObj); for(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){ SALOMEDS::SObject_var aSObject = aChildItet->Value(); - + std::string anArgumentName = "fieldSO"; DumpTableAttrToPython(theStudy, theIsPublished, @@ -2167,7 +2167,7 @@ namespace VISU } } - + theStr<NewChildIterator(theSObject); for(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){ SALOMEDS::SObject_var aSObject = aChildItet->Value(); - + SALOMEDS::GenericAttribute_var anAttr; if (!aSObject->FindAttribute(anAttr, "AttributeString")) continue; - - SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); + + SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); QString value (aStringAttr->Value()); if(value.isEmpty()) continue; - - VISU::Storable::TRestoringMap aMap; + + VISU::Storable::TRestoringMap aMap; VISU::Storable::StringToMap(value, aMap); bool isExist; QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&isExist); if(!isExist || aTypeName != "ANIMATION") continue; - - //ANIMATION + + //ANIMATION theStr<GetName(); theStr<NewChildIterator(aSObject); for (anIter->Init(); anIter->More(); anIter->Next()) { - SALOMEDS::SObject_var anObj = anIter->Value(); - - //FIELD - theStr<FindAttribute(anAttr, "AttributeString")) { - aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); - theStr<Value()<<"')"<< endl; - } - - SALOMEDS::SObject_var refObj; - if(anObj->ReferencedObject(refObj)) { - SALOMEDS::SObject_var father = refObj->GetFather(); - value = refObj->GetName(); - QString path(theStudy->GetObjectPath(father)); - //The following code requierd as a field name can contain '/' character - theStr<GetName(); - if(!value.isEmpty()) theStr<NewChildIterator(anObj); - for (aSubIter->Init(); aSubIter->More(); aSubIter->Next()) { - SALOMEDS::SObject_var aSubObj = aSubIter->Value(); - - theStr<GetName(); - if(!value.isEmpty()) theStr<FindAttribute(anAttr, "AttributeString")) { - aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); - theStr<Value()<<"')"<< endl; - } - } - + SALOMEDS::SObject_var anObj = anIter->Value(); + + //FIELD + theStr<FindAttribute(anAttr, "AttributeString")) { + aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); + theStr<Value()<<"')"<< endl; + } + + SALOMEDS::SObject_var refObj; + if(anObj->ReferencedObject(refObj)) { + SALOMEDS::SObject_var father = refObj->GetFather(); + value = refObj->GetName(); + QString path(theStudy->GetObjectPath(father)); + //The following code requierd as a field name can contain '/' character + theStr<GetName(); + if(!value.isEmpty()) theStr<NewChildIterator(anObj); + for (aSubIter->Init(); aSubIter->More(); aSubIter->Next()) { + SALOMEDS::SObject_var aSubObj = aSubIter->Value(); + + theStr<GetName(); + if(!value.isEmpty()) theStr<FindAttribute(anAttr, "AttributeString")) { + aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); + theStr<Value()<<"')"<< endl; + } + } + } } - + theStr<GetOrigin(aOrigin); aPlane->GetNormal(aDir); - + theStr<isAuto()<<",\""<getName()<<"\")"<isAuto()<<",\""<getName()<<"\")"<StudyId()); if(anIter == theMarkerMap.end()) return; - + theStr<second; VTK::MarkerMap::const_iterator aMarkerIter = aMarkerMap.begin(); for(; aMarkerIter != aMarkerMap.end(); aMarkerIter++) { @@ -2325,25 +2325,25 @@ namespace VISU Engines::TMPFile* VISU_Gen_i:: DumpPython(CORBA::Object_ptr theStudy, - CORBA::Boolean theIsPublished, - CORBA::Boolean theIsMultiFile, - CORBA::Boolean& theIsValidScript) + CORBA::Boolean theIsPublished, + CORBA::Boolean theIsMultiFile, + CORBA::Boolean& theIsValidScript) { theIsValidScript = false; - + 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 = theIsMultiFile ? PREFIX : ""; if( theIsMultiFile ) aStr<<"def RebuildData(theStudy):"<GetDefaultScript("Post-Pro", aPrefix.c_str()); if(script && strlen(script) > 0) { - aStr << script; - CORBA::string_free(script); + aStr << script; + CORBA::string_free(script); } } - + if( theIsMultiFile ) aStr<