]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL16080
authorapo <apo@opencascade.com>
Fri, 1 Jun 2007 13:03:22 +0000 (13:03 +0000)
committerapo <apo@opencascade.com>
Fri, 1 Jun 2007 13:03:22 +0000 (13:03 +0000)
 - IOLS. Impossible to display and edit presentations created in 3x

src/VISUGUI/VisuGUI_InputPane.cxx
src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h
src/VISUGUI/VisuGUI_Slider.cxx
src/VISU_I/VISU_ColoredPrs3dHolder_i.cc
src/VISU_I/VISU_ColoredPrs3dHolder_i.hh
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.hh
src/VISU_I/VISU_DumpPython.cc

index 1ee34f36e8466fb2303c953bbb1acdec1d3989e0..776d8d59ed61e178c2f9ce4f969f41251f677aa0 100644 (file)
@@ -447,12 +447,12 @@ void VisuGUI_InputPane::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs )
   clear();
 
   CORBA::Long aTimeStampNumber = thePrs->GetTimeStampNumber();
-  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = thePrs->GetTimeStampsRange();
+  VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = thePrs->GetTimeStampsRange();
   CORBA::Long aLength = aTimeStampsRange->length();
 
   for( int index = 0; index < aLength; index++ )
   {
-    VISU::ColoredPrs3d::TimeStampInfo anInfo = aTimeStampsRange[ index ];
+    VISU::ColoredPrs3dHolder::TimeStampInfo anInfo = aTimeStampsRange[ index ];
     QString aTime = anInfo.myTime.in();
     myTimeStamps->insertItem( aTime );
   }
index 9d8d0fe77d1b3af7f58c60f7acdb796e9848553c..482f8c5714ec83878c3ced22a910b0ef13a87cca 100644 (file)
@@ -173,18 +173,13 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject(VISU::ColoredPrs3d_i
 
   setFactor(myPrsCopy->GetScale());
   myTimeStampsCombo->setDisabled(myIsAnimation);
-  myCurrMeshName = myPrsCopy->GetCMeshName();
 
   
-  CORBA::String_var aMeshName = myPrsCopy->GetMeshName();
-  CORBA::String_var aFieldName(myPrsCopy->GetScalarCFieldName());
-  float aIterFloat = GetFloatValueOfTimeStamp(aMeshName.in(),
+  CORBA::String_var aFieldName(myPrsCopy->GetScalarFieldName());
+  QString aIteration = GetFloatValueOfTimeStamp(myPrsCopy->GetScalarEntity(),
                                              aFieldName.in(),
-                                             myPrsCopy->GetScalarLIteration(),
-                                             myPrsCopy->GetScalarEEntity());
-  QString aIteration(QString("%1").arg(aIterFloat));
-
-  if (myMeshFieldsTimes.size() == 0)
+                                             myPrsCopy->GetScalarTimeStampNumber());
+  if (myEntity2Fields.size() == 0)
   {
     // find all fields and time stamps on it
     _PTR(Study) aActiveStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI));
@@ -271,7 +266,6 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject(VISU::ColoredPrs3d_i
                CORBA::String_var aName = myPrsCopy->GetMeshName();
                 if (aMeshName != aName.in()) 
                  continue;
-                myCurrMeshName = aMeshName;
                 QString aFieldName = VISU::getValue(aChildSObj, "myFieldName");
                 QString aTimeIter  = VISU::getValue(aChildSObj, "myTimeStampId");
                 QString aEntity    = VISU::getValue(aChildSObj, "myEntityId");
@@ -282,13 +276,12 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject(VISU::ColoredPrs3d_i
                 case 2: anEntity = VISU::FACE; break;
                 case 3: anEntity = VISU::CELL; break;
                 }
-                TFT &aFieldsMap = myMeshFieldsTimes[aMeshName.latin1()];
-                TFE aKey (aFieldName.latin1(), anEntity);
-                aFieldsMap[aKey][aTimeIter.toInt()] = 
-                  GetFloatValueOfTimeStamp(aMeshName.latin1(),
-                                           aFieldName.latin1(),
-                                           aTimeIter.toInt(),
-                                           anEntity);
+                TFieldName2TimeStamps& aFieldName2TimeStamps = myEntity2Fields[anEntity];
+                TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldName2TimeStamps[aFieldName];
+               aTimeStampNumber2Time[aTimeIter.toInt()] = 
+                  GetFloatValueOfTimeStamp(anEntity,
+                                          aFieldName.latin1(),
+                                           aTimeIter.toInt());
               }
             }
           }
@@ -324,11 +317,9 @@ VisuGUI_ScalarMapOnDeformedShapeDlg
   
   myPrsCopy->SetScale(getFactor());
 
-  CORBA::String_var aMeshName = myPrsCopy->GetMeshName();
-  myPrsCopy->SetScalarField(aMeshName.in(),
+  myPrsCopy->SetScalarField(myPrsCopy->GetScalarEntity(),
                            getCurrentScalarFieldName().latin1(),
-                           myTimeStampID[ myTimeStampsCombo->currentItem() ],
-                           myPrsCopy->GetScalarEEntity());
+                           myTimeStampID[ myTimeStampsCombo->currentItem() ]);
 
   if(myUpdateScalars) 
     SetScalarField( false );
@@ -354,12 +345,17 @@ VISU::Entity
 VisuGUI_ScalarMapOnDeformedShapeDlg
 ::getCurrentScalarEntity()
 {
-  VISU::Entity anEntity;
-  TFT::const_iterator aIterField = myMeshFieldsTimes[myCurrMeshName].begin();
-  for(;aIterField != myMeshFieldsTimes[myCurrMeshName].end();aIterField++){
-    if (aIterField->first.first == myFieldsCombo->currentText()){
-      anEntity = aIterField->first.second;
-      break;
+  VISU::Entity anEntity = VISU::Entity(-1);
+  TEntity2Fields::const_iterator anIter = myEntity2Fields.begin();
+  for(; anIter != myEntity2Fields.end(); anIter++){
+    const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second;
+    TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin();
+    for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){
+      const QString& aFieldName = aFieldIter->first;
+      if (aFieldName == myFieldsCombo->currentText()) {
+       anEntity = anIter->first;
+       break;
+      }
     }
   }
   return anEntity;
@@ -387,10 +383,9 @@ VisuGUI_ScalarMapOnDeformedShapeDlg
 
   VISU::Entity anEntity = getCurrentScalarEntity();
   
-  myPrsCopy->SetScalarField(myCurrMeshName.latin1(),
+  myPrsCopy->SetScalarField(anEntity,
                            aFieldName.latin1(),
-                           theIter,
-                           anEntity);
+                           theIter);
   
   if( save_scalar_pane )
     UpdateScalarField();
@@ -431,32 +426,38 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::onHelp()
 }
 
 void VisuGUI_ScalarMapOnDeformedShapeDlg::AddAllFieldNames(){
-  TMF::const_iterator aIterMesh = myMeshFieldsTimes.begin();
-  for(;aIterMesh != myMeshFieldsTimes.end();aIterMesh++){
-    QString aMeshName = aIterMesh->first;
-    TFT::const_iterator aIterField = (aIterMesh->second).begin();
-    for(;aIterField != (aIterMesh->second).end(); aIterField++){
-      QString aFieldName = aIterField->first.first;
+  TEntity2Fields::const_iterator anIter = myEntity2Fields.begin();
+  for(; anIter != myEntity2Fields.end(); anIter++){
+    const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second;
+    TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin();
+    for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){
+      const QString& aFieldName = aFieldIter->first;
       myFieldsCombo->insertItem(aFieldName);
     }
   }
 }
 
 void VisuGUI_ScalarMapOnDeformedShapeDlg::AddAllTimes(const QString& theFieldName){
-  TMF::const_iterator aIterMesh = myMeshFieldsTimes.begin();
-  for(;aIterMesh != myMeshFieldsTimes.end();aIterMesh++){
-    QString aMeshName = aIterMesh->first;
-    TFT::const_iterator aIterField = (aIterMesh->second).begin();
-    for(;aIterField != (aIterMesh->second).end(); aIterField++){
-      QString aFieldName = aIterField->first.first;
-      if(theFieldName != aFieldName) continue;
-      myTimeStampsCombo->clear();
+  TEntity2Fields::const_iterator anIter = myEntity2Fields.begin();
+  for(; anIter != myEntity2Fields.end(); anIter++){
+    const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second;
+    TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin();
+    for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){
+      const QString& aFieldName = aFieldIter->first;
+      if(theFieldName != aFieldName) 
+       continue;
+
       myTimeStampID.clear();
-      myTimeStampID.reserve( (aIterField->second).size() );
-      TTL::const_iterator aTimeIter = (aIterField->second).begin();
-      for(;aTimeIter != (aIterField->second).end(); aTimeIter++) {
-       myTimeStampsCombo->insertItem(QString("%1").arg(aTimeIter->second));
-        myTimeStampID.push_back(aTimeIter->first);
+      myTimeStampsCombo->clear();
+
+      const TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldIter->second;
+      TTimeStampNumber2Time::const_iterator aTimeStampIter = aTimeStampNumber2Time.begin();
+      for(; aTimeStampIter != aTimeStampNumber2Time.end(); aTimeStampIter++){
+       int aTimeStampNumber = aTimeStampIter->first;
+       myTimeStampID.push_back(aTimeStampNumber);
+
+       QString aTimeStampTime = aTimeStampIter->second;
+       myTimeStampsCombo->insertItem(aTimeStampTime);
       }
       return;
     }
@@ -478,38 +479,29 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::UpdateScalarField(){
   myScalarPane->initFromPrsObject(myPrsCopy);
 }
 
-float 
+QString 
 VisuGUI_ScalarMapOnDeformedShapeDlg
-::GetFloatValueOfTimeStamp(const char* theMeshName,
-                          const char* theFieldName,
-                          const int   theIter,
-                          const VISU::Entity  theEntity)
+::GetFloatValueOfTimeStamp(VISU::Entity theEntity,
+                          const std::string& theFieldName,
+                          int theTimeStampNumber)
 {
-  float ret=1;
+  QString aTime("");
   VISU::TEntity anEntity = VISU::TEntity(theEntity);
   VISU::Result_i* theResult = myPrsCopy->GetCResult();
   VISU::Result_i::TInput* anInput = theResult->GetInput();
-  VISU::PField aField = anInput->GetField(theMeshName,
+  VISU::PField aField = anInput->GetField(myPrsCopy->GetCMeshName(),
                                          anEntity,
                                          theFieldName);
   if(!aField) 
-    return ret;
+    return aTime;
+
   VISU::TValField& aValField = aField->myValField;
-  VISU::TValField::const_iterator aIter = aValField.find(theIter);
+  VISU::TValField::const_iterator aIter = aValField.find(theTimeStampNumber);
   if(aIter != aValField.end()){
     VISU::PValForTime aValForTime = aIter->second;
-    ret = float(aValForTime->myTime.first);
-  } else {
-    if(MYDEBUG){
-      cout << "Where are no aValForTime with iteration:"<<theIter<<endl;
-      cout << "\tThe possible interations is aValField.keys():";
-      VISU::TValField::const_iterator aTmp = aValField.begin();
-      for(;aTmp != aValField.end(); aTmp++)
-       cout << aTmp->first << ",";
-      cout << endl;
-    }
+    aTime = VISU_Convertor::GenerateName(aValForTime->myTime).c_str();
   }
-  return ret;
+  return aTime;
 }
 
 void VisuGUI_ScalarMapOnDeformedShapeDlg::keyPressEvent( QKeyEvent* e )
index e6178bcd6cf4acbd3831de02ddbb51b46929133d..3ccd052bfd02560aa48c0df26d559ef67db0488b 100644 (file)
@@ -95,13 +95,11 @@ private:
  QComboBox *myFieldsCombo;
  QComboBox *myTimeStampsCombo;
  
- typedef std::map<int,float> TTL; // Times map definition (iteration time, real value of time)
- typedef std::pair<QString,VISU::Entity> TFE; // pair field name and entity
- typedef std::map<TFE,TTL> TFT; // Field name and enity to Times
- typedef std::map<QString,TFT> TMF; // Mesh to fields map
+ typedef std::map<int, QString> TTimeStampNumber2Time; // Times map definition (iteration time, real value of time)
+ typedef std::map<QString, TTimeStampNumber2Time> TFieldName2TimeStamps; // Field name and enity to Times
+ typedef std::map<VISU::Entity, TFieldName2TimeStamps> TEntity2Fields; // Mesh to fields map
  
- TMF myMeshFieldsTimes;
- QString myCurrMeshName;
+ TEntity2Fields myEntity2Fields;
  int myCurrScalarIter;
  bool myIsAnimation;
  bool myUpdateScalars;
@@ -116,10 +114,9 @@ protected:
  void SetScalarField( const bool = true );
  void AddAllFieldNames();
  void AddAllTimes(const QString& theFieldName);
- float GetFloatValueOfTimeStamp(const char* theMeshName,
-                               const char* theFieldName,
-                               const int   theIteration,
-                               const VISU::Entity  theEntity);
+ QString GetFloatValueOfTimeStamp(VISU::Entity theEntity,
+                                 const std::string& theFieldName,
+                                 int theTimeStampNumber);
 };
 
 #endif // VISUGUI_DEFORMEDSHAPEDLS_H
index fbc6cc0088c1957e7fc41d3a2c34f15cedd9103e..fe6cf3ebd075449d77c22004fc6460242c7d4d5b 100644 (file)
@@ -250,7 +250,7 @@ void VisuGUI_Slider::enableControls( bool on )
 
     VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
 
-    VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = aHolder->GetTimeStampsRange();
+    VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = aHolder->GetTimeStampsRange();
     CORBA::Long aLength = aTimeStampsRange->length();
 
     VISU::ColoredPrs3dHolder::BasicInput_var anInput = aHolder->GetBasicInput();
@@ -267,7 +267,7 @@ void VisuGUI_Slider::enableControls( bool on )
     CORBA::Long a_current_index = 0;
     for( CORBA::Long an_index = 0; an_index < aLength; an_index++ )
     {
-      VISU::ColoredPrs3d::TimeStampInfo anInfo = aTimeStampsRange[ an_index ];
+      VISU::ColoredPrs3dHolder::TimeStampInfo anInfo = aTimeStampsRange[ an_index ];
       CORBA::Long aNumber = anInfo.myNumber;
       QString aTime = anInfo.myTime.in();
 
@@ -413,7 +413,7 @@ void VisuGUI_Slider::onValueChanged( int value )
 
   VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
 
-  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = aHolder->GetTimeStampsRange();
+  VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = aHolder->GetTimeStampsRange();
   CORBA::Long aLength = aTimeStampsRange->length();
   if(value < 0 || aLength <= value)
     return;
index 5f543b345fbe75ec895b50d80c8e5db497fc6d6f..1adcba4db6b22416356ee5e7b050ca7c0454637c 100644 (file)
@@ -163,11 +163,11 @@ VISU::ColoredPrs3dHolder_i
 
 
 //----------------------------------------------------------------------------
-VISU::ColoredPrs3d::TimeStampsRange*
+VISU::ColoredPrs3dHolder::TimeStampsRange*
 VISU::ColoredPrs3dHolder_i
 ::GetTimeStampsRange()
 {
-  if( VISU::ColoredPrs3d_ptr aDevice = GetDevice() )
+  if( VISU::ColoredPrs3d_i* aDevice = GetPrs3dDevice() )
     return aDevice->GetTimeStampsRange();
 
   return NULL;
index 2434272c718db3c362afe77a3a550eda3650ed6c..bdf2c2da15d2d6a18c6987e2f93a1ee8b09ed339 100644 (file)
@@ -79,7 +79,7 @@ namespace VISU
     //----------------------------------------------------------------------------
     //! Gets TimeStampsRange information from the last visited presentation.
     virtual
-    VISU::ColoredPrs3d::TimeStampsRange*
+    VISU::ColoredPrs3dHolder::TimeStampsRange*
     GetTimeStampsRange();
 
     //----------------------------------------------------------------------------
index 8824261fc231f67b7b9e98b5e4e01253bd974895..1fa8df8a670717c5315d8d2634859973e187cca7 100644 (file)
@@ -284,12 +284,12 @@ CORBA::Long
 VISU::ColoredPrs3d_i
 ::GetTimeStampNumberByIndex( CORBA::Long theIndex )
 {
-  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
+  VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
   CORBA::Long aLength = aTimeStampsRange->length();
 
   if( theIndex >= 0 && theIndex < aLength )
   {
-    VISU::ColoredPrs3d::TimeStampInfo anInfo = aTimeStampsRange[ theIndex ];
+    VISU::ColoredPrs3dHolder::TimeStampInfo anInfo = aTimeStampsRange[ theIndex ];
     return anInfo.myNumber;
   }
 
@@ -302,12 +302,12 @@ CORBA::Long
 VISU::ColoredPrs3d_i
 ::GetTimeStampIndexByNumber( CORBA::Long theNumber )
 {
-  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
+  VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
   CORBA::Long aLength = aTimeStampsRange->length();
 
   for( int index = 0; index < aLength; index++ )
   {
-    VISU::ColoredPrs3d::TimeStampInfo anInfo = aTimeStampsRange[ index ];
+    VISU::ColoredPrs3dHolder::TimeStampInfo anInfo = aTimeStampsRange[ index ];
 
     if( anInfo.myNumber == theNumber )
       return index;
@@ -336,17 +336,18 @@ VISU::ColoredPrs3d_i
 
 
 //----------------------------------------------------------------------------
-VISU::ColoredPrs3d::TimeStampsRange* 
+VISU::ColoredPrs3dHolder::TimeStampsRange* 
 VISU::ColoredPrs3d_i
 ::GetTimeStampsRange()
 {
-  VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = new VISU::ColoredPrs3d::TimeStampsRange();
+  VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange =
+    new VISU::ColoredPrs3dHolder::TimeStampsRange();
   VISU::TValField& aValField = GetField()->myValField;
   if(IsTimeStampFixed()){
     aTimeStampsRange->length(1);
     PValForTime& aValForTime = aValField[GetTimeStampNumber()];
     std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime);
-    VISU::ColoredPrs3d::TimeStampInfo anInfo;
+    VISU::ColoredPrs3dHolder::TimeStampInfo anInfo;
     anInfo.myNumber = GetTimeStampNumber();
     anInfo.myTime = aTime.c_str();
     aTimeStampsRange[0] = anInfo;
@@ -385,7 +386,7 @@ VISU::ColoredPrs3d_i
     for(size_t aCounter = 0; anIter != aSortedRange.end(); anIter++, aCounter++){
       vtkIdType aTimeStampNumber = anIter->first;
       const std::string& aTime = anIter->second;
-      VISU::ColoredPrs3d::TimeStampInfo anInfo;
+      VISU::ColoredPrs3dHolder::TimeStampInfo anInfo;
       anInfo.myNumber = aTimeStampNumber;
       anInfo.myTime = aTime.c_str();
       aTimeStampsRange[aCounter] = anInfo;
@@ -1166,7 +1167,7 @@ VISU::ColoredPrs3d_i
   SetEntity((VISU::Entity)VISU::Storable::FindValue(theMap,"myEntity").toInt());
   SetFieldName(VISU::Storable::FindValue(theMap,"myFieldName").latin1());
   SetTimeStampNumber(VISU::Storable::FindValue(theMap,"myIteration").toInt());
-  myIsTimeStampFixed = VISU::Storable::FindValue(theMap,"myIsTimeStampFixed").toInt();
+  myIsTimeStampFixed = VISU::Storable::FindValue(theMap,"myIsTimeStampFixed", "1").toInt();
   OnSetInput(false);
 
   Build(ERestore);
@@ -1330,6 +1331,7 @@ VISU::ColoredPrs3d_i
     throw;
   }
 #endif
+
   if(anIsPublishInStudy) 
     aStudyBuilder->CommitCommand();
   return this;
index a255c6a65536385d0620764e5d62c197d4230cd3..30e68db65354f933d1c3749f4a2b164f958b8439 100644 (file)
@@ -111,7 +111,7 @@ namespace VISU
     GetScalarTimeStampNumber() const;
 
     virtual
-    VISU::ColoredPrs3d::TimeStampsRange*
+    VISU::ColoredPrs3dHolder::TimeStampsRange*
     GetTimeStampsRange();
 
     virtual 
index bc2ed067550aa9b3c69811ee2d1fefa5109d77b0..4ab275e6ea8286ee6ff24e8223cd0d2202c8edb3 100644 (file)
@@ -788,7 +788,7 @@ namespace VISU
            theStr<<thePrefix<<aName<<".SetScale("<<aServant->GetScale()<<")"<<endl;
 
            std::string aParam;
-           VISU::Entity anEntity = aServant->GetScalarEEntity();
+           VISU::Entity anEntity = aServant->GetScalarEntity();
            switch(anEntity){
            case NODE:
              aParam = "VISU.NODE";
@@ -804,15 +804,13 @@ namespace VISU
              break;
            }
 
-           CORBA::String_var aMeshName = aServant->GetScalarCMeshName();
-           CORBA::String_var aFieldName = aServant->GetScalarCFieldName();
-           CORBA::Long aTimeStampNumber = aServant->GetScalarLIteration();
+           CORBA::String_var aFieldName = aServant->GetScalarFieldName();
+           CORBA::Long aTimeStampNumber = aServant->GetScalarTimeStampNumber();
 
            theStr<<thePrefix<<aName<<".SetScalarField("<<
-             "'"<<aMeshName<<"',"<<
+             aParam<<","<<
              "'"<<aFieldName<<"',"<<
-             aTimeStampNumber<<","<<
-             aParam<<
+             aTimeStampNumber<<
              ")"<<endl;
 
            theStr<<thePrefix<<"pass"<<endl<<endl;