]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for bug Bug IPAL14224: NPAL14357
authorenk <enk@opencascade.com>
Mon, 25 Dec 2006 08:44:57 +0000 (08:44 +0000)
committerenk <enk@opencascade.com>
Mon, 25 Dec 2006 08:44:57 +0000 (08:44 +0000)
Wrong work of published animation on group

src/PIPELINE/VISU_PrsMergerPL.cxx
src/VISU_I/VISU_PrsMerger_i.cc
src/VISU_I/VISU_PrsMerger_i.hh

index 229a72876017de6522ce5cd43c64a7643c788976..9b46c9fb7e6e4845ac60a198fec6e71652099eda 100644 (file)
@@ -87,6 +87,7 @@ void
 VISU_PrsMergerPL
 ::ShallowCopy(VISU_PipeLine *thePipeLine)
 {
+  if (MYDEBUG) MESSAGE("ShallowCopy");
   VISU_PrsMergerPL* aPipeLine = dynamic_cast<VISU_PrsMergerPL*>(thePipeLine);
   if(this == aPipeLine){
     TSupperClass::ShallowCopy(thePipeLine);
@@ -231,6 +232,7 @@ VISU_PrsMergerPL
 {
   if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Update()");
   Superclass::Update();
+  Execute();
 }
 
 void
index c165e46be0a2301a6ee96930d972e3a1d4b1685f..7602c1035a42ad656b7b34e9e82185e96c9da6d4 100644 (file)
@@ -167,6 +167,13 @@ VISU::Storable* VISU::PrsMerger_i::Restore(const Storable::TRestoringMap& theMap
   return this;
 }
 
+void
+VISU::PrsMerger_i
+::SetMapScale(double theMapScale)
+{
+  myPrsMergerPL->SetMapScale(theMapScale);
+}
+
 void VISU::PrsMerger_i::ToStream(std::ostringstream& theStr)
 {
   if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::ToStream:");
@@ -214,14 +221,16 @@ void
 VISU::PrsMerger_i
 ::SameAs(const Prs3d_i* theOrigin)
 {
-  if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SameAs:");
+  if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SameAs: this="<<this);
 
   TSuperClass::SameAs(theOrigin);
 
   if(const PrsMerger_i* aPrs3d = dynamic_cast<const PrsMerger_i*>(theOrigin)){
     PrsMerger_i* anOrigin = const_cast<PrsMerger_i*>(aPrs3d);
+    if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SameAs: theOrigin="<<anOrigin);
     this->SetScalarMap(myMeshName.c_str(),VISU::Entity(myEntity),myFieldName.c_str(),myIteration);
     string_array_var aGroupNames = anOrigin->getGroupNames();
+    RemoveAllGeom();
     for(int i=0;i<aGroupNames->length();i++){
       this->AddMeshOnGroup(myMeshName.c_str(),aGroupNames[i]);
     }
@@ -233,8 +242,8 @@ VISU_Actor*
 VISU::PrsMerger_i
 ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking) 
 {
-  if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::CreateActor:");
-  return VISU::ScalarMap_i::CreateActor(theIO, true);
+  if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::CreateActor this="<<this);
+  return VISU::ScalarMap_i::CreateActor(theIO, toSupressShrinking);
 }
 
 VISU_Actor* VISU::PrsMerger_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
@@ -243,7 +252,8 @@ VISU_Actor* VISU::PrsMerger_i::CreateActor(const Handle(SALOME_InteractiveObject
 }
 
 void VISU::PrsMerger_i::UpdateActor(VISU_Actor* theActor) {
-  if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::UpdateActor");
+  if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::UpdateActor this="<<this);
+  
   TSuperClass::UpdateActor(theActor);
 }
 
@@ -276,29 +286,44 @@ VISU::PrsMerger_i::
 AddMeshOnGroup(const char* theMeshName, 
               const char* theGroupName)
 {
-  if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::AddMeshOnGroup |"<< theGroupName <<"|");
+  if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::AddMeshOnGroup |"<< theGroupName <<"| this="<<this);
   CORBA::Long aRetVal = -1;
   VISU::PIDMapper anIDMapper;
   anIDMapper = myResult->GetInput()->GetMeshOnGroup(theMeshName,theGroupName);
   if(!anIDMapper)
     MESSAGE("Warning: There are no mesh with group=|"<<theGroupName<<"|");
-  VISU_MeshPL* aTmpMesh = VISU_MeshPL::New();
-  aTmpMesh->SetIDMapper(anIDMapper);
-
-  aRetVal = myPrsMergerPL->AddBackGeometry(aTmpMesh);
+  if (MYDEBUG) MESSAGE("AddMeshOnGroup nbGeoms defore  ="<<myPrsMergerPL->GetNbGeometry());
   
-  if(aRetVal >-1 ){
-    myMeshPLList.push_back(aTmpMesh);
-    TPairStringAndInt aPair((std::string)theGroupName,-1);
-    myGeomNameEntityList.push_back(aPair);
+  bool isGroupInList = false;
+  TNameAndEntityList::const_iterator aIter = myGeomNameEntityList.begin();
+  for(;aIter!=myGeomNameEntityList.end();aIter++){
+    if(aIter->first == std::string(theGroupName))
+      {
+       isGroupInList = true;
+       break;
+      }
+  }
+  
+  if(!isGroupInList){
+    VISU_MeshPL* aTmpMesh = VISU_MeshPL::New();
+    aTmpMesh->SetIDMapper(anIDMapper);
+    
+    aRetVal = myPrsMergerPL->AddBackGeometry(aTmpMesh);
+    
+    if(aRetVal >-1 ){
+      myMeshPLList.push_back(aTmpMesh);
+      TPairStringAndInt aPair((std::string)theGroupName,-1);
+      myGeomNameEntityList.push_back(aPair);
+    }
+    else
+      aTmpMesh->Delete();
+    
+    UpdateIcon();
+    
   }
-  else
-    aTmpMesh->Delete();
   
   if (MYDEBUG) MESSAGE("AddMeshOnGroup nbGeoms after  ="<<myPrsMergerPL->GetNbGeometry());
 
-  UpdateIcon();
-
   return aRetVal;
 }
 
@@ -350,7 +375,7 @@ SetScalarMap(const char* theMeshName,
             const char* theFieldName,
             CORBA::Long theStampsNum)
 {
-  if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SetScalarMap");
+  if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SetScalarMap this="<<this);
   VISU::PIDMapper anIDMapper;
   anIDMapper = myResult->GetInput()->GetTimeStampOnMesh(theMeshName,(VISU::TEntity)theEntity,theFieldName,int(theStampsNum));
 
index 986d102815c3a85c4d9d86492365d3f7a62ae1d2..88625841a9ec9bb0393a322b3ecd5eddc9bd6796 100644 (file)
@@ -103,6 +103,10 @@ namespace VISU{
     virtual void ToStream(std::ostringstream& theStr);
 
     virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+
+    virtual
+    void
+    SetMapScale(double theMapScale = 1.0);
     
     static const std::string myComment;
     virtual const char* GetComment() const;