1 // Copyright (C) 2003 CEA/DEN, EDF R&D
5 // File : Plot2d_CurveContainer.cxx
6 // Author : Vadim SANDLER
11 #include "Plot2d_CurveContainer.h"
16 Plot2d_CurveContainer::Plot2d_CurveContainer()
18 myCurves.setAutoDelete( false );
23 Plot2d_CurveContainer::~Plot2d_CurveContainer()
28 Adds curve if not exist yet in the container
30 void Plot2d_CurveContainer::addCurve( Plot2d_Curve* curve )
32 if ( myCurves.find( curve ) < 0 )
33 myCurves.append( curve );
36 Removes curve form the container ( and deletes it if <alsoDelete> is true )
38 void Plot2d_CurveContainer::removeCurve( const int index, bool alsoDelete )
40 Plot2d_Curve* curve = myCurves.take( index );
41 if ( curve && alsoDelete )
45 Clears container contents ( removes and deletes all curves )
47 void Plot2d_CurveContainer::clear( bool alsoDelete )
49 while( myCurves.count() > 0 ) {
50 Plot2d_Curve* curve = myCurves.take( 0 );
51 if ( curve && alsoDelete )
56 Gets nb of curves in container
58 int Plot2d_CurveContainer::count()
60 return myCurves.count();
63 Returns true if contains no curves
65 bool Plot2d_CurveContainer::isEmpty()
67 return myCurves.isEmpty();
72 Plot2d_Curve* Plot2d_CurveContainer::curve( const int index )
74 return myCurves.at( index );