X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVISU_I%2FVISU_DumpPython.cc;h=f83b35e5c8373783fe96973255ad3a5ddd2f796f;hb=2cca59fdafcd9f873513dd7f120510508a195ead;hp=945739440bdb41f2c12d8f5faf97109e8e997975;hpb=9b6b2c32c11e994275369c176a7b3cb77d6061c8;p=modules%2Fvisu.git diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index 94573944..f83b35e5 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003-2007 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 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. +// 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 +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // VISU OBJECT : interactive object for VISU entities implementation // File : VISU_DumpPython.cc // Author : Alexey PETROV @@ -49,7 +50,7 @@ #include "utilities.h" #include -#include +#include #include #include @@ -63,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); @@ -85,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 @@ -139,11 +140,11 @@ namespace VISU { if(theArgument) return "True"; - + return "False"; } - - + + //--------------------------------------------------------------------------- inline std::string @@ -153,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; + } + 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; + } + if( aMarkerType == MT_POINT_SPRITE ) + aParam2 = "MS_NONE"; + theStr<GetMarkerTexture(); + if( aMarkerTexture >= 0 ) + theStr<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++){ @@ -339,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); - theStr<GetName()<<"\")"<GetTitle(); theStr<GetNbColumns(); theStr<GetNbRows(); - + // push values and their indices into streams - strstream values, rows, columns; + 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 - strstream rowUnits, rowTitles, colTitles; + stringstream rowUnits, rowTitles, colTitles; SALOMEDS::StringSeq_var aRowUnits = theTableAttr->GetRowUnits(); SALOMEDS::StringSeq_var aRowTitles = theTableAttr->GetRowTitles(); comma = ""; @@ -944,12 +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; @@ -958,829 +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())) { - 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; - - theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve"; - 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 ) - theStr << ", " << aServant->GetZRow(); // Z row - - 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<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); - theStr<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) + 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(); + if (!aResult) 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<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); + QString value (aStringAttr->Value()); + if(value.isEmpty()) continue; + + 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 + 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(aChildItet->InitEx(false); aChildItet->More(); aChildItet->Next()){ + SALOMEDS::SObject_var aSObject = aChildItet->Value(); + + std::string anArgumentName = "fieldSO"; + DumpTableAttrToPython(theStudy, + theIsPublished, + theIsValidScript, + aSObject, + theStr, + theName2EntryMap, + theEntry2NameMap, + anArgumentName, + thePrefix); + } + } + + } + 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++) { + int aMarkerId = aMarkerIter->first; + std::string aMarkerTexture = aMarkerIter->second.first; + theStr<GetModuleParameters("Interface Applicative", "Post-Pro", -1); + if(!CORBA::is_nil(ap)) { + std::map::iterator it = aEntry2NameMap.begin(); + for( ;it != aEntry2NameMap.end(); it++ ) { + //1. Encode entry + if ( ((*it).first).length() < 7 ) continue; + std::string tail( (*it).first, 6, ((*it).first).length()-1 ); + std::string newEntry(ComponentDataType()); + newEntry+=("_"+tail); + + CORBA::String_var anEntry = CORBA::string_dup(newEntry.c_str()); + + if( ap->IsSet(anEntry, 6) ) { //6 Means string array, see SALOMEDS_Attributes.idl AttributeParameter interface + std::string idCommand = std::string("visu.getObjectID(") + (*it).second + std::string(")"); + SALOMEDS::StringSeq_var aSeq= ap->GetStrArray(anEntry); + int oldLenght = aSeq->length(); + aSeq->length(oldLenght+2); + aSeq[oldLenght] = CORBA::string_dup("_PT_OBJECT_ID_"); + aSeq[oldLenght + 1] = CORBA::string_dup(idCommand.c_str()); + ap->SetStrArray( anEntry, aSeq ); + } + } + } + } + + //Output the script that sets up the visul parameters. if(theIsPublished) { char* script = aStudy->GetDefaultScript("Post-Pro", aPrefix.c_str()); if(script && strlen(script) > 0) { - aStr << script; - CORBA::string_free(script); + aStr << script; + CORBA::string_free(script); } } - - aStr<