]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug11792
authorapo <apo@opencascade.com>
Thu, 30 Mar 2006 12:36:42 +0000 (12:36 +0000)
committerapo <apo@opencascade.com>
Thu, 30 Mar 2006 12:36:42 +0000 (12:36 +0000)
  "Scalar Map on Def. Shape" and "Gauss Points" presentations are not dump in *.py file (MKO also)

src/VISU_I/VISU_DumpPython.cc

index 29db6391ee045ca1bb79f540e323624d6faf4137..5101d1aa0f1ee9cadce8dca31f0cc20f9c7d0233 100644 (file)
@@ -39,6 +39,8 @@
 #include "VISU_StreamLines_i.hh"
 #include "VISU_Plot3D_i.hh"
 #include "VISU_Table_i.hh"
+#include "VISU_GaussPoints_i.hh"
+#include "VISU_ScalarMapOnDeformedShape_i.hh"
 
 #include "utilities.h"
 
@@ -141,13 +143,13 @@ namespace VISU{
 
   //===========================================================================
   std::string
-  ScalarMapToPython(SALOMEDS::SObject_ptr theSObject,
-                   VISU::ScalarMap_i* theServant,
-                   std::ostream& theStr,
-                   std::string& theName,
-                   const std::string& theConstructorName,
-                   const std::string& theArgumentName,
-                   std::string thePrefix)
+  ColoredPrs3dToPython(SALOMEDS::SObject_ptr theSObject,
+                      VISU::ColoredPrs3d_i* theServant,
+                      std::ostream& theStr,
+                      std::string& theName,
+                      const std::string& theConstructorName,
+                      const std::string& theArgumentName,
+                      std::string thePrefix)
   {
     std::string aParam;
     switch(theServant->GetEntity()){
@@ -185,6 +187,28 @@ namespace VISU{
     // Set parameters
     theStr<<thePrefix<<theName<<".SetScalarMode("<<theServant->GetScalarMode()<<")"<<endl;
 
+    theStr<<thePrefix<<theName<<".SetPosition("<<theServant->GetPosX()<<","<<theServant->GetPosY()<<")"<<endl;
+    theStr<<thePrefix<<theName<<".SetSize("<<theServant->GetWidth()<<","<<theServant->GetHeight()<<")"<<endl;
+    theStr<<thePrefix<<theName<<".SetNbColors("<<theServant->GetNbColors()<<")"<<endl;
+    theStr<<thePrefix<<theName<<".SetLabels("<<theServant->GetLabels()<<")"<<endl;
+    theStr<<thePrefix<<theName<<".SetTitle('"<<theServant->GetTitle()<<"')"<<endl;
+
+    return thePrefix;
+  }
+
+
+  std::string
+  ScalarMapToPython(SALOMEDS::SObject_ptr theSObject,
+                   VISU::ScalarMap_i* theServant,
+                   std::ostream& theStr,
+                   std::string& theName,
+                   const std::string& theConstructorName,
+                   const std::string& theArgumentName,
+                   std::string thePrefix)
+  {
+    thePrefix = ColoredPrs3dToPython(theSObject,theServant,theStr,theName,theConstructorName,theArgumentName,thePrefix);
+
+    std::string aParam;
     switch(theServant->GetScaling()){
     case LINEAR:
       aParam = "VISU.LINEAR";
@@ -206,12 +230,6 @@ namespace VISU{
     }
     theStr<<thePrefix<<theName<<".SetBarOrientation("<<aParam<<")"<<endl;
 
-    theStr<<thePrefix<<theName<<".SetPosition("<<theServant->GetPosX()<<","<<theServant->GetPosY()<<")"<<endl;
-    theStr<<thePrefix<<theName<<".SetSize("<<theServant->GetWidth()<<","<<theServant->GetHeight()<<")"<<endl;
-    theStr<<thePrefix<<theName<<".SetNbColors("<<theServant->GetNbColors()<<")"<<endl;
-    theStr<<thePrefix<<theName<<".SetLabels("<<theServant->GetLabels()<<")"<<endl;
-    theStr<<thePrefix<<theName<<".SetTitle('"<<theServant->GetTitle()<<"')"<<endl;
-
     return thePrefix;
   }
 
@@ -717,6 +735,40 @@ namespace VISU{
            theStr<<thePrefix<<"pass"<<endl<<endl;
           }
           return;
+        case VISU::TSCALARMAPONDEFORMEDSHAPE:
+          if(ScalarMapOnDeformedShape_i* aServant = dynamic_cast<ScalarMapOnDeformedShape_i*>(GetServant(anObj).in())){
+           thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"ScalarMapOnDeformedShapeOnField",theArgumentName,thePrefix);
+
+           theStr<<thePrefix<<aName<<".SetSourceRange("<<aServant->GetSourceRangeMin()<<","<<aServant->GetSourceRangeMax()<<")"<<endl;
+           theStr<<thePrefix<<aName<<".SetScale("<<aServant->GetScale()<<")"<<endl;
+
+           std::string aParam;
+           VISU::Entity anEntity = aServant->GetScalarEEntity();
+           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;
+           }
+
+           theStr<<thePrefix<<aName<<".SetScalarField("<<
+             "'"<<aServant->GetScalarMeshName()<<"',"<<
+             "'"<<aServant->GetScalarFieldName()<<"',"<<
+             aServant->GetScalarIteration()<<","<<
+             aParam<<
+             ")"<<endl;
+
+           theStr<<thePrefix<<"pass"<<endl<<endl;
+          }
+          return;
         case VISU::TVECTORS:
           if(Vectors_i* aServant = dynamic_cast<Vectors_i*>(GetServant(anObj).in())){
            thePrefix = DeformedShapeToPython(theSObject,aServant,theStr,aName,"VectorsOnField",theArgumentName,thePrefix);
@@ -855,8 +907,7 @@ namespace VISU{
           return;
         case VISU::TPLOT3D:
           if (Plot3D_i* aServant = dynamic_cast<Plot3D_i*>(GetServant(anObj).in())) {
-            thePrefix = ScalarMapToPython(theSObject, aServant, theStr, aName,
-                                         "Plot3DOnField", theArgumentName, thePrefix);
+            thePrefix = ScalarMapToPython(theSObject, aServant, theStr, aName,"Plot3DOnField", theArgumentName, thePrefix);
 
            std::string aParam;
            switch(aServant->GetOrientationType()){
@@ -873,6 +924,12 @@ namespace VISU{
             theStr<<thePrefix<<"pass"<<endl<<endl;
           }
           return;
+        case VISU::TGAUSSPOINTS:
+          if(GaussPoints_i* aServant = dynamic_cast<GaussPoints_i*>(GetServant(anObj).in())){
+           thePrefix = ColoredPrs3dToPython(theSObject,aServant,theStr,aName,"GaussPointsOnField",theArgumentName,thePrefix);
+           theStr<<thePrefix<<"pass"<<endl<<endl;
+          }
+          return;
         case VISU::TCURVE:
           if(Curve_i* aServant = dynamic_cast<Curve_i*>(GetServant(anObj).in()))
           {
@@ -912,7 +969,7 @@ namespace VISU{
           }
          return;
         case VISU::TTABLE:
-          if(Table_i* aServant = dynamic_cast<Table_i*>(GetServant(anObj).in())){
+          if(dynamic_cast<Table_i*>(GetServant(anObj).in())){
            SALOMEDS::GenericAttribute_var anAttr;
            if(theSObject->FindAttribute(anAttr,"AttributeComment")){
              using namespace SALOMEDS;