Salome HOME
NRI : Check if a component-username is already associated with a component-name.
[modules/kernel.git] / src / Plot2d / Plot2d_CurveContainer.cxx
1 using namespace std;
2 //  File      : Plot2d_CurveContainer.cxx
3 //  Created   : UI team, 05.09.00
4 //  Descrip   : Curve container class
5
6 //  Modified  : Mon Dec 03 15:37:21 2001
7 //  Author    : Vadim SANDLER
8 //  Project   : SALOME
9 //  Module    : Plot2d
10 //  Copyright : Open CASCADE 2001
11 //  $Header$
12
13 #include "Plot2d_CurveContainer.h"
14
15 /*!
16   Constructor
17 */
18 Plot2d_CurveContainer::Plot2d_CurveContainer()
19 {
20   myCurves.setAutoDelete( false );
21 }
22 /*!
23   Destructor
24 */
25 Plot2d_CurveContainer::~Plot2d_CurveContainer()
26 {
27   
28 }
29 /*!
30   Adds curve if not exist yet in the container
31 */
32 void Plot2d_CurveContainer::addCurve( Plot2d_Curve* curve )
33 {
34   if ( myCurves.find( curve ) < 0 )
35     myCurves.append( curve );
36 }
37 /*!
38   Removes curve form the container ( and deletes it if <alsoDelete> is true )
39 */
40 void Plot2d_CurveContainer::removeCurve( const int index, bool alsoDelete )
41 {
42   Plot2d_Curve* curve = myCurves.take( index );
43   if ( curve && alsoDelete )
44     delete curve;
45 }
46 /*!
47   Clears container contents ( removes and deletes all curves )
48 */
49 void Plot2d_CurveContainer::clear( bool alsoDelete )
50 {
51   while( myCurves.count() > 0 ) {
52     Plot2d_Curve* curve = myCurves.take( 0 );
53     if ( curve && alsoDelete )
54       delete curve;
55   }
56 }
57 /*!
58   Gets nb of curves in container
59 */
60 int Plot2d_CurveContainer::count()
61 {
62   return myCurves.count();
63 }
64 /*!
65   Returns true if contains no curves
66 */
67 bool Plot2d_CurveContainer::isEmpty()
68 {
69   return myCurves.isEmpty();
70 }
71 /*!
72   Gets curve by index
73 */
74 Plot2d_Curve* Plot2d_CurveContainer::curve( const int index )
75 {
76   return myCurves.at( index );
77 }
78
79