Salome HOME
0021189: [CEA 451] areCoordsInside implementation in GE
[modules/geom.git] / src / GEOMGUI / GeometryGUI.cxx
index 29b73920917965e8505f65c1acb1dad263540233..b62c782b632db44510d08be8d9eaad1986486fb5 100644 (file)
@@ -19,9 +19,9 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// GEOM GEOMGUI : GUI for Geometry component
-// File   : GeometryGUI.cxx
-// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//  GEOM GEOMGUI : GUI for Geometry component
+//  File   : GeometryGUI.cxx
+//  Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 
 #include <Standard_math.hxx>  // E.A. must be included before Python.h to fix compilation on windows
 #include "Python.h"
@@ -151,6 +151,17 @@ SALOMEDS::Study_var GeometryGUI::ClientStudyToStudy (_PTR(Study) theStudy)
   return aDSStudy._retn();
 }
 
+void GeometryGUI::Modified( bool theIsUpdateActions )
+{
+  if( SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() ) ) {
+    if( SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) ) {
+      appStudy->Modified();
+      if( theIsUpdateActions )
+        app->updateActions();
+    }
+  }
+}
+
 //=======================================================================
 // function : GeometryGUI::GeometryGUI()
 // purpose  : Constructor
@@ -359,6 +370,9 @@ void GeometryGUI::OnGUIEvent( int id )
   QString libName;
   // find corresponding GUI library
   switch ( id ) {
+  case GEOMOp::OpOriginAndVectors: // MENU BASIC - ORIGIN AND BASE VECTORS
+    createOriginAndBaseVectors(); // internal operation
+    return;
   case GEOMOp::OpImport:           // MENU FILE - IMPORT
   case GEOMOp::OpExport:           // MENU FILE - EXPORT
   case GEOMOp::OpSelectVertex:     // POPUP MENU - SELECT ONLY - VERTEX
@@ -374,7 +388,11 @@ void GeometryGUI::OnGUIEvent( int id )
   case GEOMOp::OpDeflection:       // POPUP MENU - DEFLECTION COEFFICIENT
   case GEOMOp::OpColor:            // POPUP MENU - COLOR
   case GEOMOp::OpTransparency:     // POPUP MENU - TRANSPARENCY
+  case GEOMOp::OpIncrTransparency: // SHORTCUT   - INCREASE TRANSPARENCY
+  case GEOMOp::OpDecrTransparency: // SHORTCUT   - DECREASE TRANSPARENCY
   case GEOMOp::OpIsos:             // POPUP MENU - ISOS
+  case GEOMOp::OpIncrNbIsos:       // SHORTCUT   - INCREASE NB ISOS
+  case GEOMOp::OpDecrNbIsos:       // SHORTCUT   - DECREASE NB ISOS
   case GEOMOp::OpAutoColor:        // POPUP MENU - AUTO COLOR
   case GEOMOp::OpNoAutoColor:      // POPUP MENU - DISABLE AUTO COLOR
   case GEOMOp::OpShowChildren:     // POPUP MENU - SHOW CHILDREN
@@ -403,7 +421,7 @@ void GeometryGUI::OnGUIEvent( int id )
   case GEOMOp::OpVector:           // MENU BASIC - VECTOR
   case GEOMOp::OpPlane:            // MENU BASIC - PLANE
   case GEOMOp::OpCurve:            // MENU BASIC - CURVE
-  case GEOMOp::OpLCS:              // MENU BASIC - REPAIR
+  case GEOMOp::OpLCS:              // MENU BASIC - LOCAL COORDINATE SYSTEM
     libName = "BasicGUI";
     break;
   case GEOMOp::OpBox:              // MENU PRIMITIVE - BOX
@@ -473,6 +491,7 @@ void GeometryGUI::OnGUIEvent( int id )
   case GEOMOp::OpFreeFaces:        // MENU MEASURE - FREE FACES
   case GEOMOp::OpOrientation:      // MENU REPAIR - CHANGE ORIENTATION
   case GEOMOp::OpGlueFaces:        // MENU REPAIR - GLUE FACES
+  case GEOMOp::OpLimitTolerance:   // MENU REPAIR - LIMIT TOLERANCE
   case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES
     libName = "RepairGUI";
     break;
@@ -569,23 +588,54 @@ void GeometryGUI::OnMousePress( SUIT_ViewWindow* w, QMouseEvent* e )
 // function : createGeomAction
 // purpose  :
 //=======================================================================
-void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel, const int accel, const bool toggle  )
+void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel, 
+                                   const int accel, const bool toggle, const QString& shortcutAction )
 {
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
   QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false )
                                     : resMgr->loadPixmap( "GEOM", tr( icolabel.toLatin1().constData() ) );
   createAction( id,
-                tr( QString( "TOP_%1" ).arg( label ).toLatin1().constData() ),
-                icon,
-                tr( QString( "MEN_%1" ).arg( label ).toLatin1().constData() ),
-                tr( QString( "STB_%1" ).arg( label ).toLatin1().constData() ),
-                accel,
-                application()->desktop(),
-                toggle,
-                this, SLOT( OnGUIEvent() )  );
+               tr( QString( "TOP_%1" ).arg( label ).toLatin1().constData() ),
+               icon,
+               tr( QString( "MEN_%1" ).arg( label ).toLatin1().constData() ),
+               tr( QString( "STB_%1" ).arg( label ).toLatin1().constData() ),
+               accel,
+               application()->desktop(),
+               toggle,
+               this, SLOT( OnGUIEvent() ),
+               shortcutAction );
 }
 
-
+//=======================================================================
+// function : createOriginAndBaseVectors
+// purpose  :
+//=======================================================================
+void GeometryGUI::createOriginAndBaseVectors()
+{
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
+  if( appStudy ) {
+    _PTR(Study) studyDS = appStudy->studyDS();
+    if( studyDS && !CORBA::is_nil( GetGeomGen() ) ) {
+      GEOM::GEOM_IBasicOperations_var aBasicOperations = GetGeomGen()->GetIBasicOperations( studyDS->StudyId() );
+      if( !aBasicOperations->_is_nil() ) {
+        SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+        double aLength = aResourceMgr->doubleValue( "Geometry", "base_vectors_length", 1.0 );
+        GEOM::GEOM_Object_var anOrigin = aBasicOperations->MakePointXYZ( 0.0, 0.0, 0.0 );
+        GEOM::GEOM_Object_var anOX = aBasicOperations->MakeVectorDXDYDZ( aLength, 0.0, 0.0 );
+        GEOM::GEOM_Object_var anOY = aBasicOperations->MakeVectorDXDYDZ( 0.0, aLength, 0.0 );
+        GEOM::GEOM_Object_var anOZ = aBasicOperations->MakeVectorDXDYDZ( 0.0, 0.0, aLength );
+
+        SALOMEDS::Study_var aDSStudy = ClientStudyToStudy( studyDS );
+        GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOrigin, "O" );
+        GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOX, "OX" );
+        GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOY, "OY" );
+        GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOZ, "OZ" );
+
+        getApp()->updateObjectBrowser( false );
+      }
+    }
+  }
+}
 
 //=======================================================================
 // function : GeometryGUI::initialize()
@@ -611,6 +661,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpVector,     "VECTOR" );
   createGeomAction( GEOMOp::OpPlane,      "PLANE" );
   createGeomAction( GEOMOp::OpLCS,        "LOCAL_CS" );
+  createGeomAction( GEOMOp::OpOriginAndVectors, "ORIGIN_AND_VECTORS" );
 
   createGeomAction( GEOMOp::OpBox,        "BOX" );
   createGeomAction( GEOMOp::OpCylinder,   "CYLINDER" );
@@ -674,6 +725,7 @@ void GeometryGUI::initialize( CAM_Application* app )
 
   createGeomAction( GEOMOp::OpSewing,           "SEWING" );
   createGeomAction( GEOMOp::OpGlueFaces,        "GLUE_FACES" );
+  createGeomAction( GEOMOp::OpLimitTolerance,   "LIMIT_TOLERANCE" );
   createGeomAction( GEOMOp::OpSuppressFaces,    "SUPPRESS_FACES" );
   createGeomAction( GEOMOp::OpSuppressHoles,    "SUPPERSS_HOLES" );
   createGeomAction( GEOMOp::OpShapeProcess,     "SHAPE_PROCESS" );
@@ -735,6 +787,19 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpPointMarker,      "POP_POINT_MARKER" );
 
   createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
+  
+  // Create actions for increase/decrease transparency shortcuts
+  createGeomAction( GEOMOp::OpIncrTransparency, "", "", 0, false, 
+                   "Geometry:Increase transparency");
+  createGeomAction( GEOMOp::OpDecrTransparency, "", "", 0, false, 
+                   "Geometry:Decrease transparency");
+
+  // Create actions for increase/decrease number of isolines
+  createGeomAction( GEOMOp::OpIncrNbIsos, "", "", 0, false, 
+                   "Geometry:Increase number of isolines");
+  createGeomAction( GEOMOp::OpDecrNbIsos, "", "", 0, false, 
+                   "Geometry:Decrease number of isolines");
+
 //   createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
   //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
 
@@ -762,6 +827,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpVector,  basicId, -1 );
   createMenu( GEOMOp::OpPlane,   basicId, -1 );
   createMenu( GEOMOp::OpLCS,     basicId, -1 );
+  createMenu( GEOMOp::OpOriginAndVectors, basicId, -1 );
 
   int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 );
   createMenu( GEOMOp::OpBox,       primId, -1 );
@@ -859,6 +925,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpSuppressHoles,   repairId, -1 );
   createMenu( GEOMOp::OpSewing,          repairId, -1 );
   createMenu( GEOMOp::OpGlueFaces,       repairId, -1 );
+  createMenu( GEOMOp::OpLimitTolerance,  repairId, -1 );
   createMenu( GEOMOp::OpAddPointOnEdge,  repairId, -1 );
   //createMenu( GEOMOp::OpFreeBoundaries,  repairId, -1 );
   //createMenu( GEOMOp::OpFreeFaces,       repairId, -1 );
@@ -930,6 +997,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createTool( GEOMOp::OpVector,  basicTbId );
   createTool( GEOMOp::OpPlane,   basicTbId );
   createTool( GEOMOp::OpLCS,     basicTbId );
+  createTool( GEOMOp::OpOriginAndVectors, basicTbId );
 
   int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) );
   createTool( GEOMOp::OpBox,       primTbId );
@@ -1056,7 +1124,8 @@ void GeometryGUI::initialize( CAM_Application* app )
   mgr->insert( action(  GEOMOp::OpDeflection ), -1, -1 ); // deflection
   mgr->setRule( action( GEOMOp::OpDeflection ), "selcount>0 and isVisible and client='OCCViewer'", QtxPopupMgr::VisibleRule );
   mgr->insert( action(  GEOMOp::OpPointMarker ), -1, -1 ); // point marker
-  mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg( GEOM_POINT ), QtxPopupMgr::VisibleRule );
+  //mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg(GEOM_POINT ), QtxPopupMgr::VisibleRule );
+  mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and ( $typeid in {%1} or compoundOfVertices=true ) " ).arg(GEOM::VERTEX).arg(GEOM::COMPOUND), QtxPopupMgr::VisibleRule );
   mgr->insert( separator(), -1, -1 );     // -----------
   mgr->insert( action(  GEOMOp::OpAutoColor ), -1, -1 ); // auto color
   mgr->setRule( action( GEOMOp::OpAutoColor ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule );
@@ -1137,7 +1206,7 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
     PyErr_Print();
   else
     {
-      PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"geom","New Entity","Other");
+      PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"geom",tr("MEN_NEW_ENTITY").toStdString().c_str(),tr("GEOM_PLUGINS_OTHER").toStdString().c_str());
       if(result==NULL)
         PyErr_Print();
       Py_XDECREF(result);
@@ -1198,6 +1267,20 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
   if ( viewMenu )
     connect( viewMenu, SIGNAL( aboutToShow() ), this, SLOT( onViewAboutToShow() ) );
 
+  // 0020836 (Basic vectors and origin)
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+  if( aResourceMgr->booleanValue( "Geometry", "auto_create_base_objects", false ) ) {
+    SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
+    if( appStudy ) {
+      _PTR(Study) studyDS = appStudy->studyDS();
+      if( studyDS ) {
+        _PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM");
+        if( !aSComponent ) // create objects automatically only if there is no GEOM component
+          createOriginAndBaseVectors();
+      }
+    }
+  }
+
   return true;
 }
 
@@ -1460,21 +1543,21 @@ void GeometryGUI::createPreferences()
   const int nbQuantities = 8;
   int prec[nbQuantities], ii = 0;
   prec[ii++] = addPreference( tr( "GEOM_PREF_length_precision" ), precGroup,
-                            LightApp_Preferences::IntSpin, "Geometry", "length_precision" );
+                             LightApp_Preferences::IntSpin, "Geometry", "length_precision" );
   prec[ii++] = addPreference( tr( "GEOM_PREF_angle_precision" ), precGroup,
-                            LightApp_Preferences::IntSpin, "Geometry", "angle_precision" );
+                              LightApp_Preferences::IntSpin, "Geometry", "angle_precision" );
   prec[ii++] = addPreference( tr( "GEOM_PREF_len_tol_precision" ), precGroup,
-                            LightApp_Preferences::IntSpin, "Geometry", "len_tol_precision" );
+                              LightApp_Preferences::IntSpin, "Geometry", "len_tol_precision" );
   prec[ii++] = addPreference( tr( "GEOM_PREF_ang_tol_precision" ), precGroup,
-                            LightApp_Preferences::IntSpin, "Geometry", "ang_tol_precision" );
+                              LightApp_Preferences::IntSpin, "Geometry", "ang_tol_precision" );
   prec[ii++] = addPreference( tr( "GEOM_PREF_weight_precision" ), precGroup,
-                            LightApp_Preferences::IntSpin, "Geometry", "weight_precision" );
+                              LightApp_Preferences::IntSpin, "Geometry", "weight_precision" );
   prec[ii++] = addPreference( tr( "GEOM_PREF_density_precision" ), precGroup,
-                            LightApp_Preferences::IntSpin, "Geometry", "density_precision" );
+                             LightApp_Preferences::IntSpin, "Geometry", "density_precision" );
   prec[ii++] = addPreference( tr( "GEOM_PREF_parametric_precision" ), precGroup,
-                            LightApp_Preferences::IntSpin, "Geometry", "parametric_precision" );
+                              LightApp_Preferences::IntSpin, "Geometry", "parametric_precision" );
   prec[ii  ] = addPreference( tr( "GEOM_PREF_param_tol_precision" ), precGroup,
-                            LightApp_Preferences::IntSpin, "Geometry", "param_tol_precision" );
+                             LightApp_Preferences::IntSpin, "Geometry", "param_tol_precision" );
 
   // Set property for precision value for spinboxes
   for ( ii = 0; ii < nbQuantities; ii++ ){
@@ -1541,6 +1624,18 @@ void GeometryGUI::createPreferences()
 
   setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
   setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
+
+  int originGroup = addPreference( tr( "PREF_GROUP_ORIGIN_AND_BASE_VECTORS" ), tabId );
+  setPreferenceProperty( originGroup, "columns", 2 );
+
+  int baseVectorsLength = addPreference( tr( "PREF_BASE_VECTORS_LENGTH" ), originGroup,
+                                         LightApp_Preferences::DblSpin, "Geometry", "base_vectors_length" );
+  setPreferenceProperty( baseVectorsLength, "min", 0.01 );
+  setPreferenceProperty( baseVectorsLength, "max", 1000 );
+
+  addPreference( tr( "PREF_AUTO_CREATE" ), originGroup,
+                 LightApp_Preferences::Bool, "Geometry", "auto_create_base_objects" );
+
 }
 
 void GeometryGUI::preferencesChanged( const QString& section, const QString& param )
@@ -1596,164 +1691,87 @@ void GeometryGUI::storeVisualParameters (int savePoint)
                                                              componentName.c_str(),
                                                              savePoint);
   _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
-
-  // viewers counters are used for storing view_numbers in IParameters
-  int vtkViewers(0), occViewers(0);
-
+  
   QList<SUIT_ViewManager*> lst;
   QList<SUIT_ViewManager*>::Iterator it;
 
   // main cycle to store parameters of displayed objects
   lst.clear();
-  vtkViewers = occViewers = 0;
   getApp()->viewManagers(lst);
-  for (it = lst.begin(); it != lst.end(); it++)
-  {
+  for (it = lst.begin(); it != lst.end(); it++) {
     SUIT_ViewManager* vman = *it;
     QString vType = vman->getType();
-
+    int aMgrId = vman->getGlobalId();
     // saving VTK actors properties
-    if (vType == SVTK_Viewer::Type())
-    {
-      QVector<SUIT_ViewWindow*> views = vman->getViews();
-      for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++)
-      {
-        if (SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>(views[i]))
-        {
-          vtkActorCollection* allActors = vtkView->getRenderer()->GetActors();
-          allActors->InitTraversal();
-          while (vtkActor* actor = allActors->GetNextActor())
-          {
-            if (actor->GetVisibility()) // store only visible actors
-            {
-              GEOM_Actor* aGeomActor = 0;
-              if (actor->IsA("GEOM_Actor"))
-                aGeomActor = GEOM_Actor::SafeDownCast(actor);
-              if (aGeomActor && aGeomActor->hasIO())
-              {
-                Handle(SALOME_InteractiveObject) io = aGeomActor->getIO();
-                if (io->hasEntry())
-                {
-                  // entry is "encoded" = it does NOT contain component adress, since it is a
-                  // subject to change on next component loading
-                  std::string entry = ip->encodeEntry(io->getEntry(), componentName);
-
-                  std::string param, occParam = vType.toLatin1().data();
-                  occParam += gSeparator;
-                  occParam += QString::number(vtkViewers).toLatin1().data();
-                  occParam += gSeparator;
-
-                  param = occParam + "Visibility";
-                  ip->setParameter(entry, param, "On");
-
-                  param = occParam + "DisplayMode";
-                  ip->setParameter(entry, param, QString::number
-                                   (aGeomActor->getDisplayMode()).toLatin1().data());
-
-                  vtkFloatingPointType r, g, b;
-                  aGeomActor->GetColor(r, g, b);
-                  QString colorStr = QString::number(r);
-                  colorStr += gDigitsSep; colorStr += QString::number(g);
-                  colorStr += gDigitsSep; colorStr += QString::number(b);
-                  param = occParam + "Color";
-                  ip->setParameter(entry, param, colorStr.toLatin1().data());
-
-                  param = occParam + "Opacity";
-                  ip->setParameter(entry, param, QString::number(aGeomActor->GetOpacity()).toLatin1().data());
-
-                  int nbUIso(0), nbVIso(0);
-                  aGeomActor->GetNbIsos(nbUIso,nbVIso);
-                  QString isosStr = QString::number(nbUIso);
-                  isosStr += gDigitsSep;
-                  isosStr += QString::number(nbVIso);
-                  param = occParam + "Isos";
-                  ip->setParameter(entry, param, isosStr.toLatin1().data());
-                } // if (io->hasEntry())
-              } // GEOM_Actor && hasIO
-            } // isVisible
-          } // while.. actors traversal
-        } // if (vtkView)
-      } // for (views)
-      vtkViewers++;
-    } // if (SVTK view model)
-    else if (vType == SOCC_Viewer::Type()) // processing OCC viewers
-    {
-      QVector<SUIT_ViewWindow*> views = vman->getViews();
-      for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++)
-      {
-        SOCC_ViewWindow* occView = dynamic_cast<SOCC_ViewWindow*>(views[i]);
-        if (occView)
-        {
-          //Handle(AIS_InteractiveContext) ic =
-          //  ((OCCViewer_Viewer*)(occView->getViewManager()->getViewModel()))->getAISContext();
-          OCCViewer_Viewer* viewModel = (OCCViewer_Viewer*)(vman->getViewModel());
-          //OCCViewer_Viewer* viewModel = ((OCCViewer_ViewManager*)vman)->getOCCViewer();
-          Handle(AIS_InteractiveContext) ic = viewModel->getAISContext();
-
-          AIS_ListOfInteractive aList;
-          ic->DisplayedObjects(aList);
-
-          AIS_ListIteratorOfListOfInteractive ite (aList);
-          for (; ite.More(); ite.Next())
-          {
-            if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape)))
-            {
-              Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
-              if (aSh->hasIO())
-              {
-                Handle(SALOME_InteractiveObject) io =
-                  Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO());
-                if (io->hasEntry())
-                {
-                  // entry is "encoded": it does NOT contain component adress,
-                  // since it is a subject to change on next component loading
-                  std::string entry = ip->encodeEntry(io->getEntry(), componentName);
-
-                  std::string param, occParam = vType.toLatin1().data();
-                  occParam += gSeparator;
-                  occParam += QString::number(occViewers).toLatin1().data();
-                  occParam += gSeparator;
-
-                  // Visibility
-                  param = occParam + "Visibility";
-                  ip->setParameter(entry, param, "On");
-
-                  // DisplayMode
-                  param = occParam + "DisplayMode";
-                  int dm = aSh->DisplayMode();
-                  ip->setParameter(entry, param, QString::number(dm).toLatin1().data());
-
-                  // Color
-                  // is a property of GEOM_Object, it is stored by GEOM engine
-
-                  // Transparency
-                  param = occParam + "Transparency";
-                  ip->setParameter(entry, param, QString::number(aSh->Transparency()).toLatin1().data());
-
-                  // Isos
-                  Handle(AIS_Drawer) aDrawer = aSh->Attributes();
-                  int nbUIso = aDrawer->UIsoAspect()->Number();
-                  int nbVIso = aDrawer->VIsoAspect()->Number();
-                  QString isosStr = QString::number(nbUIso);
-                  isosStr += gDigitsSep;
-                  isosStr += QString::number(nbVIso);
-                  param = occParam + "Isos";
-                  ip->setParameter(entry, param, isosStr.toLatin1().data());
-                } // if (io->hasEntry())
-              } // if (io)
-            } // if (GEOM_AISShape)
-          } // for (AIS_ListOfInteractive)
-        } // if ( occView )
-      } // for ( views )
-      occViewers++;
-    } // if (SOCC view model)
-    else
-    {
-      // unknown viewer type
-    }
+    QVector<SUIT_ViewWindow*> views = vman->getViews();
+    for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++) {
+      const ObjMap anObjects = appStudy->getObjectMap(aMgrId);
+      ObjMap::ConstIterator o_it = anObjects.begin();
+      for( ;o_it != anObjects.end(); o_it++ ) {
+       const PropMap aProps = o_it.value();    
+
+       //Check that object exists in the study
+       _PTR(SObject) obj( studyDS->FindObjectID( o_it.key().toLatin1().data() ) );
+       if ( !obj ) 
+         continue;     
+       // entry is "encoded" = it does NOT contain component adress, since it is a
+       // subject to change on next component loading
+
+       std::string entry = ip->encodeEntry(o_it.key().toLatin1().data(), componentName);
+       
+       _PTR(GenericAttribute) anAttr;
+       if( !obj->FindAttribute(anAttr, "AttributeIOR"))
+         continue;
+       
+       std::string param, occParam = vType.toLatin1().data();
+       occParam += NAME_SEPARATOR;
+       occParam += QString::number(aMgrId).toLatin1().data();
+       occParam += NAME_SEPARATOR;
+       
+       param = occParam + VISIBILITY_PROP;
+       ip->setParameter(entry, param, aProps.value(VISIBILITY_PROP).toInt() == 1 ? "On" : "Off");
+       
+       param = occParam + DISPLAY_MODE_PROP;
+       
+       ip->setParameter(entry, param, QString::number(aProps.value(DISPLAY_MODE_PROP).toInt()).toLatin1().data());
+       
+       QColor c = aProps.value(COLOR_PROP).value<QColor>();
+       QString colorStr = QString::number(c.red()/255.);
+       colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.green()/255.);
+       colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.blue()/255.);
+       param = occParam + COLOR_PROP;
+       ip->setParameter(entry, param, colorStr.toLatin1().data());
+       
+       if(vType == SVTK_Viewer::Type()) {
+         param = occParam + OPACITY_PROP;
+         ip->setParameter(entry, param, QString::number(1. - aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+       } else if (vType == SOCC_Viewer::Type()) {
+         param = occParam + TRANSPARENCY_PROP;
+         ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+       }
+        
+       param = occParam + ISOS_PROP;
+       ip->setParameter(entry, param, aProps.value(ISOS_PROP).toString().toLatin1().data());
+       
+       param = occParam + VECTOR_MODE_PROP;
+       ip->setParameter(entry, param, QString::number(aProps.value(VECTOR_MODE_PROP).toInt()).toLatin1().data());
+
+       param = occParam + DEFLECTION_COEFF_PROP;
+       ip->setParameter(entry, param, QString::number(aProps.value(DEFLECTION_COEFF_PROP).toDouble()).toLatin1().data());
+
+       param = occParam + DEFLECTION_COEFF_PROP;
+       ip->setParameter(entry, param, QString::number(aProps.value(DEFLECTION_COEFF_PROP).toDouble()).toLatin1().data());
+
+       //Marker type of the vertex - ONLY for the "Vertex" and "Compound of the Vertex"
+       if(aProps.contains(MARKER_TYPE_PROP)) {
+         param = occParam + MARKER_TYPE_PROP;
+         ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data());
+       }
+
+      } // object iterator
+    } // for (views)
   } // for (viewManagers)
 }
-
 /*!
  * \brief Restore visual parameters
  *
@@ -1801,191 +1819,82 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
     NCollection_DataMap<int, GEOM_Actor*          > vtkActors;
     NCollection_DataMap<int, Handle(GEOM_AISShape)> occActors;
 
+    QString viewerTypStr;
+    QString viewIndexStr;
+    int viewIndex;
+    QVector<PropMap> aListOfMap;
+    
     for (; namesIt != paramNames.end(); ++namesIt, ++valuesIt)
     {
       // visual parameters are stored in strings as follows: ViewerType_ViewIndex_ParamName.
       // '_' is used as separator and should not be used in viewer type or parameter names.
-      QStringList lst = QString((*namesIt).c_str()).split(gSeparator, QString::SkipEmptyParts);
+      QStringList lst = QString((*namesIt).c_str()).split(NAME_SEPARATOR, QString::SkipEmptyParts);
       if (lst.size() != 3)
         continue;
 
-      QString viewerTypStr = lst[0];
-      QString viewIndexStr = lst[1];
+      viewerTypStr = lst[0];
+      viewIndexStr = lst[1];
       QString paramNameStr = lst[2];
 
       bool ok;
-      int viewIndex = viewIndexStr.toUInt(&ok);
+      viewIndex = viewIndexStr.toUInt(&ok);
       if (!ok) // bad conversion of view index to integer
         continue;
+      
+      if((viewIndex + 1) > aListOfMap.count()) {
+       aListOfMap.resize(viewIndex + 1);
+      }
 
-      // viewers
-      if (viewerTypStr == SVTK_Viewer::Type())
-      {
-        GEOM_Actor* vActor = 0;
-        if (vtkActors.IsBound(viewIndex))
-          vActor = vtkActors.Find(viewIndex);
+      QString val((*valuesIt).c_str());
+      if(paramNameStr == VISIBILITY_PROP){
+       aListOfMap[viewIndex].insert(VISIBILITY_PROP, val == "On" ? 1 : 0);
+
+      } else if(paramNameStr == OPACITY_PROP) {
+       aListOfMap[viewIndex].insert(TRANSPARENCY_PROP, 1. - val.toDouble());
+
+      }        else if(paramNameStr == TRANSPARENCY_PROP) { 
+       aListOfMap[viewIndex].insert(TRANSPARENCY_PROP, val.toDouble());
+
+      } else if(paramNameStr == DISPLAY_MODE_PROP) {
+       aListOfMap[viewIndex].insert( DISPLAY_MODE_PROP, val.toInt());
+       
+      } else if(paramNameStr == ISOS_PROP) {
+       aListOfMap[viewIndex].insert( ISOS_PROP, val);
+
+      } else if(paramNameStr == COLOR_PROP) {
+       QStringList rgb = val.split(DIGIT_SEPARATOR);
+       if(rgb.count() == 3) {
+         QColor c(int(rgb[0].toDouble()*255), int(rgb[1].toDouble()*255), int(rgb[2].toDouble()*255));
+         aListOfMap[viewIndex].insert( COLOR_PROP, c);   
+       }
+      } else if(paramNameStr == VECTOR_MODE_PROP) {
+       aListOfMap[viewIndex].insert( VECTOR_MODE_PROP, val.toInt());
+
+      }  else if(paramNameStr == DEFLECTION_COEFF_PROP) {
+       aListOfMap[viewIndex].insert( DEFLECTION_COEFF_PROP, val.toDouble());
+      }  else if(paramNameStr == MARKER_TYPE_PROP) {
+       aListOfMap[viewIndex].insert( MARKER_TYPE_PROP, val);
+      }     
 
-        if (paramNameStr == "Visibility")
-        {
-          if (!vActor && displayer())
-          {
-            QList<SUIT_ViewManager*> lst;
-            getApp()->viewManagers(viewerTypStr, lst);
-
-            // SVTK ViewManager always has 1 ViewWindow, so view index is index of view manager
-            if (viewIndex >= 0 && viewIndex < lst.count()) {
-              SUIT_ViewManager* vman = lst.at(viewIndex);
-              SUIT_ViewModel* vmodel = vman->getViewModel();
-              // SVTK view model can be casted to SALOME_View
-              displayer()->Display(entry, true, dynamic_cast<SALOME_View*>(vmodel));
-
-              // store displayed actor in a temporary map for quicker
-              // access later when restoring other parameters
-              SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
-              vtkRenderer* Renderer = vtkView->getRenderer();
-              vtkActorCollection* theActors = Renderer->GetActors();
-              theActors->InitTraversal();
-              bool isFound = false;
-              vtkActor *ac = theActors->GetNextActor();
-              for (; ac != NULL && !isFound; ac = theActors->GetNextActor()) {
-                if (ac->IsA("GEOM_Actor")) {
-                  GEOM_Actor* aGeomAc = GEOM_Actor::SafeDownCast(ac);
-                  if (aGeomAc->hasIO()) {
-                    Handle(SALOME_InteractiveObject) io =
-                      Handle(SALOME_InteractiveObject)::DownCast(aGeomAc->getIO());
-                    if (io->hasEntry() && strcmp(io->getEntry(), entry.toLatin1().data()) == 0) {
-                      isFound = true;
-                      vtkActors.Bind(viewIndex, aGeomAc);
-                    }
-                  }
-                }
-              }
-            }
-          }
-        } // if (paramNameStr == "Visibility")
-        else
-        {
-          // the rest properties "work" with GEOM_Actor
-          if (vActor)
-          {
-            QString val ((*valuesIt).c_str());
+    } // for names/parameters iterator
 
-            if (paramNameStr == "DisplayMode") {
-              vActor->setDisplayMode(val.toInt());
-            }
-            else if (paramNameStr == "Color") {
-              QStringList colors = val.split(gDigitsSep, QString::SkipEmptyParts);
-              if (colors.count() == 3)
-                vActor->SetColor(colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat());
-            }
-            else if (paramNameStr == "Opacity") {
-              vActor->SetOpacity(val.toFloat());
-            }
-            else if (paramNameStr == "Isos") {
-              QStringList isos = val.split(gDigitsSep, QString::SkipEmptyParts);
-              if (isos.count() == 2) {
-                int aIsos[2] = {isos[0].toInt(), isos[1].toInt()};
-                vActor->SetNbIsos(aIsos);
-              }
-            }
-          }
-        } // other parameters than Visibility
-      }
-      else if (viewerTypStr == SOCC_Viewer::Type())
-      {
-        //Handle(AIS_InteractiveObject) occActor;
-        Handle(GEOM_AISShape) occActor;
-        if (occActors.IsBound(viewIndex))
-          occActor = occActors.Find(viewIndex);
-
-        // ViewModel and InteractiveContext
-        SOCC_Viewer* occVModel = 0;
-        Handle(AIS_InteractiveContext) ic;
-
-        QList<SUIT_ViewManager*> lst;
-        getApp()->viewManagers(viewerTypStr, lst);
-
-        // SOCC ViewManager always has 1 ViewWindow, so view index is index of view manager
-        if (viewIndex >= 0 && viewIndex < lst.count()) {
-          SUIT_ViewManager* vman = lst.at(viewIndex);
-          SUIT_ViewModel* vmodel = vman->getViewModel();
-          occVModel = dynamic_cast<SOCC_Viewer*>(vmodel);
-          if (occVModel)
-            ic = occVModel->getAISContext();
-        }
+    QList<SUIT_ViewManager*> lst = getApp()->viewManagers();
 
-        if (ic.IsNull())
-          continue;
+    for (int index = 0 ; index < aListOfMap.count(); index++) {
 
-        if (paramNameStr == "Visibility")
-        {
-          if (occActor.IsNull() && displayer())
-          {
-            displayer()->Display(entry, true, occVModel);
-
-            // store displayed actor in a temporary map for quicker
-            // access later when restoring other parameters
-            AIS_ListOfInteractive aList;
-            ic->DisplayedObjects(aList);
-            bool isFound = false;
-            AIS_ListIteratorOfListOfInteractive ite (aList);
-            for (; ite.More() && !isFound; ite.Next()) {
-              if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
-                Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
-                if (aSh->hasIO()) {
-                  Handle(SALOME_InteractiveObject) io =
-                    Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO());
-                  if (io->hasEntry() && strcmp(io->getEntry(), entry.toLatin1().data()) == 0) {
-                    isFound = true;
-                    occActors.Bind(viewIndex, aSh);
-                  }
-                }
-              }
-            }
-          }
-        } // if (paramNameStr == "Visibility")
-        else
-        {
-          // the rest properties "work" with GEOM_AISShape
-          if (!occActor.IsNull())
-          {
-            QString val ((*valuesIt).c_str());
-
-            if (paramNameStr == "DisplayMode") {
-              ic->SetDisplayMode(occActor, AIS_DisplayMode(val.toInt()), false);
-              //ic->Redisplay(occActor, Standard_False, Standard_True);
-            }
-            // Color is restored by the GEOM engine
-            else if (paramNameStr == "Transparency") {
-              ic->SetTransparency(occActor, val.toFloat(), false);
-              ic->Redisplay(occActor, Standard_False, Standard_True);
-            }
-            else if (paramNameStr == "Isos") {
-              QStringList isos = val.split(gDigitsSep, QString::SkipEmptyParts);
-              if (isos.count() == 2) {
-                Handle(AIS_Drawer) aDrawer = occActor->Attributes();
-                int nbUIso = isos[0].toInt();
-                int nbVIso = isos[1].toInt();
-                Handle(Prs3d_IsoAspect) uIsoAspect = aDrawer->UIsoAspect();
-                Handle(Prs3d_IsoAspect) vIsoAspect = aDrawer->VIsoAspect();
-                uIsoAspect->SetNumber(nbUIso);
-                vIsoAspect->SetNumber(nbVIso);
-                aDrawer->SetUIsoAspect(uIsoAspect);
-                aDrawer->SetVIsoAspect(vIsoAspect);
-                ic->SetLocalAttributes(occActor, aDrawer);
-                ic->Redisplay(occActor);
-              }
-            }
-          }
-        } // other parameters than Visibility
-      }
-      else
-      {
-        // unknown viewer type
+      appStudy->setObjectPropMap(index, entry, aListOfMap[index]);
+
+      QColor c = aListOfMap[index].value(COLOR_PROP).value<QColor>();
+      //Get Visibility property of the current PropMap
+      if(aListOfMap[index].value(VISIBILITY_PROP) == 1) {
+       SUIT_ViewManager* vman = lst.at(index);
+       SUIT_ViewModel* vmodel = vman->getViewModel();
+       displayer()->Display(entry, true, dynamic_cast<SALOME_View*>(vmodel));    
       }
-    } // for names/parameters iterator
+    }
+    
   } // for entries iterator
-
+  
   // update all VTK and OCC views
   QList<SUIT_ViewManager*> lst;
   getApp()->viewManagers(lst);