Salome HOME
updated copyright message
[modules/geom.git] / src / GEOMGUI / GEOM_Displayer.cxx
index 1e4f76a6b222442842e27bfe628541bb6615af45..0896c4ea972cc942173001d6d65743ede8271fff 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -25,7 +25,6 @@
 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 
 #include "GEOM_Displayer.h"
-#include "GEOMGUI_DimensionProperty.h"
 #include "GeometryGUI.h"
 
 #include <GEOM_Constants.h>
 #include <GEOM_OCCFilter.h>
 
 #include <GEOM_Actor.h>
-#include <GEOM_AISShape.hxx>
 #include <GEOM_AISDimension.hxx>
+#include <GEOM_Annotation.hxx>
 #include <GEOM_TopWireframeShape.hxx>
 #include <GEOM_AISVector.hxx>
 #include <GEOM_AISTrihedron.hxx>
 #include <GEOM_VTKTrihedron.hxx>
 #include <GEOM_VTKPropertyMaterial.hxx>
+#include <GEOM_PainterPolyDataMapper.h>
+
+#include <GEOMGUI_DimensionProperty.h>
+#include <GEOMGUI_AnnotationAttrs.h>
+#include <GEOMGUI_AnnotationMgr.h>
 
 #include <GEOMUtils.hxx>
 
 #include <SUIT_ViewManager.h>
 #include <SUIT_ResourceMgr.h>
 
-#include <Basics_OCCTVersion.hxx>
-
 #include <SalomeApp_Study.h>
 #include <SalomeApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 #include <LightApp_DataObject.h>
 #include <SalomeApp_TypeFilter.h>
 #include <SalomeApp_Tools.h>
+#include "utilities.h"
 
 #include <SALOME_ListIO.hxx>
 #include <SALOME_Prs.h>
+#include "utilities.h"
 
 #include <SOCC_Prs.h>
 #include <SOCC_ViewModel.h>
 #include <SVTK_Prs.h>
 #include <SVTK_ViewModel.h>
 
+#include <SPV3D_Prs.h>
+#include <SPV3D_ViewModel.h>
+
 #include <OCCViewer_ViewWindow.h>
 #include <OCCViewer_ViewPort3d.h>
 #include <OCCViewer_Utilities.h>
 
+#include <BRepBndLib.hxx>
+#include <pqActiveObjects.h>
+#include <pqApplicationCore.h>
+#include <pqObjectBuilder.h>
+#include <vtkSMPropertyHelper.h>
+#include <vtkSMProxy.h>
+#include <vtkSMParaViewPipelineControllerWithRendering.h>
+#include <vtkNamedColors.h>
+#include <vtkPoints.h>
+#include <vtkCamera.h>
+#include <vtkCellArray.h>
+#include <vtkFloatArray.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
+
 // OCCT Includes
-#include <AIS_Drawer.hxx>
 #include <AIS_Dimension.hxx>
 #include <AIS_LengthDimension.hxx>
 #include <AIS_DiameterDimension.hxx>
 #include <AIS_AngleDimension.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 #include <Aspect_PolygonOffsetMode.hxx>
-#include <Aspect_ColorScale.hxx>
 #include <Prs3d_IsoAspect.hxx>
 #include <Prs3d_PointAspect.hxx>
 #include <StdSelect_TypeOfEdge.hxx>
 #include <StdSelect_TypeOfFace.hxx>
-#include <StdSelect_DisplayMode.hxx>
+//#include <StdSelect_DisplayMode.hxx>
 #include <TopoDS_Face.hxx>
 #include <BRep_Tool.hxx>
 #include <Geom_Plane.hxx>
 #include <Geom_Axis2Placement.hxx>
 #include <Graphic3d_AspectFillArea3d.hxx>
 #include <gp_Pln.hxx>
-#include <TColStd_MapOfInteger.hxx>
 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
 #include <TopoDS_Iterator.hxx>
 #include <Graphic3d_AspectMarker3d.hxx>
 #include <TopoDS.hxx>
 #include <NCollection_DataMap.hxx>
 #include <NCollection_Map.hxx>
+#include <Graphic3d_Texture2Dmanual.hxx>
 
 #include <Prs3d_ShadingAspect.hxx>
 
 #include <vtkActorCollection.h>
 #include <vtkProperty.h>
 
+#include <Basics_OCCTVersion.hxx>
 // CORBA Headers
 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 
 
 #include <TColStd_HArray1OfByte.hxx>
 
+#include "vtkSMSourceProxy.h"
+#include "pqServerManagerModel.h"
+#include "vtkPVTrivialProducer.h"
+#include "vtkSMViewProxy.h"
+
+#if OCC_VERSION_LARGE >= 0x070400ff
+#include <Image_SupportedFormats.hxx>
+#endif
+
 // If the next macro is defined, autocolor feature works for all sub-shapes;
 // if it is undefined, autocolor feature works for groups only
 #define GENERAL_AUTOCOLOR
 
 // Hard-coded value of shape deflection coefficient for VTK viewer
 const double VTK_MIN_DEFLECTION = 0.001;
+// If the next macro is defined, the deflection coefficient for VTK presentation
+// is limited by VTK_MIN_DEFLECTION
+//#define LIMIT_DEFLECTION_FOR_VTK
 
 // Pixmap caching support
 namespace
@@ -163,7 +199,7 @@ namespace
     if ( aPixmap.IsNull() ) {
       QPixmap px(":images/default_texture.png");
       if ( !px.isNull() )
-       aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage() );
+        aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage() );
     }
     return aPixmap;
   }
@@ -234,8 +270,15 @@ namespace
       if ( aAISShape.IsNull() )
         continue;
 
-#ifdef USE_TEXTURED_SHAPE
-      const Handle(Image_PixMap)& aPixmap = aAISShape->TexturePixMap();
+      const Handle(Graphic3d_TextureMap)& aTexture = aAISShape->Attributes()->ShadingAspect()->Aspect()->TextureMap();
+      if ( aTexture.IsNull() )
+        continue;
+#if OCC_VERSION_LARGE >= 0x070400ff
+      Handle(Image_SupportedFormats) aFormats = new Image_SupportedFormats();
+      const Handle(Image_PixMap)& aPixmap = aTexture->GetImage(aFormats);
+#else
+      const Handle(Image_PixMap)& aPixmap = aTexture->GetImage();
+#endif
       if ( aPixmap.IsNull() )
         continue;
 
@@ -250,7 +293,6 @@ namespace
         aPixmapUsersMap.UnBind( aPixmap );
         aPixmapCacheMap.remove( aPixmapCacheMap.key( aPixmap ) );
       }
-#endif
     }
   }
 
@@ -381,7 +423,7 @@ SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode )
 //================================================================
 SUIT_SelectionFilter* GEOM_Displayer::getComplexFilter( const QList<int>* aSubShapes)
 {
-  GEOM_CompoundFilter* aFilter;
+  GEOM_CompoundFilter* aFilter = 0;
 
   if(aSubShapes != NULL ) {
     aFilter = new GEOM_CompoundFilter(getStudy());
@@ -455,15 +497,13 @@ static std::string getName( GEOM::GEOM_BaseObject_ptr object )
  *  Constructor
  */
 //=================================================================
-GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
+GEOM_Displayer::GEOM_Displayer()
+  : myUpdateColorScale(true), myIsRedisplayed( false )
 {
-  if( st )
-    myApp = dynamic_cast<SalomeApp_Application*>( st->application() );
-  else
-    myApp = 0;
+  SUIT_Session* session = SUIT_Session::session();
+  myApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
 
   /* Shading Color */
-  SUIT_Session* session = SUIT_Session::session();
   SUIT_ResourceMgr* resMgr = session->resourceMgr();
 
   QColor col = resMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
@@ -473,34 +513,33 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
   myHasDisplayMode = false;
 
   int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS);
-  myWidth = resMgr->integerValue("Geometry", "edge_width", -1);
-  myIsosWidth = resMgr->integerValue("Geometry", "isolines_width", -1);
   
-  myTransparency = resMgr->integerValue("Geometry", "transparency", 0) / 100.;
-  myHasTransparency = false;
-
   myTypeOfMarker = (Aspect_TypeOfMarker)(std::min((int)Aspect_TOM_RING3, std::max((int)Aspect_TOM_POINT, aType)));
   myScaleOfMarker = (resMgr->integerValue("Geometry", "marker_scale", 1)-(int)GEOM::MS_10)*0.5 + 1.0;
   myScaleOfMarker = std::min(7.0, std::max(1., myScaleOfMarker));
 
+  // Next properties provide a way to customize displaying of presentations;
+  // for instance, this is useful for preview
   myColor = -1;
-  // This color is used for shape displaying. If it is equal -1 then
-  // default color is used.
   myTexture = "";
-
+  myNbIsos = -1;
   myWidth = -1;
+  myTransparency = -1;
   myType = -1;
+  myIsosColor = -1;
+  myIsosWidth = -1;
+
+  // This parameter is used for activisation/deactivisation (selection) of objects to be displayed
   myToActivate = true;
-  // This parameter is used for activisation/deactivisation of objects to be displayed
 
-  // Activate parallel vizualisation only for testing purpose
-  // and if the corresponding env variable is set to 1
-  char* parallel_visu = getenv("PARALLEL_VISU");
-  if (parallel_visu && atoi(parallel_visu))
-  {
-    MESSAGE("Parallel visualisation on");
-    BRepMesh_IncrementalMesh::SetParallelDefault(Standard_True);
-  }
+  // Activate parallel vizualisation by default.
+  // It can be switched OFF via the environment variable:
+  //     export PARALLEL_VISU=0
+  Standard_Boolean parallel_visu = Standard_True;
+  char* parallel_visu_env = getenv("PARALLEL_VISU");
+  if (parallel_visu_env && atoi(parallel_visu_env) == 0)
+    parallel_visu = Standard_False;
+  BRepMesh_IncrementalMesh::SetParallelDefault(parallel_visu);
 
   myViewFrame = 0;
 
@@ -627,6 +666,8 @@ void GEOM_Displayer::Redisplay( const Handle(SALOME_InteractiveObject)& theIO,
                                 const bool updateViewer,
                                 const bool checkActiveViewer )
 {
+  bool aRedisplayed = myIsRedisplayed;
+  myIsRedisplayed = true;
   // Remove the object permanently (<forced> == true)
   SUIT_Session* ses = SUIT_Session::session();
   SUIT_Application* app = ses->activeApplication();
@@ -656,6 +697,7 @@ void GEOM_Displayer::Redisplay( const Handle(SALOME_InteractiveObject)& theIO,
       }
     }
   }
+  myIsRedisplayed = aRedisplayed;
 }
 
 //=================================================================
@@ -675,8 +717,23 @@ void GEOM_Displayer::Redisplay( const Handle(SALOME_InteractiveObject)& theIO,
     return;
   }
 
+  bool aRedisplayed = myIsRedisplayed;
+  myIsRedisplayed = true;
   Erase( theIO, true, false, theViewFrame );
   Display( theIO, theUpdateViewer, theViewFrame );
+  myIsRedisplayed = aRedisplayed;
+  // hide annotations for erased presentation
+  SUIT_Session* session = SUIT_Session::session();
+  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
+  GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
+  if ( aModule ) {
+    if ( !theViewFrame->isVisible( theIO ) ) {
+      aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(theIO->getEntry()), dynamic_cast<SOCC_Viewer*>( theViewFrame ));
+    }
+    else {
+      aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(theIO->getEntry()), dynamic_cast<SOCC_Viewer*>( theViewFrame ));
+    }
+  }
 }
 
 //=================================================================
@@ -705,7 +762,7 @@ void GEOM_Displayer::UpdateVisibility( SALOME_View* v, const SALOME_Prs* p, bool
     QString entry = p->GetEntry();
     if ( !entry.isEmpty() ) {
       if ( vId != -1 )
-       aStudy->setObjectProperty( vId, entry, GEOM::propertyName( GEOM::Visibility ), on );
+        aStudy->setObjectProperty( vId, entry, GEOM::propertyName( GEOM::Visibility ), on );
       setVisibilityState( entry, on ? Qtx::ShownState : Qtx::HiddenState );
     }
   }
@@ -755,7 +812,7 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
   else if ( !myName.empty() ) {
     // workaround to allow selection of temporary objects
     static int tempId = 0;
-    anIO = new SALOME_InteractiveObject( QString( "TEMP_%1" ).arg( tempId++ ).toLatin1().data(), "GEOM", myName.c_str() );
+    anIO = new SALOME_InteractiveObject( QString( "TEMP_%1" ).arg( tempId++ ).toUtf8().data(), "GEOM", myName.c_str() );
     AISShape->setIO( anIO );
     AISShape->SetOwner( anIO );
   }
@@ -770,7 +827,7 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
   int aMgrId = !anIO.IsNull() ? getViewManagerId( myViewFrame ) : -1;
 
   // get presentation properties
-  PropMap propMap = getObjectProperties( study, entry, myViewFrame );
+  PropMap propMap = getObjectProperties( entry, myViewFrame );
 
   // Temporary staff: vertex must be infinite for correct visualization
   AISShape->SetInfiniteState( myShape.Infinite() ); // || myShape.ShapeType() == TopAbs_VERTEX // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines)
@@ -809,16 +866,20 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
   AISShape->Attributes()->SetLineAspect( anAspect );
   
   // - unfree boundaries color
-  anAspect = AISShape->Attributes()->UnFreeBoundaryAspect();
-  anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() : 
+  Handle(Prs3d_LineAspect) aUnFreeBoundaryAspect =
+    new Prs3d_LineAspect (Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0);
+  *aUnFreeBoundaryAspect->Aspect() = *AISShape->Attributes()->UnFreeBoundaryAspect()->Aspect();
+  aUnFreeBoundaryAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
                       SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::WireframeColor ) ).value<QColor>() ) );
-  AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect );
+  AISShape->Attributes()->SetUnFreeBoundaryAspect( aUnFreeBoundaryAspect );
   
   // - free boundaries color
-  anAspect = AISShape->Attributes()->FreeBoundaryAspect();
-  anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() : 
+  Handle(Prs3d_LineAspect) aFreeBoundaryAspect =
+    new Prs3d_LineAspect (Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0);
+  *aFreeBoundaryAspect->Aspect() = *AISShape->Attributes()->FreeBoundaryAspect()->Aspect();
+  aFreeBoundaryAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() : 
                       SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::FreeBndColor ) ).value<QColor>() ) );
-  AISShape->Attributes()->SetFreeBoundaryAspect( anAspect );
+  AISShape->Attributes()->SetFreeBoundaryAspect( aFreeBoundaryAspect );
   
   // - standalone edges color
   anAspect = AISShape->Attributes()->WireAspect();
@@ -829,18 +890,21 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
   // - color for edges in shading+edges mode
   AISShape->SetEdgesInShadingColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>() ) );
 
+  // - color of labels (textual fields and shape name)
+  AISShape->SetLabelColor( qColorFromResources( "label_color", QColor( 255, 255, 255 ) ) );
+
   // set display mode
-  AISShape->SetDisplayMode( HasDisplayMode() ? 
-                            // predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function 
-                            GetDisplayMode() :
-                            // display mode from properties
-                            propMap.value( GEOM::propertyName( GEOM::DisplayMode ) ).toInt() );
-
-  // - face boundaries color
-  if( AISShape->DisplayMode() == GEOM_AISShape::ShadingWithEdges )
-    AISShape->Attributes()->SetFaceBoundaryDraw( Standard_True );
+  int displayMode = HasDisplayMode() ? 
+    // predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function 
+    GetDisplayMode() :
+    // display mode from properties
+    propMap.value( GEOM::propertyName( GEOM::DisplayMode ) ).toInt();
+  AISShape->SetDisplayMode( displayMode );
+
+  // - face boundaries color and line width
   anAspect = AISShape->Attributes()->FaceBoundaryAspect();
   anAspect->SetColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>() ) );
+  anAspect->SetWidth( HasWidth() ? GetWidth() : propMap.value( GEOM::propertyName( GEOM::LineWidth ) ).toInt() );
   AISShape->Attributes()->SetFaceBoundaryAspect( anAspect );
 
   // set display vectors flag
@@ -850,6 +914,10 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
   bool isVerticesMode = propMap.value( GEOM::propertyName( GEOM::Vertices ) ).toBool();
   AISShape->SetDisplayVertices( isVerticesMode );
 
+  // set display name flag
+  bool isNameMode = propMap.value( GEOM::propertyName( GEOM::ShowName ) ).toBool();
+  AISShape->SetDisplayName( isNameMode );
+
   // set transparency
   if( HasTransparency() ) {
     AISShape->SetTransparency( GetTransparency() );
@@ -864,12 +932,34 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
   int isosWidth = propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt();
   Handle(Prs3d_IsoAspect) uIsoAspect = AISShape->Attributes()->UIsoAspect();
   Handle(Prs3d_IsoAspect) vIsoAspect = AISShape->Attributes()->VIsoAspect();
-  uIsoAspect->SetColor( isosColor );
-  uIsoAspect->SetWidth( isosWidth );
-  uIsoAspect->SetNumber( uIsos );
-  vIsoAspect->SetColor( isosColor );
-  vIsoAspect->SetWidth( isosWidth );
-  vIsoAspect->SetNumber( vIsos );
+
+  if ( HasIsosColor() ) {
+    uIsoAspect->SetColor( (Quantity_NameOfColor)GetIsosColor() );
+    vIsoAspect->SetColor( (Quantity_NameOfColor)GetIsosColor() );
+  }
+  else {
+    uIsoAspect->SetColor( isosColor );
+    vIsoAspect->SetColor( isosColor );
+  }
+
+  if ( HasIsosWidth() ) {
+    uIsoAspect->SetWidth( GetIsosWidth() );
+    vIsoAspect->SetWidth( GetIsosWidth() );
+  }
+  else {
+    uIsoAspect->SetWidth( isosWidth );
+    vIsoAspect->SetWidth( isosWidth );
+  }
+  
+  if ( HasNbIsos() ) {
+    uIsoAspect->SetNumber( GetNbIsos() );
+    vIsoAspect->SetNumber( GetNbIsos() );
+  }
+  else {
+    uIsoAspect->SetNumber( uIsos );
+    vIsoAspect->SetNumber( vIsos );
+  }
+
   AISShape->Attributes()->SetUIsoAspect( uIsoAspect );
   AISShape->Attributes()->SetVIsoAspect( vIsoAspect );
 
@@ -884,14 +974,14 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
     aImagePath = GetTexture().c_str();
     if ( ! entry.isEmpty() ) {
       // check that study is active
-      SalomeApp_Study* study = getActiveStudy();
+      SalomeApp_Study* study = getStudy();
       if ( study ) {
         // Store the texture in object properties for next displays
         study->setObjectProperty( aMgrId, entry, GEOM::propertyName( GEOM::Texture ), QString( GetTexture().c_str() ) );
         study->setObjectProperty( aMgrId, entry, GEOM::propertyName( GEOM::DisplayMode ), 3 );
         
-        // Update propeties map
-        propMap = getObjectProperties( study, entry, myViewFrame );
+        // Update properties map
+        propMap = getObjectProperties( entry, myViewFrame );
       }
     }
   }
@@ -899,7 +989,6 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
     aImagePath = propMap.value( GEOM::propertyName( GEOM::Texture ) ).toString();
   }
 
-#ifdef USE_TEXTURED_SHAPE
   Handle(Image_PixMap) aPixmap;
   if ( !aImagePath.isEmpty() )
     aPixmap = cacheTextureFor( aImagePath, AISShape );
@@ -908,14 +997,12 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
 
   // apply image to shape
   if ( !aPixmap.IsNull() ) {
-    AISShape->SetTexturePixMap( aPixmap );
-    AISShape->SetTextureMapOn();
-    AISShape->DisableTextureModulate();
+    AISShape->Attributes()->ShadingAspect()->Aspect()->SetTextureMap( new Graphic3d_Texture2Dmanual( aPixmap ) );
   }
-  else {
-    AISShape->SetTextureMapOff();
-  }
-#endif
+  if ( displayMode == GEOM_AISShape::TexturedShape )
+    AISShape->Attributes()->ShadingAspect()->Aspect()->SetTextureMapOn();
+  else
+    AISShape->Attributes()->ShadingAspect()->Aspect()->SetTextureMapOff();
 
   // set line width
   AISShape->SetWidth( HasWidth() ?
@@ -949,13 +1036,13 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
       int textureId = aList[0].toInt();
       Standard_Integer aWidth, aHeight;
       Handle(TColStd_HArray1OfByte) aTexture =
-        GeometryGUI::getTexture( study, textureId, aWidth, aHeight );
+        GeometryGUI::getTexture( textureId, aWidth, aHeight );
       if ( !aTexture.IsNull() ) {
         Handle(Prs3d_PointAspect) aTextureAspect =
           new Prs3d_PointAspect( HasColor() ? 
-                                // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
-                                (Quantity_NameOfColor)GetColor() : 
-                                // color from properties 
+                                 // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
+                                 (Quantity_NameOfColor)GetColor() : 
+                                 // color from properties 
                                  SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ),
                                  aWidth, aHeight,
                                  aTexture );
@@ -1000,7 +1087,7 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
   else if ( !myName.empty() ) {
     // workaround to allow selection of temporary objects
     static int tempId = 0;
-    anIO = new SALOME_InteractiveObject( QString( "TEMP_VTK_%1" ).arg( tempId++ ).toLatin1().data(), "GEOM", myName.c_str() );
+    anIO = new SALOME_InteractiveObject( QString( "TEMP_VTK_%1" ).arg( tempId++ ).toUtf8().data(), "GEOM", myName.c_str() );
     actor->setIO( anIO );
   }
 
@@ -1012,7 +1099,7 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
   int aMgrId = !anIO.IsNull() ? getViewManagerId( myViewFrame ) : -1;
 
   // get presentation properties
-  PropMap propMap = getObjectProperties( study, entry, myViewFrame );
+  PropMap propMap = getObjectProperties( entry, myViewFrame );
   QColor c;
 
   /////////////////////////////////////////////////////////////////////////
@@ -1021,7 +1108,11 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
   // actor->SetShape(myShape,aDefPropMap.value(GEOM::propertyName( GEOM::Deflection )).toDouble(),myType == GEOM_VECTOR);
   /////////////////////////////////////////////////////////////////////////
   if ( !actor->getTopo().IsSame( myShape ) )
+#ifdef LIMIT_DEFLECTION_FOR_VTK
     actor->SetShape( myShape, VTK_MIN_DEFLECTION, myType == GEOM_VECTOR );
+#else
+    actor->SetShape( myShape, qMax( propMap.value( GEOM::propertyName( GEOM::Deflection ) ).toDouble(), GEOM::minDeflection() ), myType == GEOM_VECTOR );
+#endif
 
   // set material
   Material_Model material;
@@ -1035,16 +1126,25 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
 
   // - set number of iso-lines
   int nbIsos[2]= { 1, 1 };
-  QStringList isos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() );
-  nbIsos[0] = isos[0].toInt();
-  nbIsos[1] = isos[1].toInt();
+  if ( HasNbIsos() ) {
+    nbIsos[0] = GetNbIsos();
+    nbIsos[1] = GetNbIsos();
+  }
+  else {
+    QStringList isos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() );
+    nbIsos[0] = isos[0].toInt();
+    nbIsos[1] = isos[1].toInt();
+  }
   actor->SetNbIsos( nbIsos );
 
   // - set iso-lines width
-  actor->SetIsosWidth( propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt() );
+  actor->SetIsosWidth( HasIsosWidth() ? GetIsosWidth() : propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt() );
 
   // - set iso-lines color
-  c = propMap.value( GEOM::propertyName( GEOM::IsosColor ) ).value<QColor>();
+  if ( HasIsosColor() )
+    c = SalomeApp_Tools::color( Quantity_Color((Quantity_NameOfColor)GetIsosColor()) );
+  else
+    c = propMap.value( GEOM::propertyName( GEOM::IsosColor ) ).value<QColor>();
   actor->SetIsosColor( c.redF(), c.greenF(), c.blueF() );
 
   // set colors
@@ -1083,6 +1183,10 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
   c = propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>();
   actor->SetEdgesInShadingColor( c.redF(), c.greenF(), c.blueF() );
 
+  // - color of labels (shape name)
+  c = colorFromResources( "label_color", QColor( 255, 255, 255 ) );
+  actor->SetLabelColor( c.redF(), c.greenF(), c.blueF() );
+
   // set opacity
   if( HasTransparency() ) {
     actor->SetOpacity( 1.0 - GetTransparency() );
@@ -1103,6 +1207,9 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
   // set display vertices flag
   actor->SetVerticesMode( propMap.value( GEOM::propertyName( GEOM::Vertices ) ).toBool() );
 
+  // set display name flag
+  actor->SetNameMode( propMap.value( GEOM::propertyName( GEOM::ShowName ) ).toBool() );
+
   // set display mode
   int displayMode = HasDisplayMode() ? 
     // predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function 
@@ -1183,11 +1290,12 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
 
   QColor  aQColor       = aResMgr->colorValue  ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) );
   int     aLineWidth    = aResMgr->integerValue( "Geometry", "dimensions_line_width", 1 );
-  double  aFontHeight   = aResMgr->doubleValue ( "Geometry", "dimensions_font_height", 10 );
+  QFont   aFont         = aResMgr->fontValue   ( "Geometry", "dimensions_font", QFont("Y14.5M-2009", 14) );
   double  anArrowLength = aResMgr->doubleValue ( "Geometry", "dimensions_arrow_length", 5 );
   bool    isUnitsShown  = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false );
   QString aUnitsLength  = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" );
   QString aUnitsAngle   = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" );
+  bool    aUseText3d    = aResMgr->booleanValue( "Geometry", "dimensions_use_text3d", false );
 
   // restore dimension presentation from saved attribute or property data
   AIS_ListOfInteractive aRestoredDimensions;
@@ -1205,7 +1313,7 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
   }
   else
   {
-    aRecords.LoadFromAttribute( getStudy(), theIO->getEntry() );
+    aRecords.LoadFromAttribute( theIO->getEntry() );
   }
   
   // create up-to-date dimension presentations
@@ -1253,10 +1361,12 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
 
     aStyle->SetCommonColor( aColor );
     aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
-    aStyle->MakeText3d( Standard_True );
+    aStyle->MakeText3d( aUseText3d );
     aStyle->MakeTextShaded( Standard_True );
-    aStyle->SetExtensionSize( aFontHeight * 0.5 );
-    aStyle->TextAspect()->SetHeight( aFontHeight );
+    int fsize = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize();
+    aStyle->SetExtensionSize( fsize * 0.5 );
+    aStyle->TextAspect()->SetFont( aFont.family().toLatin1().data() );
+    aStyle->TextAspect()->SetHeight( fsize );
     aStyle->ArrowAspect()->SetLength( anArrowLength );
     aStyle->LineAspect()->SetWidth( aLineWidth );
     aStyle->SetTextHorizontalPosition( aPrs->DimensionAspect()->TextHorizontalPosition() );
@@ -1273,12 +1383,21 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
       if ( aUnitsAngle == "deg" )
       {
         aPrs->SetSpecialSymbol(0xB0);
+#if OCC_VERSION_LARGE >= 0x070400ff
+        aPrs->SetDisplaySpecialSymbol( isUnitsShown ? PrsDim_DisplaySpecialSymbol_After :
+                                                      PrsDim_DisplaySpecialSymbol_No );
+#else
         aPrs->SetDisplaySpecialSymbol( isUnitsShown ? AIS_DSS_After : AIS_DSS_No );
+#endif
         aStyle->MakeUnitsDisplayed(Standard_False);
       }
       else
       {
+#if OCC_VERSION_LARGE >= 0x070400ff
+        aPrs->SetDisplaySpecialSymbol(PrsDim_DisplaySpecialSymbol_No);
+#else
         aPrs->SetDisplaySpecialSymbol(AIS_DSS_No);
+#endif
         aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
       }
     }
@@ -1360,7 +1479,7 @@ void GEOM_Displayer::Redisplay( const SALOME_ListIO& theIOList,
 //=================================================================
 /*!
  *  GEOM_Displayer::Update
- *  Update OCC presentaion
+ *  Update OCC presentation
  *  [ Reimplemented from SALOME_Displayer ]
  */
 //=================================================================
@@ -1495,7 +1614,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
 //=================================================================
 /*!
  *  GEOM_Displayer::Update
- *  Update VTK presentaion
+ *  Update VTK presentation
  *  [ Reimplemented from SALOME_Displayer ]
  */
 //=================================================================
@@ -1596,10 +1715,48 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
   }
 }
 
+//=================================================================
+/*!
+ *  GEOM_Displayer::Update
+ *  Update PV3D presentation
+ *  [ Reimplemented from SALOME_Displayer ]
+ */
+//=================================================================
+void GEOM_Displayer::Update( SALOME_PV3DPrs* prs )
+{
+  SPV3D_Prs* pv3dPrs = dynamic_cast<SPV3D_Prs*>( prs );
+
+  SalomeApp_Study* study = getStudy();
+
+  if ( !pv3dPrs || myShape.IsNull() || !study )
+    return;
+
+  if ( myType == GEOM_MARKER && myShape.ShapeType() == TopAbs_FACE )
+  {
+    // 
+    // specific processing for local coordinate system presentation
+    // 
+    // NYI - Update(PV3DPrs) for the local coordinate system
+  }
+  else
+  {
+    // 
+    // processing for usual geometry presentation
+    // 
+    {
+      pv3dPrs->SetName( myNameInObjBrowser );
+      GEOM_Actor *actor = GEOM_Actor::New();
+      updateActorProperties( actor, true );
+      pv3dPrs->FillUsingActor( actor );
+    }
+  }
+}
+
+
 //=================================================================
 /*!
  *  GEOM_Displayer::BuildPrs
- *  Build presentation accordint to the current viewer type
+ *  Build presentation according to the current viewer type
  */
 //=================================================================
 SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj )
@@ -1628,7 +1785,7 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj )
 //=================================================================
 /*!
  *  GEOM_Displayer::BuildPrs
- *  Build presentation accordint to the current viewer type
+ *  Build presentation according to the current viewer type
  */
 //=================================================================
 SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape )
@@ -1672,54 +1829,51 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry,
     if ( prs )
     {
       Handle( SALOME_InteractiveObject ) theIO = new SALOME_InteractiveObject();
-      theIO->setEntry( entry.toLatin1().constData() );
+      theIO->setEntry( entry.toUtf8().constData() );
       if ( !theIO.IsNull() )
       {
         // set interactive object
         setIO( theIO );
         //  Find SOBject (because shape should be published previously)
-        SUIT_Session* session = SUIT_Session::session();
-        SUIT_Application* app = session->activeApplication();
-        if ( app )
+        if ( getStudy() )
         {
-          SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
-          if ( study )
+          _PTR(SObject) SO ( getStudy()->studyDS()->FindObjectID( theIO->getEntry() ) );
+          if ( SO ) //GeometryGUI::IsInGeomComponent( SO ))
           {
-            _PTR(SObject) SO ( study->studyDS()->FindObjectID( theIO->getEntry() ) );
-            if ( SO )
+            // get CORBA reference to data object
+            CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
+            if ( !CORBA::is_nil( object ) )
             {
-              // get CORBA reference to data object
-              CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
-              if ( !CORBA::is_nil( object ) )
+              // downcast to GEOM base object
+              GEOM::GEOM_BaseObject_var GeomBaseObject = GEOM::GEOM_BaseObject::_narrow( object );
+              if ( !GeomBaseObject->_is_nil() )
               {
-                // downcast to GEOM base object
-                GEOM::GEOM_BaseObject_var GeomBaseObject = GEOM::GEOM_BaseObject::_narrow( object );
-                if ( !GeomBaseObject->_is_nil() )
-                {
-                  myType = GeomBaseObject->GetType();
+                myNameInObjBrowser = getName( GeomBaseObject );
+                myType = GeomBaseObject->GetType();
 
-                  // downcast to GEOM object
-                  GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( GeomBaseObject );
-                  if ( myType == GEOM_FIELD_STEP )
+                // downcast to GEOM object
+                GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( GeomBaseObject );
+                if ( myType == GEOM_FIELD_STEP )
+                {
+                  // get the GEOM object from the field's shape
+                  GEOM::GEOM_FieldStep_var GeomFieldStep = GEOM::GEOM_FieldStep::_narrow( GeomBaseObject );
+                  if ( !GeomFieldStep->_is_nil() )
                   {
-                    // get the GEOM object from the field's shape
-                    GEOM::GEOM_FieldStep_var GeomFieldStep = GEOM::GEOM_FieldStep::_narrow( GeomBaseObject );
-                    if ( !GeomFieldStep->_is_nil() )
-                    {
-                      GEOM::GEOM_Field_var GeomField = GeomFieldStep->GetField();
-                      if ( !GeomField->_is_nil() )
-                        GeomObject = GeomField->GetShape();
-                    }
-
-                    // read the field step information
-                    readFieldStepInfo( GeomFieldStep );
+                    GEOM::GEOM_Field_var GeomField = GeomFieldStep->GetField();
+                    if ( !GeomField->_is_nil() )
+                      GeomObject = GeomField->GetShape();
                   }
 
-                  if ( !GeomObject->_is_nil() )
-                  {
+                  // read the field step information
+                  readFieldStepInfo( GeomFieldStep );
+                }
+
+                if ( !GeomObject->_is_nil() )
+                {
+                    CORBA::String_var name = GeomObject->GetName();
+                    theIO->setName( name );
                     // finally set shape
                     setShape( GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) );
-                  }
                 }
               }
             }
@@ -1755,7 +1909,7 @@ SALOME_Prs* GEOM_Displayer::buildSubshapePresentation(const TopoDS_Shape& aShape
     if (prs)
     {
       Handle(SALOME_InteractiveObject) theIO = new SALOME_InteractiveObject();
-      theIO->setEntry(entry.toLatin1().constData());
+      theIO->setEntry(entry.toUtf8().constData());
       if (!theIO.IsNull())
       {
         // set interactive object
@@ -1895,27 +2049,26 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
   if ( theModes.Contains( GEOM_ALLOBJECTS ) )
     return;
 
-  SUIT_SelectionFilter* aFilter;
-  if ( theModes.Extent() == 1 )
-    {
-      int aMode = TColStd_MapIteratorOfMapOfInteger( theModes ).Key();
-
-      if ( aMode == GEOM_COMPOUNDFILTER )
-        aFilter = getComplexFilter( theSubShapes );
-      else
-        aFilter = getFilter( aMode );
-    }
-  else if ( theModes.Extent() > 1 )
+  SUIT_SelectionFilter* aFilter = NULL;
+  if ( theModes.Extent() > 0 )
     {
       TColStd_MapOfInteger aTopAbsModes;
       TColStd_MapIteratorOfMapOfInteger anIter( theModes );
       QList<SUIT_SelectionFilter*> aListOfFilters;
       for ( ; anIter.More(); anIter.Next() )
         {
-          SUIT_SelectionFilter* aFilter;
+          SUIT_SelectionFilter* aFilter = 0;
           int aMode = anIter.Key();
           if ( aMode == GEOM_COMPOUNDFILTER )
             aFilter = getComplexFilter( theSubShapes );
+          if ( aMode == GEOM_COMPOUND ) {
+            // always add COMPSOLID filter together with COMPOUND filter
+            aFilter = new GEOM_TypeFilter( getStudy(), TopAbs_COMPSOLID, true );
+            aListOfFilters.append( aFilter );
+
+            // add the COMPOUND filter itself
+            aFilter = getFilter( aMode );
+          }
           else
             aFilter = getFilter( aMode );
 
@@ -1923,7 +2076,8 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
             aListOfFilters.append( aFilter );
         }
 
-      aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR );
+      if (aListOfFilters.size() > 1)
+        aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR );
     }
   else
     return;
@@ -1982,15 +2136,27 @@ void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* )
     Handle(AIS_InteractiveContext) ic = vf->getAISContext();
     if ( !ic.IsNull() )
     {
-      if ( ic->HasOpenedContext() )
-      ic->CloseAllContexts();
+      ic->Deactivate();
+      ic->Activate( 0 );
     }
   }
 }
 
 void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p )
 {
-  UpdateColorScale(false,false);
+  UpdateColorScale();
+
+  // visualize annotations for displayed presentation
+  SUIT_Session* session = SUIT_Session::session();
+  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
+  GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
+  if ( aModule ) {
+    if ( !myIsRedisplayed ) {
+      aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(p->GetEntry()), dynamic_cast<SOCC_Viewer*>( v ));
+    } else {
+      aModule->GetAnnotationMgr()->UpdateVisibleAnnotations(QString(p->GetEntry()), dynamic_cast<SOCC_Viewer*>( v ));
+    }
+  }
 }
 
 void GEOM_Displayer::BeforeErase( SALOME_View* v, const SALOME_OCCPrs* p )
@@ -2002,7 +2168,16 @@ void GEOM_Displayer::BeforeErase( SALOME_View* v, const SALOME_OCCPrs* p )
 void GEOM_Displayer::AfterErase( SALOME_View* v, const SALOME_OCCPrs* p )
 {
   LightApp_Displayer::AfterErase( v, p );
-  UpdateColorScale(false,false);
+  UpdateColorScale();
+
+  if ( !myIsRedisplayed ) {
+    // hide annotations for erased presentation
+    SUIT_Session* session = SUIT_Session::session();
+    SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
+    GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
+    if ( aModule )
+      aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(p->GetEntry()), dynamic_cast<SOCC_Viewer*>( v ));
+  }
 }
 
 //=================================================================
@@ -2050,15 +2225,9 @@ void GEOM_Displayer::UnsetColor()
 //=================================================================
 double GEOM_Displayer::SetTransparency( const double transparency )
 {
-  double aPrevTransparency = myTransparency;
-  if ( transparency < 0 ) {
-    UnsetTransparency();
-  }
-  else {
-    myTransparency = transparency;
-    myHasTransparency = true;
-  }
-  return aPrevTransparency;
+  double prevTransparency = myTransparency;
+  myTransparency = transparency;
+  return prevTransparency;
 }
 
 //=================================================================
@@ -2080,7 +2249,7 @@ double GEOM_Displayer::GetTransparency() const
 //=================================================================
 bool GEOM_Displayer::HasTransparency() const
 {
-  return myHasTransparency;
+  return myTransparency >= 0;
 }
 
 //=================================================================
@@ -2091,27 +2260,17 @@ bool GEOM_Displayer::HasTransparency() const
 //=================================================================
 double GEOM_Displayer::UnsetTransparency()
 {
-  double aPrevTransparency = myTransparency;
-  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
-  myTransparency = resMgr->integerValue("Geometry", "transparency", 0) / 100.;
-  myHasTransparency = false;
-  return aPrevTransparency;
+  return SetTransparency( -1 );
 }
 
-
 //=================================================================
 /*!
  *  GEOM_Displayer::SetTexture
- *  Set color for shape displaying. If it is equal -1 then default color is used.
- *  Available values are from Quantity_NameOfColor enumeration
  */
 //=================================================================
 void GEOM_Displayer::SetTexture( const std::string& texureFileName )
 {
-  if(texureFileName!="")
-  {
-    myTexture = texureFileName;
-  }
+  myTexture = texureFileName;
 }
 
 bool GEOM_Displayer::HasTexture() const
@@ -2150,7 +2309,6 @@ void GEOM_Displayer::UnsetWidth()
   myWidth = -1;
 }
 
-
 int GEOM_Displayer::GetIsosWidth() const
 {
   return myIsosWidth;
@@ -2166,6 +2324,49 @@ bool GEOM_Displayer::HasIsosWidth() const
   return myIsosWidth != -1;
 }
 
+int GEOM_Displayer::SetNbIsos( const int nbIsos )
+{
+  int prevNbIsos = myNbIsos;
+  myNbIsos = nbIsos;
+  return prevNbIsos;
+}
+
+int GEOM_Displayer::UnsetNbIsos()
+{
+  return SetNbIsos( -1 );
+}
+
+int GEOM_Displayer::GetNbIsos() const
+{
+  return myNbIsos;
+}
+
+bool GEOM_Displayer::HasNbIsos() const
+{
+  return myNbIsos >= 0;
+}
+
+int GEOM_Displayer::SetIsosColor( const int color )
+{
+  int prevColor = myIsosColor;
+  myIsosColor = color;
+  return prevColor;
+}
+
+int GEOM_Displayer::GetIsosColor() const
+{
+  return myIsosColor;
+}
+
+bool GEOM_Displayer::HasIsosColor() const
+{
+  return myIsosColor != -1;
+}
+
+int GEOM_Displayer::UnsetIsosColor()
+{
+  return SetIsosColor( -1 );
+}
 
 //=================================================================
 /*!
@@ -2244,12 +2445,17 @@ void GEOM_Displayer::setFieldStepInfo( const GEOM::field_data_type theFieldDataT
 
 bool GEOM_Displayer::canBeDisplayed( const QString& entry, const QString& viewer_type ) const
 {
-  _PTR(SObject) anObj = getStudy()->studyDS()->FindObjectID( (const char*)entry.toLatin1() );
-  GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM objects
-  GEOM::GEOM_FieldStep_var aFieldStepObj = GEOM::GEOM_FieldStep::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM field steps
-  GEOM::GEOM_Gen_var aCompObj = GEOM::GEOM_Gen::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of whole GEOM component
-  return ( !CORBA::is_nil( aGeomObj ) || !CORBA::is_nil( aFieldStepObj ) || !CORBA::is_nil( aCompObj ) ) &&
-         (viewer_type == SOCC_Viewer::Type() || viewer_type == SVTK_Viewer::Type());
+  _PTR(SObject) anObj = getStudy()->studyDS()->FindObjectID( (const char*)entry.toUtf8() );
+  //if ( ! GeometryGUI::IsInGeomComponent( anObj )) return false;
+  CORBA::Object_var anOrbObj = GeometryGUI::ClientSObjectToObject(anObj);
+  bool isCorbaObj = (!CORBA::is_nil(anOrbObj));
+  GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(anOrbObj); // enable displaying of GEOM objects
+  GEOM::GEOM_FieldStep_var aFieldStepObj = GEOM::GEOM_FieldStep::_narrow(anOrbObj); // enable displaying of GEOM field steps
+  GEOM::GEOM_Gen_var aCompObj = GEOM::GEOM_Gen::_narrow(anOrbObj); // enable displaying of whole GEOM component
+  bool isGeomObj = (!CORBA::is_nil( aGeomObj ) || !CORBA::is_nil( aFieldStepObj ) || !CORBA::is_nil( aCompObj ));
+  bool ret = ( isGeomObj ) &&
+         (viewer_type == SOCC_Viewer::Type() || viewer_type == SVTK_Viewer::Type() || viewer_type == SPV3D_ViewModel::Type());
+  return ret;
 }
 
 int GEOM_Displayer::SetDisplayMode( const int theMode )
@@ -2372,21 +2578,20 @@ SALOMEDS::Color GEOM_Displayer::getUniqueColor( const QList<SALOMEDS::Color>& th
   return aSColor;
 }
 
-PropMap GEOM_Displayer::getObjectProperties( SalomeApp_Study* study,
-                                             const QString& entry,
+PropMap GEOM_Displayer::getObjectProperties( const QString& entry,
                                              SALOME_View* view )
 {
   // get default properties for the explicitly specified default view type
   PropMap propMap = GEOM_Displayer::getDefaultPropertyMap();
 
-  if ( study && view ) {
+  if ( getStudy() && view ) {
     SUIT_ViewModel* viewModel = dynamic_cast<SUIT_ViewModel*>( view );
     SUIT_ViewManager* viewMgr = ( viewModel != 0 ) ? viewModel->getViewManager() : 0;
     int viewId = ( viewMgr != 0 ) ? viewMgr->getGlobalId() : -1;
   
     if ( viewModel && viewId != -1 ) {
       // get properties from the study
-      PropMap storedMap = study->getObjectProperties( viewId, entry );
+      PropMap storedMap = getStudy()->getObjectProperties( viewId, entry );
       // overwrite default properties from stored ones (that are specified)
       for ( int prop = GEOM::Visibility; prop <= GEOM::LastProperty; prop++ ) {
         if ( storedMap.contains( GEOM::propertyName( (GEOM::Property)prop ) ) )
@@ -2406,8 +2611,8 @@ PropMap GEOM_Displayer::getObjectProperties( SalomeApp_Study* study,
 
       if ( !entry.isEmpty() ) {
         // get CORBA reference to geom object
-        _PTR(SObject) SO( study->studyDS()->FindObjectID( entry.toStdString() ) );
-        if ( SO ) {
+        _PTR(SObject) SO( getStudy()->studyDS()->FindObjectID( entry.toStdString() ) );
+        if ( SO ) { //GeometryGUI::IsInGeomComponent( SO )) {
           CORBA::Object_var object = GeometryGUI::ClientSObjectToObject( SO );
           if ( !CORBA::is_nil( object ) ) {
             GEOM::GEOM_Object_var geomObject = GEOM::GEOM_Object::_narrow( object );
@@ -2474,7 +2679,7 @@ PropMap GEOM_Displayer::getDefaultPropertyMap()
 
   // - transparency (opacity = 1-transparency)
   propMap.insert( GEOM::propertyName( GEOM::Transparency ),
-                 resMgr->integerValue( "Geometry", "transparency", 0 ) / 100. );
+                  resMgr->integerValue( "Geometry", "transparency", 0 ) / 100. );
 
   // - display mode (take default value from preferences)
   propMap.insert( GEOM::propertyName( GEOM::DisplayMode ),
@@ -2486,6 +2691,9 @@ PropMap GEOM_Displayer::getDefaultPropertyMap()
   // - show vertices flag (false by default)
   propMap.insert( GEOM::propertyName( GEOM::Vertices ), false );
 
+  // - show name flag (false by default)
+  propMap.insert( GEOM::propertyName( GEOM::ShowName ), false );
+
   // - shading color (take default value from preferences)
   propMap.insert( GEOM::propertyName( GEOM::ShadingColor ),
                   colorFromResources( "shading_color", QColor( 255, 255, 0 ) ) );
@@ -2559,38 +2767,40 @@ SALOMEDS::Color GEOM_Displayer::getColor(GEOM::GEOM_Object_var theGeomObject, bo
       aSColor = theGeomObject->GetColor();
       hasColor = aSColor.R >= 0 && aSColor.G >= 0 && aSColor.B >= 0;
       if ( !hasColor ) {
+        if (!theGeomObject->IsMainShape()) {
 #ifdef GENERAL_AUTOCOLOR // auto-color for all sub-shapes
-        bool general_autocolor = true;
+          bool general_autocolor = true;
 #else                    // auto-color for groups only
-        bool general_autocolor = false;
+          bool general_autocolor = false;
 #endif                   // GENERAL_AUTOCOLOR
-        if ( general_autocolor || theGeomObject->GetType() == GEOM_GROUP ) {
-          GEOM::GEOM_Object_var aMainObject = theGeomObject->GetMainShape();
-          if ( !CORBA::is_nil( aMainObject ) && aMainObject->GetAutoColor() ) {
+          if ( general_autocolor || theGeomObject->GetType() == GEOM_GROUP ) {
+            GEOM::GEOM_Object_var aMainObject = theGeomObject->GetMainShape();
+            if ( !CORBA::is_nil( aMainObject ) && aMainObject->GetAutoColor() ) {
 #ifdef SIMPLE_AUTOCOLOR  // simplified algorithm for auto-colors
-            aSColor = getPredefinedUniqueColor();
-            hasColor = true;
+              aSColor = getPredefinedUniqueColor();
+              hasColor = true;
 #else                    // old algorithm  for auto-colors
-            QList<SALOMEDS::Color> aReservedColors;
-            CORBA::String_var IOR = app->orb()->object_to_string( aMainObject );
-            _PTR(SObject) aMainSObject( aStudy->FindObjectIOR( IOR.in() ) );
-            if ( aMainSObject ) {
-              _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) );
-              for ( ; it->More(); it->Next() ) {
-                _PTR(SObject) aChildSObject( it->Value() );
-                GEOM::GEOM_Object_var aChildObject =
-                  GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aChildSObject));
-                if ( CORBA::is_nil( aChildObject ) )
-                  continue;
-
-                SALOMEDS::Color aReservedColor = aChildObject->GetColor();
-                if ( aReservedColor.R >= 0 && aReservedColor.G >= 0 && aReservedColor.B >= 0 )
-                  aReservedColors.append( aReservedColor );
+              QList<SALOMEDS::Color> aReservedColors;
+              CORBA::String_var IOR = app->orb()->object_to_string( aMainObject );
+              _PTR(SObject) aMainSObject( aStudy->FindObjectIOR( IOR.in() ) );
+              if ( aMainSObject ) {
+                _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) );
+                for ( ; it->More(); it->Next() ) {
+                  _PTR(SObject) aChildSObject( it->Value() );
+                  GEOM::GEOM_Object_var aChildObject =
+                    GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aChildSObject));
+                  if ( CORBA::is_nil( aChildObject ) )
+                    continue;
+
+                  SALOMEDS::Color aReservedColor = aChildObject->GetColor();
+                  if ( aReservedColor.R >= 0 && aReservedColor.G >= 0 && aReservedColor.B >= 0 )
+                    aReservedColors.append( aReservedColor );
+                }
               }
-            }
-            aSColor = getUniqueColor( aReservedColors );
-            hasColor = true;
+              aSColor = getUniqueColor( aReservedColors );
+              hasColor = true;
 #endif                   // SIMPLE_AUTOCOLOR
+            }
           }
         }
       }
@@ -2601,16 +2811,9 @@ SALOMEDS::Color GEOM_Displayer::getColor(GEOM::GEOM_Object_var theGeomObject, bo
 
 
 void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& theIO,
-                                       const bool eraseOnlyChildren) {
-  SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
-  if ( !app )
-    return;
-
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
-  if ( !appStudy )
-    return;
-
-  LightApp_DataObject* parent = appStudy->findObjectByEntry(theIO->getEntry());
+                                       const bool eraseOnlyChildren)
+{
+  LightApp_DataObject* parent = getStudy()->findObjectByEntry(theIO->getEntry());
 
   if( !parent)
     return;
@@ -2618,7 +2821,7 @@ void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& t
   // Erase from all views
   QList<SALOME_View*> views;
   SALOME_View* view;
-  ViewManagerList vmans = app->viewManagers();
+  ViewManagerList vmans = myApp->viewManagers();
   SUIT_ViewManager* vman;
   foreach ( vman, vmans ) {
     SUIT_ViewModel* vmod = vman->getViewModel();
@@ -2638,7 +2841,7 @@ void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& t
     if(l_obj)
       foreach ( view, views ) {
       Handle(SALOME_InteractiveObject) anIO =
-        new SALOME_InteractiveObject(qPrintable(l_obj->entry()), "GEOM", "");
+        new SALOME_InteractiveObject(qUtf8Printable(l_obj->entry()), "GEOM", "");
       Erase(anIO, false, false, view);
     }
   }
@@ -2784,7 +2987,10 @@ QList<QVariant> GEOM_Displayer::groupFieldData( const QList<QVariant>& theFieldS
             aValue = double( aVariant.toLongLong() );
           else if( aVariant.type() == QVariant::Double )
             aValue = aVariant.toDouble();
-          aNorm += aValue * aValue;
+          if ( theFieldNbComponents > 1 )
+            aNorm += aValue * aValue;
+          else
+            aNorm += aValue;
         }
       }
     }
@@ -2795,7 +3001,7 @@ QList<QVariant> GEOM_Displayer::groupFieldData( const QList<QVariant>& theFieldS
     {
       if( anIsBoolean )
         aNorm /= theFieldNbComponents;
-      else
+      else if ( theFieldNbComponents > 1 )
         aNorm = pow( aNorm, 0.5 );
 
       if( aGroupedList.isEmpty() )
@@ -2830,7 +3036,7 @@ QList<QVariant> GEOM_Displayer::groupFieldData( const QList<QVariant>& theFieldS
     {
       QColor aQColor;
       Quantity_Color aColor;
-      if( FindColor( aVariant.toDouble(), theFieldStepRangeMin, theFieldStepRangeMax, anIsBoolean ? 2 : aNbIntervals, aColor ) )
+      if( AIS_ColorScale::FindColor( aVariant.toDouble(), theFieldStepRangeMin, theFieldStepRangeMax, anIsBoolean ? 2 : aNbIntervals, aColor ) )
         aQColor = QColor::fromRgbF( aColor.Red(), aColor.Green(), aColor.Blue() );
       aResultList << aQColor;
     }
@@ -2838,187 +3044,91 @@ QList<QVariant> GEOM_Displayer::groupFieldData( const QList<QVariant>& theFieldS
   return aResultList;
 }
 
-// Note: the method is copied from Aspect_ColorScale class
-Standard_Integer GEOM_Displayer::HueFromValue( const Standard_Integer aValue,
-                                               const Standard_Integer aMin,
-                                               const Standard_Integer aMax )
+void GEOM_Displayer::UpdateColorScale() 
 {
-  Standard_Integer minLimit( 0 ), maxLimit( 230 );
-
-  Standard_Integer aHue = maxLimit;
-  if ( aMin != aMax )
-    aHue = (Standard_Integer)( maxLimit - ( maxLimit - minLimit ) * ( aValue - aMin ) / ( aMax - aMin ) );
-
-  aHue = Min( Max( minLimit, aHue ), maxLimit );
-
-  return aHue;
-}
-
-// Note: the method is copied from Aspect_ColorScale class
-Standard_Boolean GEOM_Displayer::FindColor( const Standard_Real aValue, 
-                                            const Standard_Real aMin,
-                                            const Standard_Real aMax,
-                                            const Standard_Integer ColorsCount,
-                                            Quantity_Color& aColor )
-{
-  if( aValue<aMin || aValue>aMax || aMax<aMin )
-    return Standard_False;
-
-  else
-  {
-    Standard_Real IntervNumber = 0;
-    if( aValue<aMin )
-      IntervNumber = 0;
-    else if( aValue>aMax )
-      IntervNumber = ColorsCount-1;
-    else if( Abs( aMax-aMin ) > Precision::Approximation() )
-      IntervNumber = Floor( Standard_Real( ColorsCount ) * ( aValue - aMin ) / ( aMax - aMin ) ); // 'Ceiling' replaced with 'Floor'
-
-    Standard_Integer Interv = Standard_Integer( IntervNumber );
-
-    aColor = Quantity_Color( HueFromValue( Interv, 0, ColorsCount - 1 ), 1.0, 1.0, Quantity_TOC_HLS );
-
-    return Standard_True;
-  } 
-}
-
-void GEOM_Displayer::UpdateColorScale( const bool theIsRedisplayFieldSteps, const bool updateViewer ) 
-{
-  SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
-  if( !aStudy )
+  if ( !myUpdateColorScale )
     return;
 
-  SOCC_Viewer* aViewModel = dynamic_cast<SOCC_Viewer*>( GetActiveView() );
-  if( !aViewModel )
-    return;
-
-  Handle(V3d_Viewer) aViewer = aViewModel->getViewer3d();
-  if( aViewer.IsNull() )
-    return;
-
-  aViewer->InitActiveViews();
-  if( !aViewer->MoreActiveViews() )
-    return;
-
-  Handle(V3d_View) aView = aViewer->ActiveView();
-  if( aView.IsNull() )
-    return;
+  SUIT_Session* session = SUIT_Session::session();
+  SUIT_Application* app = session->activeApplication();
+  if ( !app ) return;
 
-  Standard_Boolean anIsDisplayColorScale = Standard_False;
-  TCollection_AsciiString aColorScaleTitle;
-  Standard_Real aColorScaleMin = 0, aColorScaleMax = 0;
-  Standard_Boolean anIsBoolean = Standard_False;
+  Handle(SALOME_InteractiveObject) io = myApp->selectionMgr()->soleSelectedObject();
 
-  SALOME_ListIO aSelectedObjects;
-  myApp->selectionMgr()->selectedObjects( aSelectedObjects );
-  if( aSelectedObjects.Extent() == 1 )
+  QList<SUIT_ViewWindow*> windows = app->desktop()->windows();
+  foreach( SUIT_ViewWindow* window, windows )
   {
-    Handle(SALOME_InteractiveObject) anIO = aSelectedObjects.First();
-    if( !anIO.IsNull() )
+    OCCViewer_ViewWindow* occWindow = dynamic_cast<OCCViewer_ViewWindow*>( window );
+    if ( !occWindow ) continue;
+    if ( !occWindow->getViewManager() ) continue;
+    if ( !window->getViewManager() ) continue;
+    if ( !window->getViewManager()->getViewModel() ) continue;
+    SOCC_Viewer* view = dynamic_cast<SOCC_Viewer*>( window->getViewManager()->getViewModel() );
+    if ( !view ) continue;
+    Handle(V3d_Viewer) viewer = view->getViewer3d();
+    if ( !io.IsNull() && view->isVisible( io ) )
     {
-      SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>( aViewModel->CreatePrs( anIO->getEntry() ) );
-      if( aPrs )
+      bool visible = false;
+      SOCC_Prs* prs = dynamic_cast<SOCC_Prs*>( view->CreatePrs( io->getEntry() ) );
+      if ( prs )
       {
-        AIS_ListOfInteractive aList;
-        aPrs->GetObjects( aList );
-        AIS_ListIteratorOfListOfInteractive anIter( aList );
-        for( ; anIter.More(); anIter.Next() )
+        AIS_ListOfInteractive presentations;
+        prs->GetObjects( presentations );
+        AIS_ListIteratorOfListOfInteractive iter( presentations );
+        for ( ; iter.More(); iter.Next() )
         {
-          Handle(GEOM_AISShape) aShape = Handle(GEOM_AISShape)::DownCast( anIter.Value() );
-          if( !aShape.IsNull() )
+          Handle(GEOM_AISShape) shape = Handle(GEOM_AISShape)::DownCast( iter.Value() );
+          if ( shape.IsNull() ) continue;
+          GEOM::field_data_type fieldDataType;
+          int fieldDimension;
+          QList<QVariant> fieldStepData;
+          TCollection_AsciiString fieldStepName;
+          Standard_Real fieldStepRangeMin, fieldStepRangeMax;
+          shape->getFieldStepInfo( fieldDataType, fieldDimension, fieldStepData,
+                                   fieldStepName, fieldStepRangeMin,  fieldStepRangeMax );
+          visible = !fieldStepData.isEmpty() && fieldDataType != GEOM::FDT_String;
+          if ( visible )
           {
-            GEOM::field_data_type aFieldDataType;
-            int aFieldDimension;
-            QList<QVariant> aFieldStepData;
-            TCollection_AsciiString aFieldStepName;
-            double aFieldStepRangeMin, aFieldStepRangeMax;
-            aShape->getFieldStepInfo( aFieldDataType,
-                                      aFieldDimension,
-                                      aFieldStepData,
-                                      aFieldStepName,
-                                      aFieldStepRangeMin,
-                                      aFieldStepRangeMax );
-            if( !aFieldStepData.isEmpty() && aFieldDataType != GEOM::FDT_String )
-            {
-              anIsDisplayColorScale = Standard_True;
-              aColorScaleTitle = aFieldStepName;
-              aColorScaleMin = aFieldStepRangeMin;
-              aColorScaleMax = aFieldStepRangeMax;
-              anIsBoolean = aFieldDataType == GEOM::FDT_Bool;
-            }
-          }
+            SUIT_Session* session = SUIT_Session::session();
+            SUIT_ResourceMgr* resMgr = session->resourceMgr();
+            
+            Standard_Real xPos = resMgr->doubleValue( "Geometry", "scalar_bar_x_position", 0.05 );
+            Standard_Real yPos = resMgr->doubleValue( "Geometry", "scalar_bar_y_position", 0.1 );
+            Standard_Real width = resMgr->doubleValue( "Geometry", "scalar_bar_width", 0.2 );
+            Standard_Real height = resMgr->doubleValue( "Geometry", "scalar_bar_height", 0.5 );
+            Standard_Integer textHeight = resMgr->integerValue( "Geometry", "scalar_bar_text_height", 14 );
+            Standard_Integer nbIntervals = resMgr->integerValue( "Geometry", "scalar_bar_nb_intervals", 20 );
+            
+            Standard_Integer viewWidth = 0, viewHeight = 0;
+            occWindow->getView(0)->getViewPort()->getView()->Window()->Size( viewWidth, viewHeight );
+            
+            Handle(AIS_ColorScale) colorScale = view->getColorScale();
+            
+            colorScale->SetPosition( viewWidth * xPos, viewHeight * yPos );
+            colorScale->SetBreadth( viewWidth * width );
+            colorScale->SetHeight( viewHeight * height );
+            colorScale->SetRange( fieldStepRangeMin, fieldStepRangeMax );
+            colorScale->SetNumberOfIntervals( fieldDataType == GEOM::FDT_Bool ? 2 : nbIntervals );
+            colorScale->SetTextHeight( textHeight );
+            colorScale->SetTitle( fieldStepName );
+          } // if ( visible )
         }
       }
-    }
-  }
-
-  if( anIsDisplayColorScale )
-  {
-    Handle(Aspect_ColorScale) aColorScale = aView->ColorScale();
-    if( !aColorScale.IsNull() )
+      view->setColorScaleShown( visible );
+    } // if ( view->isVisible( io ) )
+    else
     {
-      SUIT_Session* session = SUIT_Session::session();
-      SUIT_ResourceMgr* resMgr = session->resourceMgr();
-
-      Standard_Real anXPos = resMgr->doubleValue( "Geometry", "scalar_bar_x_position", 0.05 );
-      Standard_Real anYPos = resMgr->doubleValue( "Geometry", "scalar_bar_y_position", 0.1 );
-      Standard_Real aWidth = resMgr->doubleValue( "Geometry", "scalar_bar_width", 0.2 );
-      Standard_Real aHeight = resMgr->doubleValue( "Geometry", "scalar_bar_height", 0.5 );
-      Standard_Integer aTextHeight = resMgr->integerValue( "Geometry", "scalar_bar_text_height", 14 );
-      Standard_Integer aNbIntervals = resMgr->integerValue( "Geometry", "scalar_bar_nb_intervals", 20 );
-      aColorScale->SetXPosition( anXPos );
-      aColorScale->SetYPosition( anYPos );
-      aColorScale->SetWidth( aWidth );
-      aColorScale->SetHeight( aHeight );
-
-      aColorScale->SetTextHeight( aTextHeight );
-      aColorScale->SetNumberOfIntervals( anIsBoolean ? 2 : aNbIntervals );
-
-      aColorScale->SetTitle( aColorScaleTitle );
-      aColorScale->SetRange( aColorScaleMin, aColorScaleMax );
+      view->setColorScaleShown( false );
     }
-    if( !aView->ColorScaleIsDisplayed() )
-      aView->ColorScaleDisplay();
-  }
-  else
-  {
-    if( aView->ColorScaleIsDisplayed() )
-      aView->ColorScaleErase();
-  }
+  } // foreach( SUIT_ViewWindow* window, windows )
+}
 
-  if( theIsRedisplayFieldSteps )
-  {
-    _PTR(Study) aStudyDS = aStudy->studyDS();
-    QList<SUIT_ViewManager*> vmList;
-    myApp->viewManagers( vmList );
-    for( QList<SUIT_ViewManager*>::Iterator vmIt = vmList.begin(); vmIt != vmList.end(); vmIt++ )
-    {
-      if( SUIT_ViewManager* aViewManager = *vmIt )
-      {
-        const ObjMap& anObjects = aStudy->getObjectProperties( aViewManager->getGlobalId() );
-        for( ObjMap::ConstIterator objIt = anObjects.begin(); objIt != anObjects.end(); objIt++ )
-        {
-          _PTR(SObject) aSObj( aStudyDS->FindObjectID( objIt.key().toLatin1().constData() ) );
-          if( aSObj )
-          {
-            CORBA::Object_var anObject = GeometryGUI::ClientSObjectToObject( aSObj );
-            if( !CORBA::is_nil( anObject ) )
-            {
-              GEOM::GEOM_FieldStep_var aFieldStep = GEOM::GEOM_FieldStep::_narrow( anObject );
-              if( !aFieldStep->_is_nil() )
-              {
-                CORBA::String_var aStepEntry = aFieldStep->GetStudyEntry();
-                Handle(SALOME_InteractiveObject) aStepIO =
-                  new SALOME_InteractiveObject( aStepEntry.in(), "GEOM", "TEMP_IO" );
-                Redisplay( aStepIO, false, false );
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-  if(updateViewer)
-    UpdateViewer();
+bool GEOM_Displayer::SetUpdateColorScale( bool toUpdate ) // IPAL54049
+{
+  bool previous = myUpdateColorScale;
+  myUpdateColorScale = toUpdate;
+  if ( myUpdateColorScale && !previous )
+    UpdateColorScale();
+  return previous;
 }
+