Salome HOME
bos #16700 [EDF] GEOM : Import python file after dump of explode structure from XAO...
[modules/geom.git] / src / OBJECT / GEOM_Annotation.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 1d966bb..755b4cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -66,7 +66,6 @@ GEOM_Annotation::GEOM_Annotation() : AIS_InteractiveObject()
   SetDisplayMode( 0 );
   SetZLayer( Graphic3d_ZLayerId_Default );
   SetAutoHide( Standard_True );
-  SetHilightMode( HighlightAll );
   SetMutable( Standard_True );
   SetDepthCulling( Standard_True );
 
@@ -210,7 +209,7 @@ void GEOM_Annotation::SetAttachPoint( const gp_Pnt& thePoint )
 
 // =======================================================================
 // function : SetHilightShape
-// purpose  : Sets shape (annotated shape) that will be used for hilighting.
+// purpose  : Sets shape (annotated shape) that will be used for highlighting.
 // =======================================================================
 void GEOM_Annotation::SetHilightShape( const TopoDS_Shape& theShape )
 {
@@ -616,9 +615,9 @@ GEOM_Annotation::OpenGl_Annotation::OpenGl_Annotation( GEOM_Annotation* theAnnot
                                                        const Standard_Integer theTextHeight,
                                                        const OpenGl_GraphicDriver* theDriver )
 : OpenGl_Element(),
-  myDepthMode( 0 ),
   myAISObject( theAnnotation ),
   myText( theAnnotation->myText.ToExtString() ),
+  myDepthMode( 0 ),
   myTextLineY( 0.f ),
   myTextDPI( 0 )
 {
@@ -747,15 +746,14 @@ void GEOM_Annotation::OpenGl_Annotation::Render( const Handle(OpenGl_Workspace)&
       return;
     }
   }
-
-  const bool toHighlight = theWorkspace->ToHighlight();
-
-  if (toHighlight && myAISObject->myHilightMode == HighlightLabel)
+  const Handle(Graphic3d_PresentationAttributes) aHighlightStyle = theWorkspace->HighlightStyle();
+  if (!aHighlightStyle.IsNull() && myAISObject->myHilightMode == HighlightLabel)
   {
-    theWorkspace->SetHighlight( false );
+    Handle(Graphic3d_PresentationAttributes) empty;
+    theWorkspace->SetHighlightStyle(empty);
     theWorkspace->ApplyAspectLine();
   }
-
+  
   GLint myOldDepthMode = 0;
 
   if ( myDepthMode )
@@ -867,11 +865,8 @@ void GEOM_Annotation::OpenGl_Annotation::Render( const Handle(OpenGl_Workspace)&
   }
 
   aContext->ApplyModelViewMatrix();
-
-  if ( toHighlight != theWorkspace->ToHighlight() )
-  {
-    theWorkspace->SetHighlight( toHighlight );
-  }
+  
+  theWorkspace->SetHighlightStyle(aHighlightStyle);
 }
 
 // =======================================================================
@@ -880,14 +875,13 @@ void GEOM_Annotation::OpenGl_Annotation::Render( const Handle(OpenGl_Workspace)&
 // purpose  : Perform highlighting of the presentation.
 // =======================================================================
 void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
-                                                              const Handle(Graphic3d_HighlightStyle)& theStyle,
+                                                             const Handle(Prs3d_Drawer)& theStyle,
                                                               const Standard_Integer theMode )
 {
   if ( myPrsSh.IsNull() )
   {
     Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer;
-    aDrawer->Link( Selectable()->HilightAttributes() );
-
+    aDrawer->Link( theStyle );
     Handle(Prs3d_IsoAspect) aUIsoAspect = new Prs3d_IsoAspect(
       aDrawer->UIsoAspect()->Aspect()->Color(),
       aDrawer->UIsoAspect()->Aspect()->Type(),
@@ -905,7 +899,7 @@ void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMg
   }
 
   myPrsSh->SetZLayer ( Selectable()->ZLayer() );
-
+  
   thePM->Color( Selectable(), theStyle, theMode, NULL, Graphic3d_ZLayerId_Topmost );
 
   thePM->Color( myPrsSh, theStyle, theMode, Selectable(), Graphic3d_ZLayerId_Topmost );
@@ -920,8 +914,7 @@ void GEOM_Annotation::GEOM_AnnotationOwner::Unhilight ( const Handle(PrsMgr_Pres
                                                         const Standard_Integer theMode )
 {
   SelectMgr_EntityOwner::Unhilight( thePM, theMode );
-
-  thePM->Unhighlight( myPrsSh, theMode );
+  thePM->Unhighlight( myPrsSh );
 }
 
 // =======================================================================