2 // File : Plot2d_CurveContainer.cxx
3 // Created : UI team, 05.09.00
4 // Descrip : Curve container class
6 // Modified : Mon Dec 03 15:37:21 2001
7 // Author : Vadim SANDLER
10 // Copyright : Open CASCADE 2001
13 #include "Plot2d_CurveContainer.h"
18 Plot2d_CurveContainer::Plot2d_CurveContainer()
20 myCurves.setAutoDelete( false );
25 Plot2d_CurveContainer::~Plot2d_CurveContainer()
30 Adds curve if not exist yet in the container
32 void Plot2d_CurveContainer::addCurve( Plot2d_Curve* curve )
34 if ( myCurves.find( curve ) < 0 )
35 myCurves.append( curve );
38 Removes curve form the container ( and deletes it if <alsoDelete> is true )
40 void Plot2d_CurveContainer::removeCurve( const int index, bool alsoDelete )
42 Plot2d_Curve* curve = myCurves.take( index );
43 if ( curve && alsoDelete )
47 Clears container contents ( removes and deletes all curves )
49 void Plot2d_CurveContainer::clear( bool alsoDelete )
51 while( myCurves.count() > 0 ) {
52 Plot2d_Curve* curve = myCurves.take( 0 );
53 if ( curve && alsoDelete )
58 Gets nb of curves in container
60 int Plot2d_CurveContainer::count()
62 return myCurves.count();
65 Returns true if contains no curves
67 bool Plot2d_CurveContainer::isEmpty()
69 return myCurves.isEmpty();
74 Plot2d_Curve* Plot2d_CurveContainer::curve( const int index )
76 return myCurves.at( index );