Salome HOME
Bug #183: regression: polyline - unnecessary table in Additition mode.
[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   eraseAll( 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( const Handle(AIS_InteractiveObject)& theObject, bool isUpdate )
19 {
20   if ( theObject.IsNull() )
21     return;
22
23   myObjects.push_back( theObject );
24   myContext->Display( theObject, Standard_False );
25
26   if( isUpdate )
27     myContext->UpdateCurrentViewer();
28 }
29
30 void CurveCreator_Displayer::eraseAll( 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   myObjects.clear();
38   if( isUpdate )
39     myContext->UpdateCurrentViewer();
40 }
41
42 Quantity_Color CurveCreator_Displayer::getActiveColor( bool isHL )
43 {
44   if( isHL ){
45     return Quantity_Color( 1., 0., 0., Quantity_TOC_RGB );
46   }
47   return Quantity_Color( 0., 1., 0., Quantity_TOC_RGB );
48 }
49
50 /*void CurveCreator_Displayer::highlight( const AISObjectsList& theObjects, bool isHL )
51 {
52   return;
53   //TODO:
54   Quantity_Color aColor = getActiveColor( isHL );
55   for( int i = 0 ; i < theObjects.size() ; i++ ){
56     theObjects[i]->SetColor(aColor);
57     myContext->Display(theObjects[i], Standard_False);
58   }
59   myContext->UpdateCurrentViewer();
60 }*/