Salome HOME
OCC functionality moving out from the widget
[modules/hydro.git] / src / HYDROCurveCreator / CurveCreator_Displayer.cxx
1 #include "CurveCreator_Displayer.h"
2
3 CurveCreator_Displayer::CurveCreator_Displayer( Handle_AIS_InteractiveContext theContext ) :
4   myContext( theContext )
5 {
6   myObjects.clear();
7 }
8
9 CurveCreator_Displayer::~CurveCreator_Displayer(void)
10 {
11   erase( true );
12   for( int i = 0 ; i < myObjects.size() ; i++ ){
13     myObjects[i].Nullify();
14   }
15   myObjects.clear();
16 }
17
18 void CurveCreator_Displayer::display( AISObjectsList theCurveObjects, bool isUpdate )
19 {
20   myObjects = theCurveObjects;
21   if(myObjects.empty())
22     return;
23   for( int i = 0 ; i < myObjects.size() ; i++ ){
24     myContext->Display(myObjects[i], Standard_False);
25   }
26   if( isUpdate )
27     myContext->UpdateCurrentViewer();
28 }
29
30 void CurveCreator_Displayer::erase( bool isUpdate )
31 {
32   if(myObjects.empty())
33     return;
34   for( int i = 0 ; i < myObjects.size() ; i++ ){
35     myContext->Erase(myObjects[i], Standard_False);
36   }
37   if( isUpdate )
38     myContext->UpdateCurrentViewer();
39 }
40
41 void CurveCreator_Displayer::displayAIS( Handle(AIS_InteractiveObject) theObject, bool isUpdate )
42 {
43   myContext->Display( theObject, Standard_False );
44
45   if( isUpdate )
46     myContext->UpdateCurrentViewer();
47 }
48
49 void CurveCreator_Displayer::redisplayAIS( Handle(AIS_InteractiveObject) theObject, bool isUpdate )
50 {
51   myContext->Redisplay( theObject, Standard_False );
52
53   if( isUpdate )
54     myContext->UpdateCurrentViewer();
55 }
56
57 Quantity_Color CurveCreator_Displayer::getActiveColor( bool isHL )
58 {
59   if( isHL ){
60     return Quantity_Color( 1., 0., 0., Quantity_TOC_RGB );
61   }
62   return Quantity_Color( 0., 1., 0., Quantity_TOC_RGB );
63 }
64
65 void CurveCreator_Displayer::highlight( const AISObjectsList& theObjects, bool isHL )
66 {
67   return;
68   //TODO:
69   Quantity_Color aColor = getActiveColor( isHL );
70   for( int i = 0 ; i < theObjects.size() ; i++ ){
71     theObjects[i]->SetColor(aColor);
72     myContext->Display(theObjects[i], Standard_False);
73   }
74   myContext->UpdateCurrentViewer();
75 }