]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/GEOMGUI/GEOM_Displayer.cxx
Salome HOME
Porting to OCCT6.5.1
[modules/geom.git] / src / GEOMGUI / GEOM_Displayer.cxx
index 0746d67c4c19e754e1311db4fd4652ace649aca3..21cc4e27a66450fb28d6b7537e63c26f60460e30 100644 (file)
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
 
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : GEOM_Displayer.cxx
 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-//
+
 #include "GEOM_Displayer.h"
 
 #include "GeometryGUI.h"
@@ -48,6 +47,7 @@
 #include <SUIT_ViewManager.h>
 #include <SUIT_ResourceMgr.h>
 
+#include <Basics_OCCTVersion.hxx>
 
 #include <SalomeApp_Study.h>
 #include <SalomeApp_Application.h>
 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 
 #include <GEOMImpl_Types.hxx>
-#include <Graphic3d_HArray1OfBytes.hxx>
 
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+#include <TColStd_HArray1OfByte.hxx>
+#else
+#include <Graphic3d_HArray1OfBytes.hxx>
+#endif
 
 //================================================================
 // Function : getActiveStudy
@@ -114,7 +118,7 @@ static inline SalomeApp_Study* getActiveStudy()
 static inline int getViewManagerId( SALOME_View* theViewFrame) {
   SUIT_ViewModel* aModel = dynamic_cast<SUIT_ViewModel*>(theViewFrame);
   SUIT_ViewManager* aViewMgr = 0;
-  if(aModel != 0) 
+  if (aModel != 0)
     aViewMgr = aModel->getViewManager();
   return ((aViewMgr == 0) ? -1 :aViewMgr->getGlobalId());
 }
@@ -154,9 +158,9 @@ int GEOM_Displayer::getMinMaxShapeType( const TopoDS_Shape& shape, bool ismin )
       int stype = getMinMaxShapeType( sub_shape, ismin );
       if ( stype == TopAbs_SHAPE ) continue;
       if ( ismin && stype > ret )
-       ret = stype;
+        ret = stype;
       else if ( !ismin && ( ret < TopAbs_SOLID || stype < ret ) )
-       ret = stype;
+        ret = stype;
     }
   }
 
@@ -206,13 +210,13 @@ SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode )
 
 //================================================================
 // Function : getComplexFilter
-// Purpose  : Get compound filter corresponding to the type of 
+// Purpose  : Get compound filter corresponding to the type of
 //            object from GEOMImpl_Types.h
 //================================================================
 SUIT_SelectionFilter* GEOM_Displayer::getComplexFilter( const QList<int>* aSubShapes)
 {
   GEOM_CompoundFilter* aFilter;
-  
+
   if(aSubShapes != NULL ) {
     aFilter = new GEOM_CompoundFilter(getStudy());
     QList<int> aTopAbsTypes;
@@ -224,7 +228,7 @@ SUIT_SelectionFilter* GEOM_Displayer::getComplexFilter( const QList<int>* aSubSh
     }
     aFilter->addSubTypes(aTopAbsTypes);
   }
-  
+
   return aFilter;
 }
 
@@ -355,7 +359,7 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
       int aMgrId = getViewManagerId(vf);
       SalomeApp_Study* aStudy = getStudy();
       aStudy->setObjectProperty(aMgrId, theIO->getEntry(), VISIBILITY_PROP, 1 );
-      
+
       setVisibilityState(theIO->getEntry(), Qtx::ShownState);
 
       delete prs;  // delete presentation because displayer is its owner
@@ -407,7 +411,7 @@ void GEOM_Displayer::Erase( const Handle(SALOME_InteractiveObject)& theIO,
       if ( updateViewer )
         vf->Repaint();
       delete prs;  // delete presentation because displayer is its owner
-      
+
       int aMgrId = getViewManagerId(vf);
       SalomeApp_Study* aStudy = getStudy();
       aStudy->setObjectProperty(aMgrId, theIO->getEntry(), VISIBILITY_PROP, 0 );
@@ -539,7 +543,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
   SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( prs );
   if ( !occPrs )
     return;
-  
+
   if ( myType == GEOM_MARKER && !myShape.IsNull() && myShape.ShapeType() == TopAbs_FACE )
   {
     TopoDS_Face aFace = TopoDS::Face( myShape );
@@ -595,29 +599,29 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
     {
       SalomeApp_Study* aStudy = getStudy();
       if(!aStudy)
-       return;
+        return;
       if ( !myShape.IsNull() ) {
 
-       bool onlyVertex = (myShape.ShapeType() == TopAbs_VERTEX || isCompoundOfVertices( myShape ));
-
-       QString anEntry;
-       int aMgrId = -1;
-       if(!myIO.IsNull()) {
-         aMgrId = getViewManagerId(myViewFrame);
-         anEntry = myIO->getEntry();
-       }
-       bool useStudy = !anEntry.isEmpty() && aMgrId != -1;
-       bool useObjColor = false;
-       bool useObjMarker = false;
-       
-       PropMap aPropMap;
-       PropMap aDefPropMap;
-       
-       if(useStudy){
-         aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
-         aDefPropMap = getDefaultPropertyMap(SOCC_Viewer::Type());
-         MergePropertyMaps(aPropMap, aDefPropMap);
-       }
+        bool onlyVertex = (myShape.ShapeType() == TopAbs_VERTEX || isCompoundOfVertices( myShape ));
+
+        QString anEntry;
+        int aMgrId = -1;
+        if(!myIO.IsNull()) {
+          aMgrId = getViewManagerId(myViewFrame);
+          anEntry = myIO->getEntry();
+        }
+        bool useStudy = !anEntry.isEmpty() && aMgrId != -1;
+        bool useObjColor = false;
+        bool useObjMarker = false;
+
+        PropMap aPropMap;
+        PropMap aDefPropMap;
+
+        if(useStudy){
+          aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
+          aDefPropMap = getDefaultPropertyMap(SOCC_Viewer::Type());
+          MergePropertyMaps(aPropMap, aDefPropMap);
+        }
 
         //Handle(GEOM_AISShape) AISShape = new GEOM_AISShape( myShape, "" );
         Handle(GEOM_AISShape) AISShape;
@@ -633,41 +637,39 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
         AISShape->SetInfiniteState( myShape.Infinite() ); // || myShape.ShapeType() == TopAbs_VERTEX // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines)
 
         // Setup shape properties here ..., e.g. display mode, color, transparency, etc
-       if(useStudy) {
-         AISShape->SetDisplayMode( aPropMap.value(DISPLAY_MODE_PROP).toInt() );
-         AISShape->SetDisplayVectors(aPropMap.value(VECTOR_MODE_PROP).toInt());
-
-         //Color property
-         if(aPropMap.contains(COLOR_PROP)) {
-           Quantity_Color  quant_col = SalomeApp_Tools::color( aPropMap.value(COLOR_PROP).value<QColor>());
-           AISShape->SetShadingColor( quant_col );
-         } else 
-           useObjColor = true;   
-       }else {
-         AISShape->SetDisplayMode( myDisplayMode );
-         AISShape->SetShadingColor( myShadingColor );
-       }
-       
-
+        if(useStudy) {
+          AISShape->SetDisplayMode( aPropMap.value(DISPLAY_MODE_PROP).toInt() );
+          AISShape->SetDisplayVectors(aPropMap.value(VECTOR_MODE_PROP).toInt());
+
+          //Color property
+          if(aPropMap.contains(COLOR_PROP)) {
+            Quantity_Color  quant_col = SalomeApp_Tools::color( aPropMap.value(COLOR_PROP).value<QColor>());
+            AISShape->SetShadingColor( quant_col );
+          } else
+            useObjColor = true;
+        }else {
+          AISShape->SetDisplayMode( myDisplayMode );
+          AISShape->SetShadingColor( myShadingColor );
+        }
 
         // Set color and number for iso lines
         SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
         QColor col = aResMgr->colorValue( "Geometry", "isos_color",
                                           QColor(int(0.5*255), int(0.5*255), int(0.5*255)) );
         Quantity_Color aColor = SalomeApp_Tools::color( col );
-       
-       //get the ISOS number, set transparency if need
+
+        //get the ISOS number, set transparency if need
         int anUIsoNumber, aVIsoNumber;
-       if(useStudy) {
-         QString anIsos = aPropMap.value(ISOS_PROP).toString();
-         QStringList uv =  anIsos.split(DIGIT_SEPARATOR);
-         anUIsoNumber = uv[0].toInt();
-         aVIsoNumber = uv[1].toInt();
-         //AISShape->SetTransparency(aPropMap.value(TRANSPARENCY_PROP).toDouble());
-       } else {
-         anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1);
-         aVIsoNumber  = aResMgr->integerValue("OCCViewer", "iso_number_v", 1);
-       }
+        if(useStudy) {
+          QString anIsos = aPropMap.value(ISOS_PROP).toString();
+          QStringList uv =  anIsos.split(DIGIT_SEPARATOR);
+          anUIsoNumber = uv[0].toInt();
+          aVIsoNumber = uv[1].toInt();
+          //AISShape->SetTransparency(aPropMap.value(TRANSPARENCY_PROP).toDouble());
+        } else {
+          anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1);
+          aVIsoNumber  = aResMgr->integerValue("OCCViewer", "iso_number_v", 1);
+        }
 
         Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect();
         anAspect->SetNumber( anUIsoNumber );
@@ -684,36 +686,41 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
           AISShape->SetColor( (Quantity_NameOfColor)GetColor() );
           if ( onlyVertex )
           {
-           if(aPropMap.contains(MARKER_TYPE_PROP)) {
-             QStringList aList = aPropMap.value(MARKER_TYPE_PROP).toString().split(DIGIT_SEPARATOR);
-             if(aList.size() == 2) { //Standard marker string contains "TypeOfMarker:ScaleOfMarker"
-               Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
-               int  aTypeOfMarker = aList[0].toInt();
-               double  aScaleOfMarker = aList[1].toDouble();
-               anAspect->SetScale( aScaleOfMarker );
-               anAspect->SetTypeOfMarker((Aspect_TypeOfMarker) (aTypeOfMarker-1) );
-               anAspect->SetColor( (Quantity_NameOfColor)GetColor() );
-               AISShape->Attributes()->SetPointAspect( anAspect );
-             } else { //Custom marker string contains "IdOfTexsture"
-               int textureId = aList[0].toInt();
-               Standard_Integer aWidth, aHeight;
-               Handle(Graphic3d_HArray1OfBytes) aTexture = GeometryGUI::getTexture( aStudy, textureId, aWidth, aHeight );
-               if ( !aTexture.IsNull() ) {
-                 static int TextureId = 0;
-                 Handle(Prs3d_PointAspect) aTextureAspect = new Prs3d_PointAspect((Quantity_NameOfColor)GetColor(),
-                                                                                  ++TextureId,
-                                                                                  aWidth, aHeight,                                                                                
-                                                                                  aTexture );
-                 AISShape->Attributes()->SetPointAspect( aTextureAspect );
-                 
-               } else {
-                 useObjMarker = true;
-               }
-             }
-           } else {
-             useObjMarker = true;
-           }       
-         }
+            if(aPropMap.contains(MARKER_TYPE_PROP)) {
+              QStringList aList = aPropMap.value(MARKER_TYPE_PROP).toString().split(DIGIT_SEPARATOR);
+              if(aList.size() == 2) { //Standard marker string contains "TypeOfMarker:ScaleOfMarker"
+                Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
+                int  aTypeOfMarker = aList[0].toInt();
+                double  aScaleOfMarker = aList[1].toDouble();
+                anAspect->SetScale( aScaleOfMarker );
+                anAspect->SetTypeOfMarker((Aspect_TypeOfMarker) (aTypeOfMarker-1));
+                anAspect->SetColor((Quantity_NameOfColor)GetColor());
+                AISShape->Attributes()->SetPointAspect(anAspect);
+              } else { //Custom marker string contains "IdOfTexsture"
+                int textureId = aList[0].toInt();
+                Standard_Integer aWidth, aHeight;
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+                Handle(TColStd_HArray1OfByte) aTexture =
+#else
+                Handle(Graphic3d_HArray1OfBytes) aTexture =
+#endif
+                  GeometryGUI::getTexture(aStudy, textureId, aWidth, aHeight);
+                if (!aTexture.IsNull()) {
+                  static int TextureId = 0;
+                  Handle(Prs3d_PointAspect) aTextureAspect =
+                    new Prs3d_PointAspect ((Quantity_NameOfColor)GetColor(),
+                                           ++TextureId,
+                                           aWidth, aHeight,
+                                           aTexture);
+                  AISShape->Attributes()->SetPointAspect(aTextureAspect);
+                } else {
+                  useObjMarker = true;
+                }
+              }
+            } else {
+              useObjMarker = true;
+            }
+          }
         }
         else
         {
@@ -722,79 +729,80 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
             col = aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) );
             aColor = SalomeApp_Tools::color( col );
 
-           if(aPropMap.contains(MARKER_TYPE_PROP)) {
-             QStringList aList = aPropMap.value(MARKER_TYPE_PROP).toString().split(DIGIT_SEPARATOR);
-             if(aList.size() == 2) { //Standard marker string contains "TypeOfMarker:ScaleOfMarker"
-               int  aTypeOfMarker = aList[0].toInt();
-               double  aScaleOfMarker = aList[1].toDouble();
-               Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
-               anAspect->SetScale( aScaleOfMarker );
-               anAspect->SetTypeOfMarker((Aspect_TypeOfMarker) (aTypeOfMarker-1) );
-               anAspect->SetColor( aColor );
-               AISShape->Attributes()->SetPointAspect( anAspect );
-             } else { //Custom marker string contains "IdOfTexsture"
-               int textureId = aList[0].toInt();
-               Standard_Integer aWidth, aHeight;
-               Handle(Graphic3d_HArray1OfBytes) aTexture = GeometryGUI::getTexture( aStudy, textureId, aWidth, aHeight );
-               if ( !aTexture.IsNull() ) {
-                 static int TextureId = 0;
-                 Handle(Prs3d_PointAspect) aTextureAspect = new Prs3d_PointAspect(aColor,
-                                                                                  ++TextureId,
-                                                                                  aWidth, aHeight,                                                                                
-                                                                                  aTexture );
-                 AISShape->Attributes()->SetPointAspect( aTextureAspect );
-                 
-               } else {
-                 useObjMarker = true;
-               }
-             }
-           } else {
-             useObjMarker = true;
-           }       
-         }
-          else
-          {
+            if(aPropMap.contains(MARKER_TYPE_PROP)) {
+              QStringList aList = aPropMap.value(MARKER_TYPE_PROP).toString().split(DIGIT_SEPARATOR);
+              if(aList.size() == 2) { //Standard marker string contains "TypeOfMarker:ScaleOfMarker"
+                int  aTypeOfMarker = aList[0].toInt();
+                double  aScaleOfMarker = aList[1].toDouble();
+                Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
+                anAspect->SetScale( aScaleOfMarker );
+                anAspect->SetTypeOfMarker((Aspect_TypeOfMarker) (aTypeOfMarker-1) );
+                anAspect->SetColor( aColor );
+                AISShape->Attributes()->SetPointAspect( anAspect );
+              } else { //Custom marker string contains "IdOfTexsture"
+                int textureId = aList[0].toInt();
+                Standard_Integer aWidth, aHeight;
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+                Handle(TColStd_HArray1OfByte) aTexture =
+#else
+                Handle(Graphic3d_HArray1OfBytes) aTexture =
+#endif
+                  GeometryGUI::getTexture(aStudy, textureId, aWidth, aHeight);
+                if (!aTexture.IsNull()) {
+                  static int TextureId = 0;
+                  Handle(Prs3d_PointAspect) aTextureAspect =
+                    new Prs3d_PointAspect (aColor, ++TextureId, aWidth, aHeight, aTexture);
+                  AISShape->Attributes()->SetPointAspect( aTextureAspect );
+                } else {
+                  useObjMarker = true;
+                }
+              }
+            } else {
+              useObjMarker = true;
+            }
+          }
+          else {
             // Set line aspect
             col = aResMgr->colorValue( "Geometry", "wireframe_color", QColor( 255, 255, 0 ) );
             aColor = SalomeApp_Tools::color( col );
-            
+
             Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect();
             anAspect->SetColor( aColor );
             AISShape->Attributes()->SetLineAspect( anAspect );
-            
+
             // Set unfree boundaries aspect
             anAspect = AISShape->Attributes()->UnFreeBoundaryAspect();
             anAspect->SetColor( aColor );
             AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect );
-            
+
             // Set free boundaries aspect
             col = aResMgr->colorValue( "Geometry", "free_bound_color", QColor( 0, 255, 0 ) );
             aColor = SalomeApp_Tools::color( col );
-            
+
             anAspect = AISShape->Attributes()->FreeBoundaryAspect();
             anAspect->SetColor( aColor );
             AISShape->Attributes()->SetFreeBoundaryAspect( anAspect );
-            
+
             // Set wire aspect
             col = aResMgr->colorValue( "Geometry", "line_color", QColor( 255, 0, 0 ) );
             aColor = SalomeApp_Tools::color( col );
-            
+
             anAspect = AISShape->Attributes()->WireAspect();
             anAspect->SetColor( aColor );
             AISShape->Attributes()->SetWireAspect( anAspect );
-            
+
             // bug [SALOME platform 0019868]
             // Set deviation angle. Default one is 12 degrees (Prs3d_Drawer.cxx:18)
             //AISShape->SetOwnDeviationAngle( 10*PI/180 );
 
             // IMP 0020626
             double aDC = 0;
-           if(useStudy) {
-             aDC = aPropMap.value(DEFLECTION_COEFF_PROP).toDouble();
-           }
-           else {
-             aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001);
-           }
+            if(useStudy) {
+              aDC = aPropMap.value(DEFLECTION_COEFF_PROP).toDouble();
+            }
+            else {
+              aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001);
+            }
 
             aDC = std::max( aDC, DEFLECTION_MIN ); // to avoid to small values of the coefficient
             AISShape->SetOwnDeviationCoefficient(aDC);
@@ -821,81 +829,84 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
           AISShape->SetOwner( anObj );
         }
 
-       Handle( SALOME_InteractiveObject ) anIO = AISShape->getIO();
-       if ( !anIO.IsNull() ) {
-         _PTR(SObject) SO ( aStudy->studyDS()->FindObjectID( anIO->getEntry() ) );
-         if ( SO ) {
-           // get CORBA reference to data object
-           CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
-           if ( !CORBA::is_nil( object ) ) {
-             // downcast to GEOM object
-             GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object );
-             bool hasColor = false;
-             SALOMEDS::Color aSColor = getColor(aGeomObject,hasColor);
-             if( hasColor && useObjColor) {
-               Quantity_Color aQuanColor( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
-               AISShape->SetColor( aQuanColor );
-               AISShape->SetShadingColor( aQuanColor );
-               if ( onlyVertex ) {
-                 Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
-                 anAspect->SetColor( aQuanColor );
-                 anAspect->SetScale( myScaleOfMarker );
-                 anAspect->SetTypeOfMarker( myTypeOfMarker );
-                 AISShape->Attributes()->SetPointAspect( anAspect );
-               }
-             } else if(!hasColor) {
-               //In case if color wasn't defined in the property map of the object 
-               //and GEOM_Object color also wasn't defined get default color from Resource Mgr.
-               QColor col = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
-               Quantity_Color aQuanColor = SalomeApp_Tools::color( col );
-               AISShape->SetShadingColor( aQuanColor );
-               aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, col );
-             }
-
-             // ... marker type
-             if(useObjMarker) {
-               GEOM::marker_type aType = aGeomObject->GetMarkerType();
-               GEOM::marker_size aSize = aGeomObject->GetMarkerSize();
-               if ( aType > GEOM::MT_NONE && aType < GEOM::MT_USER && aSize > GEOM::MS_NONE && aSize <= GEOM::MS_70 ) {
-                 Aspect_TypeOfMarker aMType = (Aspect_TypeOfMarker)( (int)aType-1 );
-                 double aMSize = ((int)aSize+1)*0.5;
-                 Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
-                 anAspect->SetScale( aMSize );
-                 anAspect->SetTypeOfMarker( aMType );
-                 Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
-                 if ( hasColor )
-                   aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
-                 anAspect->SetColor( aQuanColor );
-                 AISShape->Attributes()->SetPointAspect( anAspect );
-               }
-               else if ( aType == GEOM::MT_USER ) {
-                 int aTextureId = aGeomObject->GetMarkerTexture();
-                 Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
-                 if ( hasColor ) aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
-                 Standard_Integer aWidth, aHeight;
-                 Handle(Graphic3d_HArray1OfBytes) aTexture = GeometryGUI::getTexture( getStudy(), aTextureId, aWidth, aHeight );
-                 if ( !aTexture.IsNull() ) {
-                   static int TextureId = 0;
-                   Handle(Prs3d_PointAspect) aTextureAspect = new Prs3d_PointAspect(aQuanColor,
-                                                                                    ++TextureId,
-                                                                                    aWidth, aHeight,
-                                                                                    aTexture );
-                   AISShape->Attributes()->SetPointAspect( aTextureAspect );
-                 }
-               } else { //Use marker from the preferences
-                 Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
-                 anAspect->SetScale( myScaleOfMarker );
-                 anAspect->SetTypeOfMarker( myTypeOfMarker );
-                 Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
-                 if ( hasColor )
-                   aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
-                 anAspect->SetColor( aQuanColor );
-                 AISShape->Attributes()->SetPointAspect( anAspect );           
-               }
-             }
-           }
-         }
-       }
+        Handle( SALOME_InteractiveObject ) anIO = AISShape->getIO();
+        if ( !anIO.IsNull() ) {
+          _PTR(SObject) SO ( aStudy->studyDS()->FindObjectID( anIO->getEntry() ) );
+          if ( SO ) {
+            // get CORBA reference to data object
+            CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
+            if ( !CORBA::is_nil( object ) ) {
+              // downcast to GEOM object
+              GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object );
+              bool hasColor = false;
+              SALOMEDS::Color aSColor = getColor(aGeomObject,hasColor);
+              if( hasColor && useObjColor) {
+                Quantity_Color aQuanColor( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
+                AISShape->SetColor( aQuanColor );
+                AISShape->SetShadingColor( aQuanColor );
+                if ( onlyVertex ) {
+                  Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
+                  anAspect->SetColor( aQuanColor );
+                  anAspect->SetScale( myScaleOfMarker );
+                  anAspect->SetTypeOfMarker( myTypeOfMarker );
+                  AISShape->Attributes()->SetPointAspect( anAspect );
+                }
+              } else if(!hasColor) {
+                //In case if color wasn't defined in the property map of the object
+                //and GEOM_Object color also wasn't defined get default color from Resource Mgr.
+                QColor col = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
+                Quantity_Color aQuanColor = SalomeApp_Tools::color( col );
+                AISShape->SetShadingColor( aQuanColor );
+                aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, col );
+              }
+
+              // ... marker type
+              if(useObjMarker) {
+                GEOM::marker_type aType = aGeomObject->GetMarkerType();
+                GEOM::marker_size aSize = aGeomObject->GetMarkerSize();
+                if ( aType > GEOM::MT_NONE && aType < GEOM::MT_USER && aSize > GEOM::MS_NONE && aSize <= GEOM::MS_70 ) {
+                  Aspect_TypeOfMarker aMType = (Aspect_TypeOfMarker)( (int)aType-1 );
+                  double aMSize = ((int)aSize+1)*0.5;
+                  Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
+                  anAspect->SetScale( aMSize );
+                  anAspect->SetTypeOfMarker( aMType );
+                  Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
+                  if ( hasColor )
+                    aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
+                  anAspect->SetColor( aQuanColor );
+                  AISShape->Attributes()->SetPointAspect( anAspect );
+                }
+                else if ( aType == GEOM::MT_USER ) {
+                  int aTextureId = aGeomObject->GetMarkerTexture();
+                  Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
+                  if ( hasColor ) aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
+                  Standard_Integer aWidth, aHeight;
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+                  Handle(TColStd_HArray1OfByte) aTexture =
+#else
+                  Handle(Graphic3d_HArray1OfBytes) aTexture =
+#endif
+                    GeometryGUI::getTexture(getStudy(), aTextureId, aWidth, aHeight);
+                  if (!aTexture.IsNull()) {
+                    static int TextureId = 0;
+                    Handle(Prs3d_PointAspect) aTextureAspect =
+                      new Prs3d_PointAspect(aQuanColor, ++TextureId, aWidth, aHeight, aTexture );
+                    AISShape->Attributes()->SetPointAspect( aTextureAspect );
+                  }
+                } else { //Use marker from the preferences
+                  Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
+                  anAspect->SetScale( myScaleOfMarker );
+                  anAspect->SetTypeOfMarker( myTypeOfMarker );
+                  Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
+                  if ( hasColor )
+                    aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
+                  anAspect->SetColor( aQuanColor );
+                  AISShape->Attributes()->SetPointAspect( anAspect );
+                }
+              }
+            }
+          }
+        }
         // AISShape->SetName(???); ??? necessary to set name ???
         occPrs->AddObject( AISShape );
 
@@ -949,7 +960,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
 
   if ( !vtkPrs || myShape.IsNull() || !aStudy)
     return;
-  
+
   bool useStudy = false;
   PropMap aPropMap;
 
@@ -958,7 +969,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
   if ( myType == GEOM_MARKER && myShape.ShapeType() == TopAbs_FACE ) {
     //myToActivate = false; // ouv: commented to make the trihedron pickable (see IPAL18657)
     GEOM_VTKTrihedron* aTrh = GEOM_VTKTrihedron::New();
-    
+
     if ( HasColor() ) {
       Quantity_Color aColor( (Quantity_NameOfColor)GetColor() );
       aTrh->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() );
@@ -971,7 +982,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
 
     gp_Ax2 anAx2 = aPlane->Pln().Position().Ax2();
     aTrh->SetPlacement( new Geom_Axis2Placement( anAx2 ) );
-    
+
     //    if ( SVTK_Viewer* vf = dynamic_cast<SVTK_Viewer*>( GetActiveView() ) )
     //      aTrh->SetSize( 0.5 * vf->GetTrihedronSize() );
 
@@ -990,13 +1001,13 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
     }
     useStudy = !anEntry.isEmpty() && aMgrId != -1;
 
-    
+
     theActors = vtkActorCollection::New();
     GEOM_Actor* aGeomActor = GEOM_Actor::New();
     aGeomActor->SetShape(myShape,aDefPropMap.value(DEFLECTION_COEFF_PROP).toDouble(),myType == GEOM_VECTOR);
     theActors->AddItem(aGeomActor);
     aGeomActor->Delete();
-    
+
     if(useStudy) {
       aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
       MergePropertyMaps(aPropMap, aDefPropMap);
@@ -1004,11 +1015,11 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
   }
 
   theActors->InitTraversal();
-  
+
   vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
-  
+
   vtkProperty* aProp = 0;
-  
+
   if ( HasColor() || HasWidth() )
   {
     aProp = vtkProperty::New();
@@ -1037,57 +1048,57 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
       GActor->SetProperty( aProp );
       GActor->SetPreviewProperty( aProp );
     }
-    
+
     GEOM_Actor* aGeomGActor = GEOM_Actor::SafeDownCast( anActor );
     if ( aGeomGActor != 0 )
       {
-       if ( aProp ) {
-         aGeomGActor->SetShadingProperty( aProp );
-         aGeomGActor->SetWireframeProperty( aProp );
-       }
-       int aIsos[2]= { 1, 1 };
-       if(useStudy) {
-         QString anIsos = aPropMap.value(ISOS_PROP).toString();
-         QStringList uv =  anIsos.split(DIGIT_SEPARATOR);
-         aIsos[0] = uv[0].toInt(); aIsos[1] = uv[1].toInt();
-         aGeomGActor->SetNbIsos(aIsos);
-         aGeomGActor->SetOpacity(1.0 - aPropMap.value(TRANSPARENCY_PROP).toDouble());
-         aGeomGActor->SetVectorMode(aPropMap.value(VECTOR_MODE_PROP).toInt());
-         aGeomGActor->setDisplayMode(aPropMap.value(DISPLAY_MODE_PROP).toInt());
-         aGeomGActor->SetDeflection(aPropMap.value(DEFLECTION_COEFF_PROP).toDouble()); 
-
-         vtkFloatingPointType aColor[3] = {1.,0.,0.};
-         if(aPropMap.contains(COLOR_PROP)) {
-           QColor c = aPropMap.value(COLOR_PROP).value<QColor>();
-           aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
-         } else { //Get Color from geom object
-           Handle( SALOME_InteractiveObject ) anIO = aGeomGActor->getIO();
-           if ( !anIO.IsNull() ) {
-             _PTR(SObject) SO ( aStudy->studyDS()->FindObjectID( anIO->getEntry() ) );
-             if ( SO ) {
-               // get CORBA reference to data object
-               CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
-               if ( !CORBA::is_nil( object ) ) {
-                 // downcast to GEOM object
-                 GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object );
-                 bool hasColor = false;
-                 SALOMEDS::Color aSColor = getColor(aGeomObject,hasColor);
-                 if(hasColor) {
-                   aColor[0] = aSColor.R; aColor[1] = aSColor.G; aColor[2] = aSColor.B;
-                 } else {
-                   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
-                   if(aResMgr) {
-                     QColor c = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
-                     aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
-                     aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, c );
-                   }
-                 }
-               }
-             }
-           }
-         }
-         aGeomGActor->SetColor(aColor[0],aColor[1],aColor[2]);
-       }
+        if ( aProp ) {
+          aGeomGActor->SetShadingProperty( aProp );
+          aGeomGActor->SetWireframeProperty( aProp );
+        }
+        int aIsos[2]= { 1, 1 };
+        if(useStudy) {
+          QString anIsos = aPropMap.value(ISOS_PROP).toString();
+          QStringList uv =  anIsos.split(DIGIT_SEPARATOR);
+          aIsos[0] = uv[0].toInt(); aIsos[1] = uv[1].toInt();
+          aGeomGActor->SetNbIsos(aIsos);
+          aGeomGActor->SetOpacity(1.0 - aPropMap.value(TRANSPARENCY_PROP).toDouble());
+          aGeomGActor->SetVectorMode(aPropMap.value(VECTOR_MODE_PROP).toInt());
+          aGeomGActor->setDisplayMode(aPropMap.value(DISPLAY_MODE_PROP).toInt());
+          aGeomGActor->SetDeflection(aPropMap.value(DEFLECTION_COEFF_PROP).toDouble());
+
+          vtkFloatingPointType aColor[3] = {1.,0.,0.};
+          if(aPropMap.contains(COLOR_PROP)) {
+            QColor c = aPropMap.value(COLOR_PROP).value<QColor>();
+            aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
+          } else { //Get Color from geom object
+            Handle( SALOME_InteractiveObject ) anIO = aGeomGActor->getIO();
+            if ( !anIO.IsNull() ) {
+              _PTR(SObject) SO ( aStudy->studyDS()->FindObjectID( anIO->getEntry() ) );
+              if ( SO ) {
+                // get CORBA reference to data object
+                CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
+                if ( !CORBA::is_nil( object ) ) {
+                  // downcast to GEOM object
+                  GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object );
+                  bool hasColor = false;
+                  SALOMEDS::Color aSColor = getColor(aGeomObject,hasColor);
+                  if(hasColor) {
+                    aColor[0] = aSColor.R; aColor[1] = aSColor.G; aColor[2] = aSColor.B;
+                  } else {
+                    SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+                    if(aResMgr) {
+                      QColor c = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
+                      aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
+                      aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, c );
+                    }
+                  }
+                }
+              }
+            }
+          }
+          aGeomGActor->SetColor(aColor[0],aColor[1],aColor[2]);
+        }
       }
 
     if ( myToActivate )
@@ -1367,10 +1378,10 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
   if ( theModes.Extent() == 1 )
     {
       int aMode = TColStd_MapIteratorOfMapOfInteger( theModes ).Key();
-      
+
       if ( aMode == GEOM_COMPOUNDFILTER )
         aFilter = getComplexFilter( theSubShapes );
-      else    
+      else
         aFilter = getFilter( aMode );
     }
   else if ( theModes.Extent() > 1 )
@@ -1384,7 +1395,7 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
           int aMode = anIter.Key();
           if ( aMode == GEOM_COMPOUNDFILTER )
             aFilter = getComplexFilter( theSubShapes );
-          else    
+          else
             aFilter = getFilter( aMode );
 
           if ( aFilter )
@@ -1457,14 +1468,14 @@ void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p )
       AIS_ListIteratorOfListOfInteractive it( objects );
       for ( ; it.More(); it.Next() ) {
         Handle(GEOM_AISShape) sh = Handle(GEOM_AISShape)::DownCast( it.Value() );
-       if ( sh.IsNull() ) continue;
-       Handle(SALOME_InteractiveObject) IO = sh->getIO();
-       if ( IO.IsNull() ) continue;
-       PropMap aPropMap = aStudy->getObjectPropMap( aMgrId, IO->getEntry() );
-       if ( aPropMap.contains( TRANSPARENCY_PROP ) ) {
-         double transparency = aPropMap.value(TRANSPARENCY_PROP).toDouble();
-         ic->SetTransparency( sh, transparency, true );
-       }
+        if ( sh.IsNull() ) continue;
+        Handle(SALOME_InteractiveObject) IO = sh->getIO();
+        if ( IO.IsNull() ) continue;
+        PropMap aPropMap = aStudy->getObjectPropMap( aMgrId, IO->getEntry() );
+        if ( aPropMap.contains( TRANSPARENCY_PROP ) ) {
+          double transparency = aPropMap.value(TRANSPARENCY_PROP).toDouble();
+          ic->SetTransparency( sh, transparency, true );
+        }
       }
     }
   }
@@ -1501,7 +1512,7 @@ bool GEOM_Displayer::HasColor() const
 void GEOM_Displayer::UnsetColor()
 {
   myColor = -1;
-  
+
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
   QColor col = resMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
   myShadingColor = SalomeApp_Tools::color( col );
@@ -1686,8 +1697,8 @@ SALOMEDS::Color GEOM_Displayer::getUniqueColor( const QList<SALOMEDS::Color>& th
 
 PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type) {
   PropMap aDefaultMap;
-  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();    
-  //1. Visibility 
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  //1. Visibility
   aDefaultMap.insert(VISIBILITY_PROP , 1);
 
   //2. Nb Isos
@@ -1712,11 +1723,11 @@ PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type) {
 
   //5. Vector Mode
   aDefaultMap.insert( VECTOR_MODE_PROP , 0);
-  
+
   //6. Color
   QColor col = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
   aDefaultMap.insert( COLOR_PROP , col);
-    
+
   //7. Deflection Coeff
   double aDC;
 
@@ -1770,44 +1781,44 @@ SALOMEDS::Color GEOM_Displayer::getColor(GEOM::GEOM_Object_var theGeomObject, bo
 
   if ( app && !theGeomObject->_is_nil()) {
     SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
-    
+
     if ( study ) {
       aSColor = theGeomObject->GetColor();
       hasColor = aSColor.R >= 0 && aSColor.G >= 0 && aSColor.B >= 0;
       if( !hasColor && theGeomObject->GetType() == GEOM_GROUP ) { // auto color for group
-       GEOM::GEOM_Gen_var theGeomGen = GeometryGUI::GetGeomGen();
-       GEOM::GEOM_IGroupOperations_var anOperations = theGeomGen->GetIGroupOperations( study->id() );
-       GEOM::GEOM_Object_var aMainObject = anOperations->GetMainShape( theGeomObject );
-       if ( !aMainObject->_is_nil() && aMainObject->GetAutoColor() )
-         {
-           QList<SALOMEDS::Color> aReservedColors;
-           
-           SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( app );
-           CORBA::String_var IOR = app->orb()->object_to_string( aMainObject );
-           if ( strcmp(IOR.in(), "") != 0 )
-             {
-               _PTR(Study) aStudy = study->studyDS();
-               _PTR(SObject) aMainSObject( aStudy->FindObjectIOR( std::string(IOR) ) );
-               _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;
-                   
-                   if( aChildObject->GetType() != GEOM_GROUP )
-                     continue;
-                   
-                   SALOMEDS::Color aReservedColor = aChildObject->GetColor();
-                   aReservedColors.append( aReservedColor );
-                 }
-             }
-           
-           aSColor = getUniqueColor( aReservedColors );
-           hasColor = true;
-         }
+        GEOM::GEOM_Gen_var theGeomGen = GeometryGUI::GetGeomGen();
+        GEOM::GEOM_IGroupOperations_var anOperations = theGeomGen->GetIGroupOperations( study->id() );
+        GEOM::GEOM_Object_var aMainObject = anOperations->GetMainShape( theGeomObject );
+        if ( !aMainObject->_is_nil() && aMainObject->GetAutoColor() )
+          {
+            QList<SALOMEDS::Color> aReservedColors;
+
+            SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( app );
+            CORBA::String_var IOR = app->orb()->object_to_string( aMainObject );
+            if ( strcmp(IOR.in(), "") != 0 )
+              {
+                _PTR(Study) aStudy = study->studyDS();
+                _PTR(SObject) aMainSObject( aStudy->FindObjectIOR( std::string(IOR) ) );
+                _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;
+
+                    if( aChildObject->GetType() != GEOM_GROUP )
+                      continue;
+
+                    SALOMEDS::Color aReservedColor = aChildObject->GetColor();
+                    aReservedColors.append( aReservedColor );
+                  }
+              }
+
+            aSColor = getUniqueColor( aReservedColors );
+            hasColor = true;
+          }
       }
     }
   }
@@ -1816,7 +1827,7 @@ SALOMEDS::Color GEOM_Displayer::getColor(GEOM::GEOM_Object_var theGeomObject, bo
 
 
 void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& theIO,
-                                      const bool eraseOnlyChildren) {
+                                       const bool eraseOnlyChildren) {
   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
   if ( !app )
     return;
@@ -1826,7 +1837,7 @@ void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& t
     return;
 
   LightApp_DataObject* parent = appStudy->findObjectByEntry(theIO->getEntry());
-  
+
   if( !parent)
     return;
 
@@ -1838,13 +1849,13 @@ void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& t
   foreach ( vman, vmans ) {
     SUIT_ViewModel* vmod = vman->getViewModel();
     view = dynamic_cast<SALOME_View*> ( vmod );
-    if ( view ) 
+    if ( view )
       views.append( view );
   }
-  
+
   if( views.count() == 0 )
     return;
-  
+
   //Erase childrens w/o update views
   DataObjectList listObj = parent->children( true );
   SUIT_DataObject* obj;
@@ -1852,12 +1863,12 @@ void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& t
     LightApp_DataObject* l_obj = dynamic_cast<LightApp_DataObject*>(obj);
     if(l_obj)
       foreach ( view, views ) {
-      Handle(SALOME_InteractiveObject) anIO = 
-       new SALOME_InteractiveObject(qPrintable(l_obj->entry()), "GEOM", "");
+      Handle(SALOME_InteractiveObject) anIO =
+        new SALOME_InteractiveObject(qPrintable(l_obj->entry()), "GEOM", "");
       Erase(anIO, false, false, view);
     }
   }
-  
+
   //Erase parent with view update or repaint views
   foreach ( view, views ) {
     if(!eraseOnlyChildren)