Salome HOME
Remove obsolete conditionals
[modules/geom.git] / src / GEOMGUI / GEOM_Displayer.cxx
index 5968c06c0f5abf993e2bfdb60045a0c99dd982dd..b8551a6910b7958369fed45ae17e26ccc605bb22 100644 (file)
@@ -77,6 +77,7 @@
 
 #include <OCCViewer_ViewWindow.h>
 #include <OCCViewer_ViewPort3d.h>
+#include <OCCViewer_Utilities.h>
 
 // OCCT Includes
 #include <AIS_Drawer.hxx>
@@ -153,47 +154,6 @@ namespace
     return aMap;
   }
 
-  //===========================================================================
-  // Function : imageToPixmap
-  // Purpose  : Concert QImage to OCCT pixmap
-  //===========================================================================
-  static inline Handle(Image_PixMap) imageToPixmap( const QImage& anImage )
-  { 
-    Handle(Image_PixMap) aPixmap = new Image_PixMap();
-    if ( !anImage.isNull() ) {
-      aPixmap->InitTrash( Image_PixMap::ImgBGRA, anImage.width(), anImage.height() );
-      aPixmap->SetTopDown( Standard_True );
-      
-      const uchar* aImageBytes = anImage.bits();
-      
-      for ( int aLine = anImage.height() - 1; aLine >= 0; --aLine ) {
-#if OCC_VERSION_LARGE > 0x06070100
-       // convert pixels from ARGB to renderer-compatible RGBA
-       for ( int aByte = 0; aByte < anImage.width(); ++aByte ) {
-         Image_ColorBGRA& aPixmapBytes = aPixmap->ChangeValue<Image_ColorBGRA>(aLine, aByte);
-       
-         aPixmapBytes.b() = (Standard_Byte) *aImageBytes++;
-         aPixmapBytes.g() = (Standard_Byte) *aImageBytes++;
-         aPixmapBytes.r() = (Standard_Byte) *aImageBytes++;
-         aPixmapBytes.a() = (Standard_Byte) *aImageBytes++;
-       }
-#else
-       Image_ColorBGRA* aPixmapBytes = aPixmap->EditData<Image_ColorBGRA>().ChangeRow(aLine);
-       
-        // convert pixels from ARGB to renderer-compatible RGBA
-        for ( int aByte = 0; aByte < anImage.width(); ++aByte ) {
-         aPixmapBytes->b() = (Standard_Byte) *aImageBytes++;
-         aPixmapBytes->g() = (Standard_Byte) *aImageBytes++;
-         aPixmapBytes->r() = (Standard_Byte) *aImageBytes++;
-         aPixmapBytes->a() = (Standard_Byte) *aImageBytes++;
-         aPixmapBytes++;
-        }
-#endif
-      }
-    }
-    return aPixmap;
-  }
-  
   //===========================================================================
   // Function : getDefaultTexture
   // Purpose  : Get default texture
@@ -863,6 +823,10 @@ 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
+  bool isVerticesMode = propMap.value( GEOM::propertyName( GEOM::Vertices ) ).toBool();
+  AISShape->SetDisplayVertices( isVerticesMode );
+
   // set transparency
   if( HasTransparency() ) {
     AISShape->SetTransparency( GetTransparency() );
@@ -939,7 +903,7 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
   AISShape->setTopLevel( propMap.value( GEOM::propertyName( GEOM::TopLevel ) ).toBool() );
 
   // set point marker (for vertex / compound of vertices only)
-  if ( onlyVertex ) {
+  if ( onlyVertex || isVerticesMode ) {
     QStringList aList = propMap.value( GEOM::propertyName( GEOM::PointMarker ) ).toString().split( GEOM::subSectionSeparator() );
     if ( aList.size() == 2 ) {
       // standard marker string contains "TypeOfMarker:ScaleOfMarker"
@@ -1111,6 +1075,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 
@@ -2463,6 +2430,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 ) ) );