Salome HOME
Update Help for VISU module.
[modules/visu.git] / src / VISU_I / VISU_DeformedShape_i.cc
index 19baed976976ffa0639a820e305098dc1e78d984..1198ad2d3d31b797a08d9d0136589fdc4eedb4db 100644 (file)
 #include "VISU_DeformedShape_i.hh"
 #include "VISU_ScalarMapAct.h"
 
+#include <vtkDataSetMapper.h>
+
 using namespace VISU;
 using namespace std;
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
 #else
 static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
 #endif
 
 int VISU::DeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
-                                     const char* theFieldName, int theIteration)
+                                     const char* theFieldName, int theIteration, int isMemoryCheck)
 {
   try{
-    if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration)) return 0;
-    const VISU::TField& aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
-    return aField.myNbComp > 1;
-  }catch(std::runtime_error& exc){
-    INFOS("Follow exception was accured :\n"<<exc.what());
+    if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck)) return 0;
+    const VISU::PField aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
+    return aField->myNbComp > 1;
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!");
+    INFOS("Unknown exception was occured!");
   }
   return 0;
 }
@@ -61,25 +61,36 @@ QString VISU::DeformedShape_i::GenerateName() { return VISU::GenerateName("Def.S
 const string VISU::DeformedShape_i::myComment = "DEFORMEDSHAPE";
 const char* VISU::DeformedShape_i::GetComment() const { return myComment.c_str();}
 
-VISU::DeformedShape_i::DeformedShape_i(Result_i* theResult, bool theAddToStudy) : 
-       PrsObject_i(theResult->GetStudyDocument()), 
-       Prs3d_i(theResult),       
-       ScalarMap_i(theResult, theAddToStudy)
+
+VISU::DeformedShape_i::
+DeformedShape_i(Result_i* theResult, 
+               bool theAddToStudy) : 
+  PrsObject_i(theResult->GetStudyDocument()), 
+  Prs3d_i(theResult,theAddToStudy),
+  ScalarMap_i(theResult,theAddToStudy),
+  myDeformedShapePL(NULL)
 {
   if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i");
-  myDeformedShapePL = NULL;
 }
 
-void VISU::DeformedShape_i::Destroy(){
-  ScalarMap_i::Destroy();
+
+VISU::DeformedShape_i::
+DeformedShape_i(Result_i* theResult, 
+               SALOMEDS::SObject_ptr theSObject) : 
+  PrsObject_i(theResult->GetStudyDocument()), 
+  Prs3d_i(theResult,theSObject),
+  ScalarMap_i(theResult,theSObject),
+  myDeformedShapePL(NULL)
+{
+  if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i");
 }
 
+
 void VISU::DeformedShape_i::SameAs(const DeformedShape_i* theOrigin)
 {
   DeformedShape_i* aDefShape = const_cast<DeformedShape_i*>(theOrigin);
   VISU::ScalarMap_i::SameAs(theOrigin);
 
-  //SetScale(aDefShape->GetScale());
   SetColor(aDefShape->GetColor());
   ShowColored(aDefShape->IsColored());
 }
@@ -93,21 +104,20 @@ VISU::Storable* VISU::DeformedShape_i::Create(const char* theMeshName, VISU::Ent
   return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
 }
 
+
 VISU::Storable* VISU::DeformedShape_i::Restore(const Storable::TRestoringMap& theMap)
-     throw(std::logic_error&)
 {
-  ScalarMap_i::Restore(theMap);
-
+  DoHook();
   SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
-
   myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
   myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
   myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
   myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
 
-  return Build(true);
+  return ScalarMap_i::Restore(theMap);
 }
 
+
 void VISU::DeformedShape_i::ToStream(std::ostringstream& theStr){
   ScalarMap_i::ToStream(theStr);
 
@@ -119,18 +129,6 @@ void VISU::DeformedShape_i::ToStream(std::ostringstream& theStr){
   Storable::DataToStream( theStr, "myColor.B", myColor.B );
 }
 
-VISU::Storable* VISU::DeformedShape_i::Restore(SALOMEDS::SObject_ptr theSObject, 
-                                              const string& thePrefix, const Storable::TRestoringMap& theMap)
-     throw(std::logic_error&)
-{
-  VISU::Result_i* pResult = GetResult(theSObject);
-  if(pResult != NULL){
-    VISU::DeformedShape_i* pResent = new VISU::DeformedShape_i(pResult);
-    return pResent->Restore(theMap);
-  }
-  return NULL;
-}
-
 
 VISU::DeformedShape_i::~DeformedShape_i(){
   if(MYDEBUG) MESSAGE("DeformedShape_i::~DeformedShape_i()");
@@ -160,7 +158,6 @@ void VISU::DeformedShape_i::SetMapScale(double theMapScale){
 
 
 VISU_Actor* VISU::DeformedShape_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
-  throw (std::runtime_error&)
 {
   VISU_Actor* anActor = VISU::ScalarMap_i::CreateActor(theIO);
   anActor->SetRepresentation(1);
@@ -169,7 +166,7 @@ VISU_Actor* VISU::DeformedShape_i::CreateActor(const Handle(SALOME_InteractiveOb
 }
 
 
-void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor){
+void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor) {
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
     if(IsColored()){
       anActor->SetBarVisibility(true);