]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Bug PAL7444 - display mesh takes a lot of more memory in 2.1.0 than in 2.0.0.
authorapo <apo@opencascade.com>
Wed, 30 Mar 2005 13:52:23 +0000 (13:52 +0000)
committerapo <apo@opencascade.com>
Wed, 30 Mar 2005 13:52:23 +0000 (13:52 +0000)
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_ActorDef.h
src/OBJECT/SMESH_DeviceActor.cxx
src/OBJECT/SMESH_DeviceActor.h
src/OBJECT/SMESH_Object.cxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Mesh_i.cxx

index f3794ec5e452b2a9a4d6209efc4c288feeede871..004399a7f4cdbb6923a31111b53e091e4cd0290d 100644 (file)
@@ -101,8 +101,9 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
 }
 
 
-SMESH_ActorDef::SMESH_ActorDef(){
-  if(MYDEBUG) MESSAGE("SMESH_ActorDef");
+SMESH_ActorDef::SMESH_ActorDef()
+{
+  if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
 
   myTimeStamp = vtkTimeStamp::New();
 
@@ -136,7 +137,6 @@ SMESH_ActorDef::SMESH_ActorDef(){
 
   my2DActor = SMESH_DeviceActor::New();
   my2DActor->SetUserMatrix(aMatrix);
-  my2DActor->SetStoreMapping(true);
   my2DActor->PickableOff();
   my2DActor->SetProperty(mySurfaceProp);
   my2DActor->SetBackfaceProperty(myBackSurfaceProp);
@@ -149,7 +149,6 @@ SMESH_ActorDef::SMESH_ActorDef(){
 
   my3DActor = SMESH_DeviceActor::New();
   my3DActor->SetUserMatrix(aMatrix);
-  my3DActor->SetStoreMapping(true);
   my3DActor->PickableOff();
   my3DActor->SetProperty(mySurfaceProp);
   my3DActor->SetBackfaceProperty(myBackSurfaceProp);
@@ -177,7 +176,6 @@ SMESH_ActorDef::SMESH_ActorDef(){
 
   my1DActor = SMESH_DeviceActor::New();
   my1DActor->SetUserMatrix(aMatrix);
-  my1DActor->SetStoreMapping(true);
   my1DActor->PickableOff();
   my1DActor->SetHighlited(true);
   my1DActor->SetProperty(myEdgeProp);
@@ -202,7 +200,6 @@ SMESH_ActorDef::SMESH_ActorDef(){
 
   my1DExtActor = SMESH_DeviceActor::New();
   my1DExtActor->SetUserMatrix(aMatrix);
-  my1DExtActor->SetStoreMapping(true);
   my1DExtActor->PickableOff();
   my1DExtActor->SetHighlited(true);
   my1DExtActor->SetVisibility(false);
@@ -224,7 +221,7 @@ SMESH_ActorDef::SMESH_ActorDef(){
 
   myNodeActor = SMESH_DeviceActor::New();
   myNodeActor->SetUserMatrix(aMatrix);
-  myNodeActor->SetStoreMapping(true);
+  myNodeActor->SetStoreClippingMapping(true);
   myNodeActor->PickableOff();
   myNodeActor->SetVisibility(false);
   myNodeActor->SetProperty(myNodeProp);
@@ -238,9 +235,8 @@ SMESH_ActorDef::SMESH_ActorDef(){
 
   myBaseActor = SMESH_DeviceActor::New();
   myBaseActor->SetUserMatrix(aMatrix);
-  myBaseActor->SetStoreMapping(true);
+  myBaseActor->SetStoreGemetryMapping(true);
   myBaseActor->GetProperty()->SetOpacity(0.0);
-  myBaseActor->myGeomFilter->SetInside(true);
 
   myPickableActor = myBaseActor;
   
@@ -268,19 +264,9 @@ SMESH_ActorDef::SMESH_ActorDef(){
 
   myHighlitableActor = SMESH_DeviceActor::New();
   myHighlitableActor->SetUserMatrix(aMatrix);
-  myHighlitableActor->SetStoreMapping(false);
   myHighlitableActor->PickableOff();
   myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
 
-  myNodeHighlitableActor = SMESH_DeviceActor::New();
-  myNodeHighlitableActor->SetUserMatrix(aMatrix);
-  myNodeHighlitableActor->SetStoreMapping(false);
-  myNodeHighlitableActor->PickableOff();
-  myNodeHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
-  aFilter = myNodeHighlitableActor->GetExtractUnstructuredGrid();
-  aFilter->SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::ePoints);
-
-
   SetShrinkFactor(SMESH::GetFloat("SMESH:SettingsShrinkCoeff", 75)/100.);
 
   myName = "";
@@ -494,8 +480,9 @@ SMESH_ActorDef::SMESH_ActorDef(){
 }
 
 
-SMESH_ActorDef::~SMESH_ActorDef(){
-  if(MYDEBUG) MESSAGE("~SMESH_ActorDef");
+SMESH_ActorDef::~SMESH_ActorDef()
+{
+  if(MYDEBUG) MESSAGE("~SMESH_ActorDef - "<<this);
 
   myScalarBarActor->Delete();
   myLookupTable->Delete();
@@ -522,8 +509,6 @@ SMESH_ActorDef::~SMESH_ActorDef(){
   myBaseActor->Delete();
 
   myHighlitableActor->Delete();
-  myNodeHighlitableActor->Delete();
-
 
   //Deleting of pints numbering pipeline
   //---------------------------------------
@@ -624,8 +609,21 @@ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
 }
 
 
-void SMESH_ActorDef::SetControlMode(eControl theMode){
+void 
+SMESH_ActorDef::
+SetControlMode(eControl theMode)
+{
+  SetControlMode(theMode,true);
+}
+
+
+void 
+SMESH_ActorDef::
+SetControlMode(eControl theMode,
+              bool theCheckEntityMode)
+{
   myControlMode = eNone;
+  theCheckEntityMode &= QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true";
 
   my1DActor->GetMapper()->SetScalarVisibility(false);
   my2DActor->GetMapper()->SetScalarVisibility(false);
@@ -734,27 +732,36 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){
       switch(myControlMode){
       case eFreeEdges:
       case eFreeBorders:
-       my1DExtActor->SetExtControlMode(aFunctor,myControlActor);
+       my1DExtActor->SetExtControlMode(aFunctor);
        break;
       case eLength2D:
       case eMultiConnection2D:
-       my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
+       my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable);
        break;
       default:
        myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
       }
     }
 
-    if(QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true"){
+    if(theCheckEntityMode){
       if(myControlActor == my1DActor)
-       myEntityMode = eEdges;
-      else if(myControlActor == my2DActor)
-       myEntityMode = eFaces;
-      else if(myControlActor == my3DActor)
-       myEntityMode = eVolumes;
+       SetEntityMode(eEdges);
+      else if(myControlActor == my2DActor){
+       switch(myControlMode){
+       case eLength2D:
+       case eFreeEdges:
+       case eMultiConnection2D:
+         //SetEntityMode(eEdges);
+         SetEntityMode(eFaces);
+         break;
+       default:
+         SetEntityMode(eFaces);
+       }
+      }else if(myControlActor == my3DActor)
+       SetEntityMode(eVolumes);
     }
 
-  }else if(QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true"){
+  }else if(theCheckEntityMode){
     myEntityMode = eAllEntity;
   }
 
@@ -778,7 +785,6 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
   theRenderer->AddActor(my1DExtActor);
 
   theRenderer->AddActor(myHighlitableActor);
-  theRenderer->AddActor(myNodeHighlitableActor);
 
   theRenderer->AddActor2D(myScalarBarActor);
 
@@ -796,7 +802,6 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
   theRenderer->RemoveActor(myBaseActor);
 
   theRenderer->RemoveActor(myHighlitableActor);
-  theRenderer->RemoveActor(myNodeHighlitableActor);
 
   theRenderer->RemoveActor(my1DActor);
   theRenderer->RemoveActor(my1DExtActor);
@@ -826,7 +831,6 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
   myBaseActor->Init(myVisualObj,myImplicitBoolean);
   
   myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
-  myNodeHighlitableActor->Init(myVisualObj,myImplicitBoolean);
   
   my1DActor->Init(myVisualObj,myImplicitBoolean);
   my1DExtActor->Init(myVisualObj,myImplicitBoolean);
@@ -883,7 +887,6 @@ void SMESH_ActorDef::SetTransform(SALOME_Transform* theTransform){
   myBaseActor->SetTransform(theTransform);
 
   myHighlitableActor->SetTransform(theTransform);
-  myNodeHighlitableActor->SetTransform(theTransform);
 
   my1DActor->SetTransform(theTransform);
   my1DExtActor->SetTransform(theTransform);
@@ -1067,14 +1070,22 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
 
 
 void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
-  if(!myVisualObj->GetNbEntities(SMDSAbs_Edge))
+  myEntityState = eAllEntity;
+
+  if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)){
+    myEntityState &= ~eEdges;
     theMode &= ~eEdges;
+  }
 
-  if(!myVisualObj->GetNbEntities(SMDSAbs_Face))
+  if(!myVisualObj->GetNbEntities(SMDSAbs_Face)){
+    myEntityState &= ~eFaces;
     theMode &= ~eFaces;
+  }
 
-  if(!myVisualObj->GetNbEntities(SMDSAbs_Volume))
+  if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)){
+    myEntityState &= ~eVolumes;
     theMode &= ~eVolumes;
+  }
 
   if(!theMode){
     if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
@@ -1087,6 +1098,8 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
       theMode |= eVolumes;
   }
 
+  myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState);
+
   myEntityMode = theMode;
   SALOME_ExtractUnstructuredGrid* aFilter = NULL;
   aFilter = myBaseActor->GetExtractUnstructuredGrid();
@@ -1229,27 +1242,27 @@ void SMESH_ActorDef::UpdateHighlight(){
   myHighlitableActor->SetVisibility(false);
   myHighlitableActor->SetHighlited(false);
 
-  myNodeHighlitableActor->SetVisibility(false);
-  myNodeHighlitableActor->SetHighlited(false);
-
   if(myIsHighlighted){
     myHighlitableActor->SetProperty(myHighlightProp);
   }else if(myIsPreselected){
     myHighlitableActor->SetProperty(myPreselectProp);
   }
 
-  bool isVisible = GetVisibility();
+  bool anIsVisible = GetVisibility();
 
   if(myIsHighlighted || myIsPreselected){
     if(GetUnstructuredGrid()->GetNumberOfCells()){
+      myHighlitableActor->SetHighlited(anIsVisible);
+      myHighlitableActor->SetVisibility(anIsVisible);
+      myHighlitableActor->GetExtractUnstructuredGrid()->
+       SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::eCells);
       myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
-      myHighlitableActor->SetVisibility(isVisible);
-      myHighlitableActor->SetHighlited(isVisible);
-    }
-    if(myRepresentation == ePoint || GetPointRepresentation()){
-      myNodeHighlitableActor->SetProperty(myHighlitableActor->GetProperty());
-      myNodeHighlitableActor->SetVisibility(isVisible);
-      myNodeHighlitableActor->SetHighlited(isVisible);
+    }else if(myRepresentation == ePoint || GetPointRepresentation()){
+      myHighlitableActor->SetHighlited(anIsVisible);
+      myHighlitableActor->SetVisibility(anIsVisible);
+      myHighlitableActor->GetExtractUnstructuredGrid()->
+       SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::ePoints);
+      myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
     }
   }
 }
@@ -1308,7 +1321,7 @@ void SMESH_ActorDef::Update(){
     unsigned long aTime = myTimeStamp->GetMTime();
     unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
     if (anObjTime > aTime)
-      SetControlMode(GetControlMode());
+      SetControlMode(GetControlMode(),false);
   }
   if(myIsPointsLabeled){
     SetPointsLabeled(myIsPointsLabeled);
@@ -1461,7 +1474,6 @@ SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
   myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
   
   myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
-  myNodeHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
   
   my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
   my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
index ea3f8d02963f86c0f3517e12a551d10002b99dd3..e6925d30eb05194b5c015476fd0e405b8de6656d 100644 (file)
@@ -186,6 +186,7 @@ class SMESH_ActorDef : public SMESH_Actor{
   virtual long GetControlsPrecision() const { return myControlsPrecision; }
 
  protected:
+  void SetControlMode(eControl theMode, bool theCheckEntityMode);
   void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
   bool IsImplicitFunctionUsed() const;
 
@@ -207,7 +208,6 @@ class SMESH_ActorDef : public SMESH_Actor{
   vtkProperty* myHighlightProp;
   vtkProperty* myPreselectProp;
   SMESH_DeviceActor* myHighlitableActor;
-  SMESH_DeviceActor* myNodeHighlitableActor;
 
   eControl myControlMode;
   SMESH_DeviceActor* my2DActor;
@@ -220,6 +220,7 @@ class SMESH_ActorDef : public SMESH_Actor{
   SMESH_DeviceActor* my1DExtActor;
 
   unsigned int myEntityMode;
+  unsigned int myEntityState;
   bool myIsPointsVisible;
 
   bool myIsShrinkable;
index 337aba6483d5bceb36398e573d1c371553a48bbc..962ad1ed8c12f04a210b8ce34e97f659fac19a3a 100644 (file)
@@ -75,7 +75,10 @@ using namespace std;
 vtkStandardNewMacro(SMESH_DeviceActor);
 
 
-SMESH_DeviceActor::SMESH_DeviceActor(){
+SMESH_DeviceActor::SMESH_DeviceActor()
+{
+  if(MYDEBUG) MESSAGE("SMESH_DeviceActor - "<<this);
+
   myIsShrunk = false;
   myIsShrinkable = false;
   myRepresentation = eSurface;
@@ -91,17 +94,16 @@ SMESH_DeviceActor::SMESH_DeviceActor(){
 
   myShrinkFilter = vtkShrinkFilter::New();
 
+  myStoreClippingMapping = false;
+
   myExtractGeometry = SMESH_ExtractGeometry::New();
   myExtractGeometry->SetReleaseDataFlag(true);
-  myExtractGeometry->SetStoreMapping(true);
   myIsImplicitFunctionUsed = false;
 
   myExtractUnstructuredGrid = SALOME_ExtractUnstructuredGrid::New();
-  myExtractUnstructuredGrid->SetStoreMapping(true);
-
+    
   myMergeFilter = vtkMergeFilter::New();
 
-  myStoreMapping = false;
   myGeomFilter = SALOME_GeometryFilter::New();
 
   myTransformFilter = SALOME_TransformFilter::New();
@@ -112,43 +114,54 @@ SMESH_DeviceActor::SMESH_DeviceActor(){
 
 
 SMESH_DeviceActor::~SMESH_DeviceActor(){
-  if(MYDEBUG) MESSAGE("~SMESH_DeviceActor");
+  if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
+
   myProperty->Delete();
 
-  myMapper->RemoveAllInputs();
   myMapper->Delete();
 
-  myShrinkFilter->UnRegisterAllOutputs();
   myShrinkFilter->Delete();
 
-  myExtractUnstructuredGrid->UnRegisterAllOutputs();
   myExtractUnstructuredGrid->Delete();
 
-  myMergeFilter->UnRegisterAllOutputs();
   myMergeFilter->Delete();
 
-  myGeomFilter->UnRegisterAllOutputs();
   myGeomFilter->Delete();
 
-  myExtractGeometry->UnRegisterAllOutputs();
   myExtractGeometry->Delete();
 
-  myTransformFilter->UnRegisterAllOutputs();
   myTransformFilter->Delete();
 
   for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){
-    myPassFilter[i]->UnRegisterAllOutputs(); 
     myPassFilter[i]->Delete();
   }
 }
 
 
-void SMESH_DeviceActor::SetStoreMapping(int theStoreMapping){
-  if (myStoreMapping == theStoreMapping)
-    return;
-  myStoreMapping = theStoreMapping;
-  myGeomFilter->SetStoreMapping( myStoreMapping );
-  Modified();
+void
+SMESH_DeviceActor::
+SetStoreGemetryMapping(bool theStoreMapping)
+{
+  myGeomFilter->SetStoreMapping(theStoreMapping);
+  SetStoreClippingMapping(theStoreMapping);
+}
+
+
+void
+SMESH_DeviceActor::
+SetStoreClippingMapping(bool theStoreMapping)
+{
+  myStoreClippingMapping = theStoreMapping;
+  myExtractGeometry->SetStoreMapping(theStoreMapping && myIsImplicitFunctionUsed);
+  SetStoreIDMapping(theStoreMapping);
+}
+
+
+void
+SMESH_DeviceActor::
+SetStoreIDMapping(bool theStoreMapping)
+{
+  myExtractUnstructuredGrid->SetStoreMapping(theStoreMapping);
 }
 
 
@@ -165,9 +178,6 @@ void
 SMESH_DeviceActor::
 SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
 {
-  if(myIsImplicitFunctionUsed == theIsImplicitFunctionUsed)
-    return;
-
   int anId = 0;
   if(theIsImplicitFunctionUsed)
     myPassFilter[ anId ]->SetInput( myExtractGeometry->GetOutput() );
@@ -175,6 +185,7 @@ SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
     myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() );
     
   myIsImplicitFunctionUsed = theIsImplicitFunctionUsed;
+  SetStoreClippingMapping(myStoreClippingMapping);
 }
 
 
@@ -190,11 +201,10 @@ void SMESH_DeviceActor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){
     myExtractGeometry->SetInput(myMergeFilter->GetOutput());
 
     int anId = 0;
-    myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() );
+    SetImplicitFunctionUsed(myIsImplicitFunctionUsed);
     myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
     
     anId++; // 1
-    myGeomFilter->SetStoreMapping( myStoreMapping );
     myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
 
     anId++; // 2
@@ -239,7 +249,11 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
   bool anIsInitialized = theFunctor;
   if(anIsInitialized){
     vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
+
+    SetStoreIDMapping(true);
+    myExtractUnstructuredGrid->Update();
     vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput();
+
     aDataSet->ShallowCopy(aGrid);
     
     vtkDoubleArray *aScalars = vtkDoubleArray::New();
@@ -280,7 +294,6 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
 }
 
 void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
-                                         SMESH_DeviceActor* theDeviceActor,
                                          vtkScalarBarActor* theScalarBarActor,
                                          vtkLookupTable* theLookupTable)
 {
@@ -419,8 +432,7 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
   theScalarBarActor->SetVisibility(anIsInitialized);
 }
 
-void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
-                                         SMESH_DeviceActor* theDeviceActor)
+void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor)
 {
   myExtractUnstructuredGrid->ClearRegisteredCells();
   myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
@@ -553,7 +565,9 @@ void SMESH_DeviceActor::SetRepresentation(EReperesent theMode){
 
 
 void SMESH_DeviceActor::SetVisibility(int theMode){
-  if(!myExtractUnstructuredGrid->GetInput() || GetUnstructuredGrid()->GetNumberOfCells()){
+  if(!myExtractUnstructuredGrid->GetInput() || 
+     GetUnstructuredGrid()->GetNumberOfCells())
+  {
     vtkLODActor::SetVisibility(theMode);
   }else{
     vtkLODActor::SetVisibility(false);
@@ -576,7 +590,7 @@ int SMESH_DeviceActor::GetNodeObjId(int theVtkID){
     anID = myExtractGeometry->GetNodeObjId(theVtkID);
 
   vtkIdType aRetID = myVisualObj->GetNodeObjId(anID);
-  if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; aRetID = "<<aRetID);
+  if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; anID = "<<anID<<"; aRetID = "<<aRetID);
   return aRetID;
 }
 
index 897a2e585b826f582ded70e424b3b1c8bf1deffc..96dd92ce659141b586f6e19870e5225e89e485bf 100644 (file)
@@ -21,7 +21,7 @@
 //
 //
 //
-//  File   : SMESH_Actor.h
+//  File   : SMESH_DeviceActor.h
 //  Author : Nicolas REJNERI
 //  Module : SMESH
 //  $Header$
@@ -61,8 +61,9 @@ class SMESH_DeviceActor: public vtkLODActor{
   vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
   static SMESH_DeviceActor* New();
 
-  void SetStoreMapping(int theStoreMapping);
-  int GetStoreMapping(){ return myStoreMapping;}
+  void SetStoreClippingMapping(bool theStoreMapping);
+  void SetStoreGemetryMapping(bool theStoreMapping);
+  void SetStoreIDMapping(bool theStoreMapping);
 
   virtual int GetNodeObjId(int theVtkID);
   virtual float* GetNodeCoord(int theObjID);
@@ -95,11 +96,9 @@ class SMESH_DeviceActor: public vtkLODActor{
                      vtkScalarBarActor* theScalarBarActor,
                      vtkLookupTable* theLookupTable);
   void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
-                        SMESH_DeviceActor* theDeviceActor,
                         vtkScalarBarActor* theScalarBarActor,
                         vtkLookupTable* theLookupTable);
-  void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
-                        SMESH_DeviceActor* theDeviceActor);
+  void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
 
   bool IsHighlited() { return myIsHighlited;}
   void SetHighlited(bool theIsHighlited);
@@ -125,7 +124,7 @@ class SMESH_DeviceActor: public vtkLODActor{
   vtkMergeFilter* myMergeFilter;
   SALOME_ExtractUnstructuredGrid* myExtractUnstructuredGrid;
 
-  bool myStoreMapping;
+  bool myStoreClippingMapping;
   SALOME_GeometryFilter *myGeomFilter;
   SALOME_TransformFilter *myTransformFilter;
   std::vector<SALOME_PassThroughFilter*> myPassFilter;
@@ -153,4 +152,4 @@ class SMESH_DeviceActor: public vtkLODActor{
 };
 
 
-#endif //SMESH_ACTOR_H
+#endif //SMESH_DEVICE_ACTOR_H
index 4b43e56acade03d620d0d7120d01417f19b9733f..24023bacf401ea6bc438647eaea39e03ce2b216d 100644 (file)
@@ -287,12 +287,15 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
 //=================================================================================
 SMESH_VisualObjDef::SMESH_VisualObjDef()
 {
+  if(MYDEBUG) MESSAGE("SMESH_MeshObj - "<<this);
   myGrid = vtkUnstructuredGrid::New();
 }
 SMESH_VisualObjDef::~SMESH_VisualObjDef()
 {
-  if ( MYDEBUG )
-    MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() );
+  if(MYDEBUG) {
+    MESSAGE("~SMESH_MeshObj - "<<this);
+    myGrid->DebugOn();
+  }
   myGrid->Delete();
 }
 
index bf4ae7f7639f1347e013a15e41f1664fe4e0d69a..34c82ee213ee397bdc8dea3f004e8e669432c7c2 100644 (file)
@@ -730,6 +730,8 @@ namespace{
     
     SALOME_Selection *Sel = SALOME_Selection::Selection(anActiveStudy->getSelection());
     SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+
+    aStudyBuilder->NewCommand();  // There is a transaction
     for(; It.More(); It.Next()){
       Handle(SALOME_InteractiveObject) IObject = It.Value();
       if(IObject->hasEntry()){
@@ -737,7 +739,7 @@ namespace{
        
        /* Erase child graphical objects */
        SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
-       for(; it->More(); it->Next()){
+       for(it->InitEx(true); it->More(); it->Next()){
          SALOMEDS::SObject_var CSO = it->Value();
          if(CSO->FindAttribute(anAttr, "AttributeIOR")){
            anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
@@ -785,6 +787,7 @@ namespace{
        
       } /* IObject->hasEntry() */
     } /* more/next */
+    aStudyBuilder->CommitCommand();
     
     /* Clear any previous selection */
     Sel->ClearIObjects();
@@ -1274,6 +1277,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
        }
        CORBA::Long anId = aStudy->StudyId();
        TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry());
+       cout<<"myAutomaticUpdate - "<<myAutomaticUpdate<<endl;
        if(myAutomaticUpdate && aVisualObj){
          aVisualObj->Update();
          SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
index 8bd6cdce93832a9f149e319db1cdd6a6c52dabd4..89cebc3c456091b5c434993698eb8579379e459e 100644 (file)
@@ -244,6 +244,17 @@ namespace SMESH{
   void RemoveActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){
     if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){
       aViewFrame->RemoveActor(theActor);
+      if(theActor->hasIO()){
+       Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
+       if(anIO->hasEntry()){
+         std::string anEntry = anIO->getEntry();
+         QAD_Study* aStudy = theStudyFrame->getStudy();
+         int aStudyId = aStudy->getStudyId();
+         TVisualObjCont::key_type aKey(aStudyId,anEntry);
+         VISUAL_OBJ_CONT.erase(aKey);
+       }
+      }
+      theActor->Delete();
       aViewFrame->Repaint();
     }
   }
index db273b20366fbf0c7af485c3ff6e336df52fedbf..9eb0f79ffff02736c7124f8a7f99068630484f85 100644 (file)
@@ -498,8 +498,12 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMesh( GEOM::GEOM_Object_ptr theShapeObj
   ASSERT( meshServant );
   meshServant->SetShape( theShapeObject );
   // publish mesh in the study
-  if ( CanPublishInStudy( mesh ) )
+  if( CanPublishInStudy( mesh ) ){
+    SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+    aStudyBuilder->NewCommand();  // There is a transaction
     PublishMesh( myCurrentStudy, mesh.in() );
+    aStudyBuilder->CommitCommand();
+  }
   return mesh._retn();
 }
 
@@ -520,8 +524,12 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromUNV( const char* theFileName
   SMESH::SMESH_Mesh_var aMesh = createMesh();
   string aFileName; // = boost::filesystem::path(theFileName).leaf();
   // publish mesh in the study
-  if ( CanPublishInStudy( aMesh ) )
+  if ( CanPublishInStudy( aMesh ) ){
+    SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+    aStudyBuilder->NewCommand();  // There is a transaction
     PublishMesh( myCurrentStudy, aMesh.in(), aFileName.c_str() );
+    aStudyBuilder->CommitCommand();
+  }
 
   SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() );
   ASSERT( aServant );
@@ -553,9 +561,12 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
   SMESH::mesh_array_var aResult = new SMESH::mesh_array();
   theStatus = (SMESH::DriverMED_ReadStatus)aStatus;
   if(theStatus == SMESH::DRS_OK){
+    SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+    aStudyBuilder->NewCommand();  // There is a transaction
+
     aResult->length( aNames.size() );
     int i = 0;
-    
+   
     // Iterate through all meshes and create mesh objects
     for ( list<string>::iterator it = aNames.begin(); it != aNames.end(); it++ ) {
       // create mesh
@@ -575,6 +586,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName,
 
       aResult[i++] = SMESH::SMESH_Mesh::_duplicate( mesh );
     }
+    aStudyBuilder->CommitCommand();
   }
   return aResult._retn();
 }
@@ -596,8 +608,12 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromSTL( const char* theFileName
   SMESH::SMESH_Mesh_var aMesh = createMesh();
   string aFileName; // = boost::filesystem::path(theFileName).leaf();
   // publish mesh in the study
-  if ( CanPublishInStudy( aMesh ) )
+  if( CanPublishInStudy( aMesh ) ){
+    SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+    aStudyBuilder->NewCommand();  // There is a transaction
     PublishInStudy( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
+    aStudyBuilder->CommitCommand();
+  }
 
   SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() );
   ASSERT( aServant );
index d0da172ba0941f13d5cb04e258c9d273cd2e330a..0fa06e0406a730b5d69f0abafefbbff655b074ea 100644 (file)
@@ -76,7 +76,8 @@ SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
                            CORBA::Long studyId )
 : SALOME::GenericObj_i( thePOA )
 {
-  INFOS("SMESH_Mesh_i");
+  INFOS("SMESH_Mesh_i; this = "<<this);
+  _impl = NULL;
   _gen_i = gen_i;
   _id = myIdGenerator++;
   _studyId = studyId;
@@ -91,7 +92,7 @@ SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
 
 SMESH_Mesh_i::~SMESH_Mesh_i()
 {
-  INFOS("~SMESH_Mesh_i");
+  INFOS("~SMESH_Mesh_i; this = "<<this);
   map<int, SMESH::SMESH_GroupBase_ptr>::iterator it;
   for ( it = _mapGroups.begin(); it != _mapGroups.end(); it++ ) {
     SMESH_GroupBase_i* aGroup = dynamic_cast<SMESH_GroupBase_i*>( SMESH_Gen_i::GetServant( it->second ).in() );