Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISU_I / VISU_ScalarMapOnDeformedShape_i.cc
index 9b8868e34f352262ec469a5c9453892e8edd94bb..c9ee0e66a3ef620730f2b000c646bca08f5e333d 100644 (file)
@@ -102,6 +102,7 @@ ScalarMapOnDeformedShape_i(Result_i* theResult,
 VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Create(const char* theMeshName, VISU::Entity theEntity, 
                                                         const char* theFieldName, int theIteration)
 {
+  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::Create:"<<__LINE__<<endl;
   myIsColored = true;
   myColor.R = myColor.G = myColor.B = 0.5;
   VISU::Storable* aRes = TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
@@ -116,6 +117,7 @@ VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Create(const char* theMeshName
 
 VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Restore(const Storable::TRestoringMap& theMap)
 {
+  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::Restore:"<<__LINE__<<endl;
   TSuperClass::Restore(theMap);
   
   SetScalarFieldName(VISU::Storable::FindValue(theMap,"myScalarFieldName"));
@@ -138,6 +140,7 @@ VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Restore(const Storable::TResto
 
 void VISU::ScalarMapOnDeformedShape_i::ToStream(std::ostringstream& theStr)
 {
+  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::ToStream:"<<__LINE__<<endl;
   TSuperClass::ToStream(theStr);
   
   Storable::DataToStream( theStr, "myScalarFieldName", myScalarFieldName.c_str());
@@ -161,15 +164,21 @@ void
 VISU::ScalarMapOnDeformedShape_i
 ::SameAs(const Prs3d_i* theOrigin)
 {
+  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::SameAs:"<<__LINE__<<endl;
+  int theScalarIter = this->GetScalarIteration();
+  string theScalarMeshName = this->GetScalarMeshName();
+  string theScalarFieldName = this->GetScalarFieldName();
+  if(MYDEBUG) cout << "SameAs:"<<endl
+                  << "\t"<<theScalarIter<<":"<<theScalarMeshName.c_str()<<":"<<theScalarFieldName.c_str()<<endl;
+
   TSuperClass::SameAs(theOrigin);
 
   if(const ScalarMapOnDeformedShape_i* aPrs3d = dynamic_cast<const ScalarMapOnDeformedShape_i*>(theOrigin)){
     ScalarMapOnDeformedShape_i* anOrigin = const_cast<ScalarMapOnDeformedShape_i*>(aPrs3d);
 
-    // increment the scalar iteration for using in VISU_TimeAnimation class implementation.
     this->SetScalarField(anOrigin->GetScalarMeshName().c_str(),
                         anOrigin->GetScalarFieldName().c_str(),
-                        anOrigin->GetScalarIteration() + 1,
+                        theScalarIter,
                         anOrigin->GetScalarEntity());
     Update();
   }
@@ -204,6 +213,7 @@ CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetSourceRangeMax(){
 
 void VISU::ScalarMapOnDeformedShape_i::DoHook()
 {
+  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::DoHook:"<<__LINE__<<endl;
   if(!myPipeLine)
     myPipeLine = VISU_ScalarMapOnDeformedShapePL::New();
   
@@ -215,6 +225,7 @@ void VISU::ScalarMapOnDeformedShape_i::DoHook()
 
 VISU_Actor* VISU::ScalarMapOnDeformedShape_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
 {
+  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::CreateActor:"<<__LINE__<<endl;
   VISU_Actor* anActor = TSuperClass::CreateActor(theIO);
   anActor->SetRepresentation(2);
   anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
@@ -224,6 +235,7 @@ VISU_Actor* VISU::ScalarMapOnDeformedShape_i::CreateActor(const Handle(SALOME_In
 
 
 void VISU::ScalarMapOnDeformedShape_i::UpdateActor(VISU_Actor* theActor) {
+  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::UpdateActor:"<<__LINE__<<endl;
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
     if(IsColored()){
       anActor->SetBarVisibility(true);
@@ -242,12 +254,15 @@ void VISU::ScalarMapOnDeformedShape_i::SetScalarField(const char* theMeshName,
                                                      const int   theIteration,
                                                      const VISU::TEntity  theEntity)
 {
+  if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::SetScalarField:"<<__LINE__<<endl;
+  if(MYDEBUG) cout << "\ttheFieldName="<<theFieldName<<endl;
+  if(MYDEBUG) cout << "\ttheIteration="<<theIteration<<endl;
+  myScalarField = myResult->GetInput()->GetField(theMeshName,theEntity,theFieldName);
+  TVTKOutput* aOut = myResult->GetInput()->GetTimeStampOnMesh(theMeshName,
+                                                             theEntity,
+                                                             theFieldName,
+                                                             theIteration)->GetVTKOutput();
   if (myScalarMapOnDeformedShapePL){
-    myField = myResult->GetInput()->GetField(theMeshName,theEntity,theFieldName);
-    TVTKOutput* aOut = myResult->GetInput()->GetTimeStampOnMesh(theMeshName,
-                                                               theEntity,
-                                                               theFieldName,
-                                                               theIteration)->GetVTKOutput();
     myScalarMapOnDeformedShapePL->SetScalars(aOut);
   }
   this->SetScalarMeshName(theMeshName);
@@ -256,6 +271,13 @@ void VISU::ScalarMapOnDeformedShape_i::SetScalarField(const char* theMeshName,
   this->SetScalarEntity(theEntity);
 }
 
+void VISU::ScalarMapOnDeformedShape_i::SetScalarField(const char* theMeshName,
+                                                     const char* theFieldName,
+                                                     const long  theIteration,
+                                                     const VISU::Entity  theEntity)
+{
+  this->SetScalarField(theMeshName,theFieldName,(int)theIteration,VISU::TEntity(theEntity));
+}
 
 void VISU::ScalarMapOnDeformedShape_i::SetScalarMeshName(const char* theName){
   myScalarMeshName = theName;
@@ -274,6 +296,8 @@ std::string VISU::ScalarMapOnDeformedShape_i::GetScalarFieldName(){
 void VISU::ScalarMapOnDeformedShape_i::SetScalarIteration(const int theValue){
   myScalarIteration = theValue;
 }
+
+
 int VISU::ScalarMapOnDeformedShape_i::GetScalarIteration(){
   return myScalarIteration;
 }
@@ -281,6 +305,22 @@ int VISU::ScalarMapOnDeformedShape_i::GetScalarIteration(){
 void VISU::ScalarMapOnDeformedShape_i::SetScalarEntity(const VISU::TEntity theValue){
   myScalarEntity = theValue;
 }
+
 VISU::TEntity VISU::ScalarMapOnDeformedShape_i::GetScalarEntity(){
   return myScalarEntity;
 }
+
+void VISU::ScalarMapOnDeformedShape_i::SetScalarEEntity(const VISU::Entity theValue){
+  myScalarEntity = VISU::TEntity(theValue);
+}
+
+VISU::Entity VISU::ScalarMapOnDeformedShape_i::GetScalarEEntity(){
+  return VISU::Entity(myScalarEntity);
+}
+
+const VISU::PField&
+VISU::ScalarMapOnDeformedShape_i
+::GetField() const 
+{ 
+  return myScalarField;
+}