Salome HOME
Update copyright information
[modules/visu.git] / src / VISU_I / VISU_ColoredPrs3dCache_i.cc
index ae32d74a0d325fddee24954940851e14d78ddd2f..ec648983d5483b4c25a02e1c9d8555fab73671ca 100644 (file)
@@ -1,29 +1,34 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  VISU OBJECT : interactive object for VISU entities implementation
 //  File   : VISU_ColoredPrs3dCache_i.cc
 //  Author : Oleg UVAROV
 //  Module : VISU
 //
+#ifdef WNT
+#define NOGDI
+#endif
+
 #include "VISU_ColoredPrs3dCache_i.hh"
 
 #include "VISU_ColoredPrs3dHolder_i.hh"
@@ -34,6 +39,7 @@
 #include "VISU_Actor.h"
 
 #include "VISU_PipeLine.hxx"
+#include "VISU_Tools.h"
 
 #include "SALOME_Event.h"
 
@@ -351,7 +357,7 @@ VISU::ColoredPrs3dCache_i
       theRequiredMemory = int( aMemoryUsed + aMemoryNeeded ) + 1;
 
       size_t aMb = 1024 * 1024;
-      double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*aMb)) / double(aMb);
+      double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*(double)aMb)) / double(aMb);
       anEnlargeType = aMemoryNeeded < aFreeMemory ?
        VISU::ColoredPrs3dCache::ENLARGE : VISU::ColoredPrs3dCache::IMPOSSIBLE;
     }
@@ -455,7 +461,7 @@ VISU::ColoredPrs3dCache_i
     return;
 
   size_t aMb = 1024 * 1024;
-  double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*aMb)) / double(aMb);
+  double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*(double)aMb)) / double(aMb);
   CORBA::Float aMemoryUsed = GetDeviceMemorySize();
   CORBA::Float aMemoryNeeded = theMemorySize - aMemoryUsed;
   if( aMemoryNeeded > aFreeMemory )
@@ -481,7 +487,7 @@ VISU::ColoredPrs3dCache_i
   CORBA::String_var anIOR = GetID();
   SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectIOR(anIOR.in());
   VISU::RemoveFromStudy(aSObject, false, true);
-  Destroy();
+  UnRegister();
 }
 
 std::string
@@ -521,7 +527,7 @@ VISU::ColoredPrs3dCache_i
     TPrs3dPtr aPrs3d(thePrs3d);
     myHolderMap[theHolderEntry].push_front(aPrs3d);  
     thePrs3d->SetHolderEntry( theHolderEntry );
-    thePrs3d->Destroy();
+    thePrs3d->UnRegister();
   }
   return thePrs3d;
 }
@@ -668,6 +674,15 @@ VISU::ColoredPrs3dCache_i
     
     aPrs3d->SameAs(thePrs);
     
+    // rnv: fix for the 20870: EDF 1410 VISU: Anomaly in the Gauss point representation.
+    // special case for the "Gauss Points" presentation,
+    // update the LookupTable in the mapper, after assign properties of the presentation
+    // using SameAs(...) method.
+    VISU::GaussPoints_i* gPoints  = dynamic_cast<VISU::GaussPoints_i*>( aPrs3d.get() );
+    if(gPoints) {
+      gPoints->UpdateMapperLookupTable();
+    }
+    
     // special case for deformed shape
     VISU::DeformedShapeAndScalarMap_i* dShape =
       dynamic_cast<VISU::DeformedShapeAndScalarMap_i*>( aPrs3d.get() );
@@ -698,6 +713,7 @@ VISU::ColoredPrs3dCache_i
            ProcessVoidEvent(new TAddActorEvent(anActor,aViewWindow));
            //aViewWindow->AddActor(anActor);
            anActor->SetVisibility(true);
+           SetVisibilityState( aHolderEntry, Qtx::ShownState);
          }
 
          if(aPrs3d != aLastVisitedPrs3d)
@@ -714,8 +730,10 @@ VISU::ColoredPrs3dCache_i
              aNewActor = aPrs3d->CreateActor();
              ProcessVoidEvent(new TAddActorEvent(aNewActor,aViewWindow));
              //aViewWindow->AddActor(aNewActor);
-           }else
+           }else {
              aNewActor->SetVisibility(true);
+             SetVisibilityState( aHolderEntry, Qtx::ShownState);
+           }
            aNewActor->DeepCopy(anActor);
 
            aPrs3d->SetActiveState(true);