Salome HOME
Implementation of 0022617: [CEA 1060] In OCC view, add "Show vertices" in the context...
authorakl <alexander.kovalev@opencascade.com>
Wed, 27 Aug 2014 07:03:29 +0000 (11:03 +0400)
committerakl <alexander.kovalev@opencascade.com>
Wed, 27 Aug 2014 07:03:29 +0000 (11:03 +0400)
20 files changed:
doc/salome/examples/viewing_geom_objs_ex01.py
doc/salome/gui/GEOM/input/display_mode.doc
src/DisplayGUI/DisplayGUI.cxx
src/DisplayGUI/DisplayGUI.h
src/GEOMGUI/GEOMGUI_Selection.cxx
src/GEOMGUI/GEOMGUI_Selection.h
src/GEOMGUI/GEOM_Displayer.cxx
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI_Operations.h
src/GEOM_SWIG/GEOM_example3.py
src/GEOM_SWIG_WITHIHM/libGEOM_Swig.cxx
src/GEOM_SWIG_WITHIHM/libGEOM_Swig.h
src/GEOM_SWIG_WITHIHM/libGEOM_Swig.i
src/OBJECT/GEOM_AISShape.cxx
src/OBJECT/GEOM_AISShape.hxx
src/OBJECT/GEOM_Actor.cxx
src/OBJECT/GEOM_Actor.h
src/OBJECT/GEOM_Constants.cxx
src/OBJECT/GEOM_Constants.h

index 0458d42bf38001c72ce42d0ee862d6dd99b1f90d..17387b7247c37a9710f31c3b3957dd1fd586d912 100644 (file)
@@ -11,10 +11,9 @@ box2 = geompy.MakeBox(-50,-50,-50, 0,0,0)
 sphere = geompy.MakeSphere(50,50,50, 30)
 fuse = geompy.MakeBoolean(box,sphere,3)
 fuse_id = geompy.addToStudy(fuse,"Fuse")
-box_id = geompy.addToStudy(box2, "Box")
 
 gg = salome.ImportComponentGUI("GEOM")
 gg.createAndDisplayGO(fuse_id)
 gg.setDisplayMode(fuse_id,1)
-gg.createAndDisplayGO(box_id)
-gg.setVectorsMode(box_id, 1)
+gg.setVectorsMode(fuse_id, 1)
+gg.setVerticesMode(fuse_id, 1)
index f8eaeccf018879859c2e0436f76e863faa3fc548..f8f2184e7d00e7a18e297a6c3de8f2a8c45e304c 100644 (file)
@@ -29,6 +29,17 @@ functionality for all objects in the current view via the main menu
 
 \n <b>TUI Command:</b> <em>gg.setVectorsMode(ID, Bool)</em>
 
+\n Also it is possible to show the vertices of the selected
+shape. For this, choose in the context menu of the shape
+<b>Display mode -> Show Vertices</b>, or apply this
+functionality for all objects in the current view via the main menu
+<b> View -> Display Mode -> Show/Hide Vertices.</b>
+
+\image html vertices_mode.png
+<center><em>Vertices Mode (Show Vertices)</em></center>
+
+\n <b>TUI Command:</b> <em>gg.setVerticesMode(ID, Bool)</em>
+
 Our <b>TUI Scripts</b> provide you with useful examples of 
 \ref tui_change_disp_mode "Changing Display Parameters".
 
index fcd23e99797a11fd9d4fe7e70e98bbe6fd94d3a7..3f407fd344dd7c04d7d3dee3cdfc723d5214e2e6 100644 (file)
@@ -136,6 +136,12 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
       ( GetVectorMode() ? tr("MEN_VECTOR_MODE_ON") : tr( "MEN_VECTOR_MODE_OFF" ) );
     getGeometryGUI()->menuMgr()->update();
     break;
+  case GEOMOp::OpSwitchVertices:  // MENU VIEW - DISPLAY MODE - SHOW/HIDE VERTICES
+    SetVerticesMode(!GetVerticesMode());
+    getGeometryGUI()->action( GEOMOp::OpSwitchVertices )->setText
+      ( GetVerticesMode() ? tr("MEN_VERTICES_MODE_ON") : tr( "MEN_VERTICES_MODE_OFF" ) );
+    getGeometryGUI()->menuMgr()->update();
+    break;
   case GEOMOp::OpWireframe:      // POPUP MENU - DISPLAY MODE - WIREFRAME
     ChangeDisplayMode( 0 );
     break;
@@ -151,6 +157,9 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
     case GEOMOp::OpVectors:        // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
     ChangeDisplayMode( 4 );
     break;
+    case GEOMOp::OpVertices:       // POPUP MENU - DISPLAY MODE - SHOW VERTICES
+    ChangeDisplayMode( 5 );
+    break;
   default:
     app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
     break;
@@ -485,6 +494,52 @@ int DisplayGUI::GetVectorMode( SUIT_ViewWindow* viewWindow )
   return viewWindow->property( "VectorsMode" ).toBool();
 }
 
+//=====================================================================================
+// function : DisplayGUI::SetVerticesMode()
+// purpose  : Set vertices mode for the viewer
+//=====================================================================================
+void DisplayGUI::SetVerticesMode( const bool mode, SUIT_ViewWindow* viewWindow )
+{
+  SUIT_OverrideCursor();
+
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return;
+
+  SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+  if ( !aStudy ) return;
+
+  if ( !viewWindow ) 
+    viewWindow = app->desktop()->activeWindow();
+
+  GEOM_Displayer displayer( aStudy );
+
+  viewWindow->setProperty( "VerticesMode", mode );
+
+  int aMgrId = viewWindow->getViewManager()->getGlobalId();
+
+  SALOME_ListIO anIOlst;
+  displayer.GetActiveView()->GetVisible( anIOlst );
+
+  for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
+    Handle( SALOME_InteractiveObject ) io = It.Value();
+    aStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::Vertices ), mode );
+    displayer.Redisplay( io, false );
+  }
+  displayer.UpdateViewer();
+  GeometryGUI::Modified();
+}
+
+//=====================================================================================
+// function : DisplayGUI::GetVerticesMode()
+// purpose  : Get the "show vertices" mode of the viewer
+//=====================================================================================
+int DisplayGUI::GetVerticesMode( SUIT_ViewWindow* viewWindow )
+{
+  if ( !viewWindow ) 
+    viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
+  return viewWindow->property( "VerticesMode" ).toBool();
+}
+
 //=====================================================================================
 // function : DisplayGUI::ChangeDisplayMode()
 // purpose  : Set display mode for selected objects in the viewer given
@@ -516,6 +571,8 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
 
   QVariant v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), QVariant() );
   bool vectorMode =  v.isValid() ? !v.toBool() : false;
+  v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Vertices ), QVariant() );
+  bool verticesMode =  v.isValid() ? !v.toBool() : false;
 
   for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
     Handle( SALOME_InteractiveObject ) io = It.Value();
@@ -525,6 +582,9 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
     else if ( mode == 4 ) {
       aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), vectorMode );
     }
+    else if ( mode == 5 ) {
+      aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::Vertices ), verticesMode );
+    }
     displayer.Redisplay( io, false );
   }
   displayer.UpdateViewer();
index 64207c5577f10d6bc45de10db09b4e3c8cb6019f..5ad5933c7fc5e4ca82a8723a498d51d4baf6d114 100644 (file)
@@ -69,6 +69,12 @@ public:
   int  GetVectorMode( SUIT_ViewWindow* = 0 );
   // Invert vector mode ( shadin <-> wireframe ) for the viewer 
 
+  // VERTICES MODE methods
+  // Set vertices mode for the viewer
+  void SetVerticesMode( const bool, SUIT_ViewWindow* = 0 );
+  // Get vertices mode of the viewer
+  int  GetVerticesMode( SUIT_ViewWindow* = 0 );
+  
   // Set display mode for selected objects in the viewer given
   // (current viewer if <viewWindow> = 0 )
   void ChangeDisplayMode( const int, SUIT_ViewWindow* = 0 );
index 3e6f31a31f2221e11a5bb059c2ae20f8ec3371c9..a2ad57d4b40fd94d8a679e2873e436a9113f90be 100644 (file)
@@ -171,6 +171,8 @@ QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const
     v = isAutoColor( idx );
   else if ( p == "isVectorsMode" )
     v = isVectorsMode( idx );
+  else if ( p == "isVerticesMode" )
+    v = isVerticesMode( idx );
   else if ( p == "topLevel" )
     v = topLevel( idx );
   else if ( p == "autoBringToFront" )
@@ -428,6 +430,53 @@ bool GEOMGUI_Selection::isVectorsMode( const int index ) const
   return res;
 }
 
+bool GEOMGUI_Selection::isVerticesMode( const int index ) const
+{
+#ifdef USE_VISUAL_PROP_MAP
+  QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::Vertices ) );
+  if ( v.canConvert( QVariant::Bool ) )
+    return v.toBool();
+#endif
+
+  bool res = false;
+  
+  SALOME_View* view = GEOM_Displayer::GetActiveView();
+  QString viewType = activeViewType();
+  if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
+    SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
+    if ( prs ) {
+      if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
+        SOCC_Prs* occPrs = (SOCC_Prs*) prs;
+        AIS_ListOfInteractive lst;
+        occPrs->GetObjects( lst );
+        if ( lst.Extent() ) {
+          Handle(AIS_InteractiveObject) io = lst.First();
+          if ( !io.IsNull() ) {
+            Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
+            if ( !aSh.IsNull() )
+              res = aSh->isShowVertices();
+          }
+        }
+      }
+      else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
+        SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
+        vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
+        if ( lst ) {
+          lst->InitTraversal();
+          vtkActor* actor = lst->GetNextActor();
+          if ( actor ) {
+            GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor);
+            if ( aGeomActor )
+              res = aGeomActor->GetVerticesMode();
+            }
+        }
+      }
+    }
+  }
+
+  return res;
+}
+
 bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj )
 {
   if ( obj ) {
index be21acfb4c578686f4773d586e9dd154d1dd3684..d7b69260962cf7993ce89fa76013f3d054cb890c 100644 (file)
@@ -67,6 +67,7 @@ private:
   QString               displayMode( const int ) const;
   QString               selectionMode() const;
   bool                  isVectorsMode( const int ) const;
+  bool                  isVerticesMode( const int ) const;
   bool                  hasChildren( const int ) const;
   int                   nbChildren( const int ) const;
   bool                  hasConcealedChildren( const int ) const;
index 09c3ccf2d0f1d225ff912c269ee202c168982ce1..a012c220b7b1684696323245c100912c615adae8 100644 (file)
@@ -871,6 +871,9 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
   // set display vectors flag
   AISShape->SetDisplayVectors( propMap.value( GEOM::propertyName( GEOM::EdgesDirection ) ).toBool() );
 
+  // set display vertices flag
+  AISShape->SetDisplayVertices( propMap.value( GEOM::propertyName( GEOM::Vertices ) ).toBool() );
+
   // set transparency
   if( HasTransparency() ) {
     AISShape->SetTransparency( GetTransparency() );
@@ -1144,6 +1147,9 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
   // set display vectors flag
   actor->SetVectorMode( propMap.value( GEOM::propertyName( GEOM::EdgesDirection ) ).toBool() );
 
+  // set display vertices flag
+  actor->SetVerticesMode( propMap.value( GEOM::propertyName( GEOM::Vertices ) ).toBool() );
+
   // set display mode
   int displayMode = HasDisplayMode() ? 
     // predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function 
@@ -2498,6 +2504,9 @@ PropMap GEOM_Displayer::getDefaultPropertyMap()
   // - show edges direction flag (false by default)
   propMap.insert( GEOM::propertyName( GEOM::EdgesDirection ), false );
 
+  // - show vertices flag (false by default)
+  propMap.insert( GEOM::propertyName( GEOM::Vertices ), false );
+
   // - shading color (take default value from preferences)
   propMap.insert( GEOM::propertyName( GEOM::ShadingColor ),
                   colorFromResources( "shading_color", QColor( 255, 255, 0 ) ) );
index c8a36982d1b4b362981ab012fcf02a2343f8eba7..d19174cc95ab53bb9d112e9fdfe9dda8de265197 100644 (file)
@@ -2900,6 +2900,10 @@ Please, select face, shell or solid and try again</translation>
         <source>MEN_POP_VECTORS</source>
         <translation>Show Edge Direction</translation>
     </message>
+    <message>
+        <source>MEN_POP_VERTICES</source>
+        <translation>Show Vertices</translation>
+    </message>
     <message>
         <source>MEN_PREFERENCES</source>
         <translation>Preferences</translation>
@@ -3072,6 +3076,14 @@ Please, select face, shell or solid and try again</translation>
         <source>MEN_VECTOR_MODE_OFF</source>
         <translation>Hide Edge Direction</translation>
     </message>
+    <message>
+        <source>MEN_VERTICES_MODE_ON</source>
+        <translation>Show Vertices</translation>
+    </message>
+    <message>
+        <source>MEN_VERTICES_MODE_OFF</source>
+        <translation>Hide Vertices</translation>
+    </message>
     <message>
         <source>MEN_WIREFRAME</source>
         <translation>Wireframe</translation>
@@ -3768,6 +3780,10 @@ Please, select face, shell or solid and try again</translation>
         <source>STB_POP_VECTORS</source>
         <translation>Show Edge Direction</translation>
     </message>
+    <message>
+        <source>STB_POP_VERTICES</source>
+        <translation>Show Vertices</translation>
+    </message>
     <message>
         <source>STB_POP_SETTEXTURE</source>
         <translation>Add a texture</translation>
index 43e865ae9e7153d9abadb4bed5e73d98a4ee0cf9..1df722c350b7d9859b9b672d773f2e0543f596e1 100644 (file)
@@ -520,11 +520,13 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
   case GEOMOp::OpHide:               // MENU VIEW - ERASE
   case GEOMOp::OpShow:               // MENU VIEW - DISPLAY
   case GEOMOp::OpSwitchVectors:      // MENU VIEW - VECTOR MODE
+  case GEOMOp::OpSwitchVertices:     // MENU VIEW - VERTICES MODE
   case GEOMOp::OpWireframe:          // POPUP MENU - WIREFRAME
   case GEOMOp::OpShading:            // POPUP MENU - SHADING
   case GEOMOp::OpShadingWithEdges:   // POPUP MENU - SHADING WITH EDGES
   case GEOMOp::OpTexture:            // POPUP MENU - TEXTURE
   case GEOMOp::OpVectors:            // POPUP MENU - VECTORS
+  case GEOMOp::OpVertices:           // POPUP MENU - VERTICES
     libName = "DisplayGUI";
     break;
   case GEOMOp::OpPoint:              // MENU BASIC - POINT
@@ -1043,6 +1045,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpHideAll,          "ERASE_ALL" );
   createGeomAction( GEOMOp::OpShow,             "DISPLAY" );
   createGeomAction( GEOMOp::OpSwitchVectors,    "VECTOR_MODE");
+  createGeomAction( GEOMOp::OpSwitchVertices,   "VERTICES_MODE");
   createGeomAction( GEOMOp::OpSelectVertex,     "VERTEX_SEL_ONLY" ,"", 0, true );
   createGeomAction( GEOMOp::OpSelectEdge,       "EDGE_SEL_ONLY", "", 0, true );
   createGeomAction( GEOMOp::OpSelectWire,       "WIRE_SEL_ONLY", "",  0, true );
@@ -1064,6 +1067,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpEdgeWidth,        "EDGE_WIDTH");
   createGeomAction( GEOMOp::OpIsosWidth,        "ISOS_WIDTH");
   createGeomAction( GEOMOp::OpVectors,          "POP_VECTORS", "", 0, true );
+  createGeomAction( GEOMOp::OpVertices,         "POP_VERTICES", "", 0, true );
   createGeomAction( GEOMOp::OpDeflection,       "POP_DEFLECTION" );
   createGeomAction( GEOMOp::OpColor,            "POP_COLOR" );
   createGeomAction( GEOMOp::OpSetTexture,       "POP_SETTEXTURE" );
@@ -1319,6 +1323,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpDMTexture,          dispmodeId, -1 );
   createMenu( separator(),                  dispmodeId, -1 );
   createMenu( GEOMOp::OpSwitchVectors,      dispmodeId, -1 );
+  createMenu( GEOMOp::OpSwitchVertices,     dispmodeId, -1 );
 
   createMenu( separator(),       viewId, -1 );
   createMenu( GEOMOp::OpShowAll, viewId, -1 );
@@ -1520,6 +1525,9 @@ void GeometryGUI::initialize( CAM_Application* app )
   mgr->insert( action(  GEOMOp::OpVectors ), dispmodeId, -1 ); // vectors
   mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK_AndSomeVisible  + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
   mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK + " and isVectorsMode", QtxPopupMgr::ToggleRule );
+  mgr->insert( action(  GEOMOp::OpVertices ), dispmodeId, -1 ); // vertices
+  mgr->setRule( action( GEOMOp::OpVertices ), clientOCCorVTK_AndSomeVisible  + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
+  mgr->setRule( action( GEOMOp::OpVertices ), clientOCCorVTK + " and isVerticesMode", QtxPopupMgr::ToggleRule );
   mgr->insert( separator(), -1, -1 );     // -----------
 
   mgr->insert( action(  GEOMOp::OpColor ), -1, -1 ); // color
@@ -2888,6 +2896,11 @@ void GeometryGUI::storeVisualParameters (int savePoint)
           ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::EdgesDirection )).toString().toStdString());
         }
 
+        if (aProps.contains(GEOM::propertyName( GEOM::Vertices ))) {
+          param = occParam + GEOM::propertyName( GEOM::Vertices );
+          ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Vertices )).toString().toStdString());
+        }
+
         if (aProps.contains(GEOM::propertyName( GEOM::Deflection ))) {
           param = occParam + GEOM::propertyName( GEOM::Deflection );
           ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Deflection )).toString().toStdString());
@@ -3058,6 +3071,8 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
         aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Texture ), val );
       } else if (paramNameStr == GEOM::propertyName( GEOM::EdgesDirection )) {
         aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::EdgesDirection ), val == "true" || val == "1");
+      } else if (paramNameStr == GEOM::propertyName( GEOM::Vertices )) {
+        aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Vertices ), val == "true" || val == "1");
       } else if (paramNameStr == GEOM::propertyName( GEOM::Deflection )) {
         aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Deflection ), val.toDouble());
       } else if (paramNameStr == GEOM::propertyName( GEOM::PointMarker )) {
@@ -3111,13 +3126,19 @@ void GeometryGUI::onViewAboutToShow()
 {
   SUIT_ViewWindow* window = application()->desktop()->activeWindow();
   QAction* a = action( GEOMOp::OpSwitchVectors );
+  QAction* aVerticesAction = action( GEOMOp::OpSwitchVertices );
   if ( window ) {
     a->setEnabled(true);
     bool vmode = window->property("VectorsMode").toBool();
     a->setText ( vmode == 1 ? tr( "MEN_VECTOR_MODE_OFF" ) : tr("MEN_VECTOR_MODE_ON") );
+    aVerticesAction->setEnabled(true);
+    vmode = window->property("VerticesMode").toBool();
+    aVerticesAction->setText ( vmode == 1 ? tr( "MEN_VERTICES_MODE_OFF" ) : tr("MEN_VERTICES_MODE_ON") );
   } else {
     a->setText ( tr("MEN_VECTOR_MODE_ON") );
     a->setEnabled(false);
+    aVerticesAction->setText ( tr("MEN_VERTICES_MODE_ON") );
+    aVerticesAction->setEnabled(false);
   }
 }
 
index 5a33af0dce9a1b41aae1edd607c0b883cab09878..4a109372a6f37e4ae9f2e56b43a330f02ba3ec78 100644 (file)
@@ -71,6 +71,7 @@ namespace GEOMOp {
     OpDMShading           = 2011,   // MENU VIEW  - DISPLAY MODE - SHADING
     OpDMShadingWithEdges  = 2012,   // MENU VIEW  - DISPLAY MODE - SHADING WITH EDGES
     OpDMTexture           = 2013,   // MENU VIEW  - DISPLAY MODE - TEXTURE
+    OpSwitchVertices      = 2014,   // MENU VIEW  - DISPLAY MODE - SHOW/HIDE VERTICES
     OpShow                = 2100,   // POPUP MENU - SHOW
     OpShowOnly            = 2101,   // POPUP MENU - SHOW ONLY
     OpHide                = 2102,   // POPUP MENU - HIDE
@@ -82,6 +83,7 @@ namespace GEOMOp {
     OpTexture             = 2204,   // POPUP MENU - DISPLAY MODE - TEXTURE
     OpBringToFront        = 2205,   // POPUP MENU - BRING TO FRONT
     OpClsBringToFront     = 2206,
+    OpVertices            = 2208,   // POPUP MENU - DISPLAY MODE - SHOW VERTICES
     // BasicGUI --------------------//--------------------------------
     OpPoint               = 3000,   // MENU NEW ENTITY - BASIC - POINT
     OpLine                = 3001,   // MENU NEW ENTITY - BASIC - LINE
index 5f79ccd14d7383785c23037d83e05172e8348dc4..b2432f339e2d6127a61a0ec5160b0ec7ec06db6c 100644 (file)
@@ -113,6 +113,7 @@ if not isinstance(gg, type(salome_ComponentGUI)):
     gg.setDisplayMode(id_torus1,1)
     gg.setDisplayMode(id_torus2,1)
     gg.setVectorsMode(id_acyl,1,1)
+    gg.setVerticesMode(id_acyl,1,1)
     #gg.setDisplayMode(id_cage,1)
     
     gg.setColor(id_torus1,0,0,255)
index 1fa77355deff84b4852ee6fc10d43f7e94282089..2b918cc1204ce29e42f9e38dd88694b1fcd44104 100644 (file)
@@ -391,6 +391,18 @@ void GEOM_Swig::setVectorsMode( const char* theEntry, bool theOn, bool theUpdate
                                            theOn, theUpdateViewer ) );
 }
 
+/*!
+  \brief Show / hide vertices for the presentation
+  \param theEntry geometry object's entry
+  \param theOn \c true to show vertices or \c false otherwise
+  \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::setVerticesMode( const char* theEntry, bool theOn, bool theUpdateViewer )
+{
+  ProcessVoidEvent( new TSetPropertyEvent( theEntry, GEOM::propertyName( GEOM::Vertices ), 
+                                           theOn, theUpdateViewer ) );
+}
+
 /*!
   \brief Change color of the presentation
   \param theEntry geometry object's entry
index 60cb10cfabe75d54aba2e910364d77a2aaed801a..1fd1d864e10ec59941e13c99985141579b748f17 100644 (file)
@@ -41,6 +41,7 @@ public:
 
   void setDisplayMode( const char* theEntry, int theMode, bool theUpdateViewer = true );
   void setVectorsMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
+  void setVerticesMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
   void setColor( const char* theEntry, int theRed, int theGreen, int theBlue, bool theUpdateViewer = true );
   void setTransparency( const char* theEntry, float theTransparency, bool theUpdateViewer = true );
   void setIsos( const char* theEntry, int theNbU, int theNbV, bool theUpdateViewer = true );
index 6d1050a98c7c42503bb0a7988978e417bc4ea8af..30f6065c7dcd919d6cf8a8316294d406b9200d19 100644 (file)
@@ -63,6 +63,7 @@ class GEOM_Swig
 
   void setDisplayMode( const char* theEntry, int theMode, bool theUpdateViewer = true );
   void setVectorsMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
+  void setVerticesMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
   void setColor( const char* theEntry, int theRed, int theGreen, int theBlue, bool theUpdateViewer = true );
   void setTransparency( const char* theEntry, float theTransparency, bool theUpdateViewer = true );
   void setIsos( const char* theEntry, int theNbU, int theNbV, bool theUpdateViewer = true );
index 462eed0c24c5187b9046e1cac56ad8eae2ed0026..a6ded99e0d8af3f52df16db8d94964db00e657e1 100644 (file)
@@ -53,6 +53,7 @@
 #include <Prs3d_ShadingAspect.hxx>
 #include <Prs3d_Arrow.hxx>
 #include <Prs3d_IsoAspect.hxx>
+#include <Prs3d_VertexDrawMode.hxx>
 
 #include <SelectBasics_SensitiveEntity.hxx>
 #include <SelectMgr_EntityOwner.hxx>
@@ -148,6 +149,7 @@ GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape,
   : SALOME_AISShape(shape),
     myName(aName),
     myDisplayVectors(false),
+    myDisplayVertices(false),
     myFieldDataType(GEOM::FDT_Double),
     myFieldDimension(0),
     myFieldStepRangeMin(0),
@@ -215,6 +217,9 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
   bool anIsColorField = anIsField && myFieldDataType != GEOM::FDT_String;
   bool anIsTextField = anIsField && myFieldDataType == GEOM::FDT_String;
 
+  if (isShowVertices())
+    myDrawer->SetVertexDrawMode(Prs3d_VDM_All);
+
   //   StdSelect_DisplayMode d = (StdSelect_DisplayMode) aMode;
   bool isTopLev = isTopLevel() && switchTopLevel();
   switch (aMode) {
@@ -359,6 +364,11 @@ void GEOM_AISShape::SetDisplayVectors(bool isDisplayed)
   myDisplayVectors = isDisplayed;
 }
 
+void GEOM_AISShape::SetDisplayVertices(bool isDisplayed)
+{
+  myDisplayVertices = isDisplayed;
+}
+
 void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
                                 const Handle(Prs3d_Presentation)& aPrs,
                                 const Standard_Integer aMode)
index d744a791af5a7d1df8c0969edfd5177375f2c496..8a60ba952f059b78a70214971723020374f06b01 100644 (file)
@@ -124,12 +124,14 @@ public:
         void SetShadingColor(const Quantity_Color &aCol);
         void SetEdgesInShadingColor(const Quantity_Color &aCol);
         void SetDisplayVectors(bool isShow);
+        void SetDisplayVertices(bool isShow);
 
         virtual  void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
                                       const Handle(Prs3d_Presentation)& aPresentation,
                                       const Standard_Integer aMode = 0) ;
 
         virtual  bool isShowVectors () { return myDisplayVectors; }
+        virtual  bool isShowVertices () { return myDisplayVertices; }
                 virtual  Standard_Boolean switchTopLevel();
                 virtual  Standard_Boolean toActivate();
         
@@ -182,6 +184,7 @@ protected:
 private: 
   TCollection_AsciiString  myName;
   bool                     myDisplayVectors;
+  bool                     myDisplayVertices;
   Standard_Boolean         myTopLevel;
   Standard_Integer         myPrevDisplayMode;
 
index 47bc66b176d03b06d2c5c4c9ef2ea03f7a16e4fb..851b83ab11e1422e0ab7b11945d8c174d1fc8cfa 100644 (file)
@@ -82,6 +82,7 @@ GEOM_Actor::GEOM_Actor():
   //  myDisplayMode(eWireframe), 
   myIsSelected(false), 
   myVectorMode(false),
+  myVerticesMode(false),
 
   myVertexActor(GEOM_DeviceActor::New(),true), 
   myVertexSource(GEOM_VertexSource::New(),true), 
@@ -129,13 +130,13 @@ GEOM_Actor::GEOM_Actor():
   myHighlightProp->SetAmbientColor(1, 1, 1);
   myHighlightProp->SetDiffuseColor(1, 1, 1);
   myHighlightProp->SetSpecularColor(0.5, 0.5, 0.5);
-  myHighlightProp->SetPointSize(SALOME_POINT_SIZE);
+  myHighlightProp->SetPointSize(0);
   myHighlightActor->SetProperty(myHighlightProp.GetPointer());
 
   this->myHighlightActor->SetInput(myAppendFilter->GetOutputPort(),false);
 
   myPreHighlightProp->SetColor(0,1,1);
-  myPreHighlightProp->SetPointSize(SALOME_POINT_SIZE+2);
+  myPreHighlightProp->SetPointSize(0);
   myPreHighlightProp->SetLineWidth(SALOME_LINE_WIDTH+1);
   myPreHighlightProp->SetRepresentationToWireframe();
 
@@ -189,6 +190,7 @@ GEOM_Actor::GEOM_Actor():
   // Toggle display mode 
   setDisplayMode(0); // WIRE FRAME
   SetVectorMode(0);  //
+  SetVerticesMode(0);  //
 } 
  
  
@@ -355,7 +357,7 @@ SetVisibility(int theVisibility)
   myOneFaceEdgeActor->SetVisibility(theVisibility && (myDisplayMode == (int)eWireframe || myDisplayMode == (int)eShadingWithEdges) && !myIsSelected);
   myIsolatedEdgeActor->SetVisibility(theVisibility && !myIsSelected);
 
-  myVertexActor->SetVisibility(theVisibility && myDisplayMode == (int)eWireframe && !myIsSelected);// must be added new mode points
+  myVertexActor->SetVisibility(theVisibility && myVerticesMode && (!myIsSelected && !myIsPreselected));// must be added new mode points
 }
  
 
@@ -391,6 +393,23 @@ GEOM_Actor
   return myVectorMode;
 }
 
+void
+GEOM_Actor
+::SetVerticesMode(bool theMode)
+{
+  myVerticesMode = theMode;
+  theMode ? myPreHighlightProp->SetPointSize(SALOME_POINT_SIZE+2) : myPreHighlightProp->SetPointSize(0);
+  theMode ? myHighlightProp->SetPointSize(SALOME_POINT_SIZE) : myHighlightProp->SetPointSize(0);
+  SetModified();
+}
+
+bool
+GEOM_Actor
+::GetVerticesMode()
+{
+  return myVerticesMode;
+}
+
 void  
 GEOM_Actor:: 
 SetDeflection(float theDeflection) 
index fa7193a0f4b2c9ccf54f19900cad11eaa6727705..173f40a0be9c6cbe636f0016840882b666aeecc5 100644 (file)
@@ -202,6 +202,15 @@ public:
   bool
   GetVectorMode();
 
+  //! Vertices mode management
+  virtual
+  void
+  SetVerticesMode(const bool theMode);
+
+  virtual
+  bool
+  GetVerticesMode();
+
 protected:
   void SetModified();
 
@@ -220,6 +229,7 @@ private:
   //  EDisplayMode myDisplayMode;
   bool myIsSelected;
   bool myVectorMode;
+  bool myVerticesMode;
 
   PDeviceActor myVertexActor;
   PVertexSource myVertexSource;
index 7790adcba69a284b6afbd9d9ffe5477973c83337..0ccf2ed1ca9ed4fc3912032b7b4db6b7cc2a723a 100644 (file)
@@ -69,6 +69,8 @@ namespace GEOM
       "Color",           // COLOR_PROP
       // "show edges direction" flag
       "VectorMode",      // VECTOR_MODE_PROP
+      // "show vertices" flag
+      "VerticesMode",    // VERTICES_MODE_PROP
       // deflection coefficient
       "DeflectionCoeff", // DEFLECTION_COEFF_PROP
       // point marker data
index 17f65eb361d943a5081c3e5ecd77f7e22c4224e8..e314735f800ee042eaadafa3d7217d89868bb183 100644 (file)
@@ -39,6 +39,7 @@ namespace GEOM
     NbIsos,
     Color,
     EdgesDirection,
+    Vertices,
     Deflection,
     PointMarker,
     Material,